ld-preload

Can LD_PRELOAD be used to load different versions of glibc?

◇◆丶佛笑我妖孽 提交于 2021-02-04 18:51:20
问题 Cast of characters big-old-app is linked to an old version of glibc , say glibc-2.12 . I cannot do anything to change this. cute-new-addon.o is linked to a newer version, glibc-2.23 . This glibc-2.23 is in a nonstandard path (because I don't have sudo powers). The story I want to use cute-new-addon.o inside big-old-app . I would normally write a script for big-old-app to execute, which then calls cute-new-addon.o to perform its tricks. From the command line, it would look like: $ big-old-app

Can LD_PRELOAD be used to load different versions of glibc?

大兔子大兔子 提交于 2021-02-04 18:49:04
问题 Cast of characters big-old-app is linked to an old version of glibc , say glibc-2.12 . I cannot do anything to change this. cute-new-addon.o is linked to a newer version, glibc-2.23 . This glibc-2.23 is in a nonstandard path (because I don't have sudo powers). The story I want to use cute-new-addon.o inside big-old-app . I would normally write a script for big-old-app to execute, which then calls cute-new-addon.o to perform its tricks. From the command line, it would look like: $ big-old-app

Pointer passed to function changes unexpectedly

萝らか妹 提交于 2020-12-27 06:35:02
问题 I'm designing a preloader-based lock tracing utility that attaches to Pthreads, and I've run into a weird issue. The program works by providing wrappers that replace relevant Pthreads functions at runtime; these do some logging, and then pass the args to the real Pthreads function to do the work. They do not modify the arguments passed to them, obviously. However, when testing, I discovered that the condition variable pointer passed to my pthread_cond_wait() wrapper does not match the one

Pointer passed to function changes unexpectedly

老子叫甜甜 提交于 2020-12-27 06:34:58
问题 I'm designing a preloader-based lock tracing utility that attaches to Pthreads, and I've run into a weird issue. The program works by providing wrappers that replace relevant Pthreads functions at runtime; these do some logging, and then pass the args to the real Pthreads function to do the work. They do not modify the arguments passed to them, obviously. However, when testing, I discovered that the condition variable pointer passed to my pthread_cond_wait() wrapper does not match the one

Pointer passed to function changes unexpectedly

只愿长相守 提交于 2020-12-27 06:34:46
问题 I'm designing a preloader-based lock tracing utility that attaches to Pthreads, and I've run into a weird issue. The program works by providing wrappers that replace relevant Pthreads functions at runtime; these do some logging, and then pass the args to the real Pthreads function to do the work. They do not modify the arguments passed to them, obviously. However, when testing, I discovered that the condition variable pointer passed to my pthread_cond_wait() wrapper does not match the one

What are the differences between LD_PRELOAD and strace?

自古美人都是妖i 提交于 2020-05-26 04:10:23
问题 Both methods are used to gather system calls also parameters and return values of them. When we prefer LD_PRELOAD and why? Maybe we can say that we can only gather syscalls via strace but we can gather library calls with LD_PRELOAD trick. However, there is another tracer for libraries whose name is ltrace . 回答1: strace is using the ptrace(2) syscall (with PTRACE_SYSCALL probably), so will catch every system call (thru kernel hooks installed by ptrace ). It will work on any executable, even on

What are the differences between LD_PRELOAD and strace?

三世轮回 提交于 2020-05-26 04:08:01
问题 Both methods are used to gather system calls also parameters and return values of them. When we prefer LD_PRELOAD and why? Maybe we can say that we can only gather syscalls via strace but we can gather library calls with LD_PRELOAD trick. However, there is another tracer for libraries whose name is ltrace . 回答1: strace is using the ptrace(2) syscall (with PTRACE_SYSCALL probably), so will catch every system call (thru kernel hooks installed by ptrace ). It will work on any executable, even on