Questions tagged [ld-preload]

LD_PRELOAD is a list of additional ELF shared objects that should be loaded first.

LD_PRELOAD is a list of additional ELF shared objects that should be loaded first.

For more information, visit this website

http://man7.org/linux/man-pages/man8/ld.so.8.html

234 questions
0
votes
1 answer

How to find a function prototype? (needeed for LD_PRELOAD)

I have some closed-source library. I need to create a hook (LD_PRELOAD) around a function draw_something defined and called inside this library. I want to disable it (make no actions instead of its actions). objdump nicely disassembled a function…
JIghtuse
  • 846
  • 5
  • 11
0
votes
1 answer

C++ observing the end of main() in another thread

I want to be able to catch the end of a main function and perform additional operations in another thread before process termination in C++. I have been trying to get the handle to the main thread and then join with it but seems…
0
votes
1 answer

How does c allocate memory to constant string?

I want to change malloc, memcpy and free function and use this libhooker with LD_PRELOAD. I change them, and test them for some test cases. but in one of them, my code doesn't work correct and don't know why. Test Case: int main() { string s =…
user3541386
  • 5
  • 1
  • 3
0
votes
1 answer

Cython GIL SIGSEGV

I'm getting a segmentation violation when trying to intercept calls via LD_PRELOAD from Cython. I don't understand why though? """An experiment in shimming from Cython / Python.""" cdef extern from "dlfcn.h": void* dlsym(void*, char*) void*…
CraigJPerry
  • 915
  • 1
  • 7
  • 14
0
votes
0 answers

LD_PRELOAD free/malloc/realloc/calloc free doesn't work

I'm recoding malloc/calloc/realloc/free functions. For now, I finished malloc and for tests, I just write "free" function like : void free(void* ptr) {} And I test my functions with different software, works with ls/firefox/man ... But, with…
Epitouille
  • 5,630
  • 8
  • 32
  • 53
0
votes
0 answers

How can I transparently adjust hardcoded filesystem paths?

I need to execute a compiled program which hardcodes various filesystem paths, with different values for those paths. For practical reasons, adjusting the source code of the program and recompiling it is not an option. Additionally, is is not…
Ambroz Bizjak
  • 7,399
  • 1
  • 34
  • 44
0
votes
1 answer

Using LD_PRELOAD with fstream

I am using LD_PRELOAD to overload system(), fopen() etc. and now i want to replace fstream with my own implementation but i don't know where to start. I searched the web but can't find any good examples about overloading parts or a whole of a class.…
erelender
  • 5,817
  • 29
  • 47
0
votes
2 answers

LD_PRELOAD and weak references minimal example doesn't work

This is probably going to be embarrassing: I am using library prelaoding in other projects, but I cannot get this minimal example to work: weakref.h: void f_weak() __attribute__((weak)); weakref.c: #include #include "weakref.h" void…
steffen
  • 7,380
  • 8
  • 40
  • 78
0
votes
1 answer

why is the value of LD_PRELOAD on the stack

I'm studying buffer overflow and solving some wargames. There was a problem that all of the stack memory above the buffer is set to 0 except return address of main, which will be: buffer [0000000...][RET][000000...] and I can overwrite that RET. So…
lbyeoksan
  • 113
  • 5
0
votes
1 answer

LD_PRELOAD trouble

I've been hooking some methods within the OpenGL interface to add some additional functionality (in this case, convert OpenGL to a TCP/UDP protocol). I've been using a simple shared library which I've built with GCC along with LD_Preload to modify…
user2078888
  • 27
  • 1
  • 5
0
votes
0 answers

is there any way to load shared library dynamically without using LD_PRELOAD?

Im working with C++ application. I want to load my shared library to be loaded before any shared library loaded to my application. One way is to use LD_PRELOAD in the code. But is it possible to do above scenario without using LD_PRELOAD?
BSalunke
  • 10,309
  • 8
  • 31
  • 57
0
votes
0 answers

Why my LD_PRELOAD interception works for open/close but not for fopen/fclose?

I am trying to use LD_PRELOAD to intercept calls to open/close. My test implementation of close() is just int close(int fd) { fprintf(stderr, "TEST\n"); return syscall(SYS_close, fd); } and I have a test program that does int…
0
votes
1 answer

LD_LIBRARY_PATH doesn't work without LD_PRELOAD

I'm setting LD_LIBRARY_PATH to make newer Qt Mobility be used instead of the older one, so that the non-native apps can use it. export LD_LIBRARY_PATH=/opt/qtm12/lib One of the libraries is libQtSensors.so.1 but still,…
marmistrz
  • 5,296
  • 9
  • 31
  • 84
0
votes
1 answer

Should LD_PRELOAD load module or just use module to replace symbols

We have a multi-threaded c++ app compiled with g++ running on an embedded powerpc. To memory leak test this in a continuous integration test we've created a heap analyzer that gets loaded with ld_preload. We'd like to guarantee that a function in…
Fenster34
  • 416
  • 4
  • 10
0
votes
2 answers

G++ how to compile for FreeBSD on linux server

I wrote some code for linux/unix(ld_preload), how can i compile it for FreeBSD on my Ubuntu Server using G++, or maybe other compiler? Thanks!
Robert
  • 487
  • 2
  • 8
  • 18
1 2 3
15
16