Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for glibc 2.34+ : __malloc_hook / ... deprecated and no longer usable #12

Closed
vhaudiquet opened this issue May 24, 2022 · 1 comment · Fixed by #13
Closed

Update for glibc 2.34+ : __malloc_hook / ... deprecated and no longer usable #12

vhaudiquet opened this issue May 24, 2022 · 1 comment · Fixed by #13

Comments

@vhaudiquet
Copy link

I use glibc 2.35 on my system, and i can't compile libSlimGuard, because of the symbols used in src/gnuwrapper.cpp.
These symbols (__malloc_hook, etc) are not found by my compiler, because they have been removed from glibc.

From glibc 2.34 log :

  • The deprecated memory allocation hooks __malloc_hook, __realloc_hook,
    __memalign_hook and __free_hook are now removed from the API. Compatibility
    symbols are present to support legacy programs but new applications can no
    longer link to these symbols. These hooks no longer have any effect on glibc
    functionality. The malloc debugging DSO libc_malloc_debug.so currently
    supports hooks and can be preloaded to get this functionality back for older
    programs. However this is a transitional measure and may be removed in a
    future release of the GNU C Library. Users may port away from these hooks by
    writing and preloading their own malloc interposition library.

Just wanted to let you know

@jvoisin
Copy link
Contributor

jvoisin commented Aug 16, 2022

It indeed doesn't compile anymore on a recent libc:

$ git clone git@github.com:ssrg-vt/SlimGuard.git
Cloning into 'SlimGuard'...
remote: Enumerating objects: 477, done.
remote: Counting objects: 100% (81/81), done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 477 (delta 44), reused 48 (delta 21), pack-reused 396
Receiving objects: 100% (477/477), 2.89 MiB | 3.94 MiB/s, done.
Resolving deltas: 100% (277/277), done.
$  make -C SlimGuard
gcc -Wall -pedantic -O3 -Wno-deprecated-declarations -I./include -DGUARDPAGE -DRELEASE_MEM -DUSE_CANARY -o libSlimGuard.so src/gnuwrapper.cpp src/slimguard.c src/slimguard-large.c src/slimguard-mmap.c src/sll.c -shared -fPIC 
src/gnuwrapper.cpp: In function ‘void my_init_hook()’:
src/gnuwrapper.cpp:55:23: error: ‘__malloc_hook’ was not declared in this scope; did you mean ‘my_malloc_hook’?
   55 |     old_malloc_hook = __malloc_hook;
      |                       ^~~~~~~~~~~~~
      |                       my_malloc_hook
src/gnuwrapper.cpp:56:21: error: ‘__free_hook’ was not declared in this scope; did you mean ‘my_free_hook’?
   56 |     old_free_hook = __free_hook;
      |                     ^~~~~~~~~~~
      |                     my_free_hook
src/gnuwrapper.cpp:57:24: error: ‘__realloc_hook’ was not declared in this scope; did you mean ‘my_realloc_hook’?
   57 |     old_realloc_hook = __realloc_hook;
      |                        ^~~~~~~~~~~~~~
      |                        my_realloc_hook
src/gnuwrapper.cpp:58:25: error: ‘__memalign_hook’ was not declared in this scope; did you mean ‘my_memalign_hook’?
   58 |     old_memalign_hook = __memalign_hook;
      |                         ^~~~~~~~~~~~~~~
      |                         my_memalign_hook
src/gnuwrapper.cpp: At global scope:
src/gnuwrapper.cpp:81:17: warning: ‘void* my_memalign_hook(size_t, size_t, const void*)’ defined but not used [-Wunused-function]
   81 |   static void * my_memalign_hook (size_t size, size_t alignment, const void *) {
      |                 ^~~~~~~~~~~~~~~~
src/gnuwrapper.cpp:77:17: warning: ‘void* my_realloc_hook(void*, size_t, const void*)’ defined but not used [-Wunused-function]
   77 |   static void * my_realloc_hook (void * ptr, size_t size, const void *) {
      |                 ^~~~~~~~~~~~~~~
src/gnuwrapper.cpp:73:15: warning: ‘void my_free_hook(void*, const void*)’ defined but not used [-Wunused-function]
   73 |   static void my_free_hook (void * ptr, const void *) {
      |               ^~~~~~~~~~~~
src/gnuwrapper.cpp:68:17: warning: ‘void* my_malloc_hook(size_t, const void*)’ defined but not used [-Wunused-function]
   68 |   static void * my_malloc_hook (size_t size, const void *) {
      |                 ^~~~~~~~~~~~~~
make: *** [Makefile:18: libSlimGuard.so] Error 1
[2]

$ apt show libc6 | head -n2
Package: libc6
Version: 2.34-3
$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants