Re: segfault with dlsym(RTLD_NEXT, "func")
From: Branimir Maksimovic (bmaxa_at_eunet.yu)
Date: 10/23/05
- Next message: Branimir Maksimovic: "Re: segfault with dlsym(RTLD_NEXT, "func")"
- Previous message: Tauno Voipio: "Re: need help in developing a secure encrypted filesystem for a usb pendrive"
- In reply to: Jirka Kosina: "Re: segfault with dlsym(RTLD_NEXT, "func")"
- Next in thread: Branimir Maksimovic: "Re: segfault with dlsym(RTLD_NEXT, "func")"
- Reply: Branimir Maksimovic: "Re: segfault with dlsym(RTLD_NEXT, "func")"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 23 Oct 2005 23:21:18 +0200
"Jirka Kosina" <jikos@jikos.cz> wrote in message
news:Pine.LNX.4.58.0510221821210.27074@twin.jikos.cz...
> On Sat, 22 Oct 2005 nirnimesh@gmail.com wrote:
>
>> void * malloc(size_t sz)
>> {
>> printf("start\n");
>> void *ptr;
>> void *(*real_malloc)(size_t);
>> real_malloc = (void * (*)(size_t))dlsym(RTLD_NEXT, "malloc");
>
> Are you sure that dlsym() doesn't call malloc() by itself?
>
> IMHO the better way for hooking the malloc()/free()/realloc()/...
> functions is to use the hooks provided by glibc. Read the chapter
> "3.2.2.10 Memory Allocation Hooks" in the glibc manual.
>
Problem is that malloc installs own atfork handlers that replace default
ones in
atfork time without checking that __free_hook, __malloc_hook is default one,
and program fails if free is called at fork time, because free_atfork will
be called instead of real hook.
Idon;t know if someone corrected that or not.
Greetings, Bane.
- Next message: Branimir Maksimovic: "Re: segfault with dlsym(RTLD_NEXT, "func")"
- Previous message: Tauno Voipio: "Re: need help in developing a secure encrypted filesystem for a usb pendrive"
- In reply to: Jirka Kosina: "Re: segfault with dlsym(RTLD_NEXT, "func")"
- Next in thread: Branimir Maksimovic: "Re: segfault with dlsym(RTLD_NEXT, "func")"
- Reply: Branimir Maksimovic: "Re: segfault with dlsym(RTLD_NEXT, "func")"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|