Closed ghost closed 12 years ago
Hi, Eric-Olivier!
Have you had the opportunity to test nocache on an OS with SELinux installed? When I use it on a RHEL5 (64bit) system, with SELinux installed but disabled, I get a segmentation fault shortly after libsepol (from SELinux) is loaded:
Although SELinux is not enabled as far as I can see, my /bin/ls is nevertheless linked against it. I see the same strace as yours.
Would you know why this happens, and how to fix it?
After a little bit of digging, I know why it doesn't work. It's simply that dlsym() returns a NULL pointer for every lookup of the original function.
You can verify that this is the cause of your segfaults like this:
1) Recompile with debug flags: make -B CFLAGS=-g 2) Allow core dumps: ulimit -c unlimited 3) Make the program crash and dump a core: ./nocache ls 4) Inspect the core using gdb: gdb /bin/ls core 5) Move one frame up and look what _original_fopen is:
(gdb) up
182 if((fp = _original_fopen(path, mode)) != NULL)
(gdb) p _originalfopen $1 = (FILE (_)(const char , const char )) 0
As to why this happens and how to fix it, I'm at a loss, sorry.
Julius
Hi Julius,
Thank you very much for your effort. You might want to add calls to dlerror() in nocache.c's init() function to fail a bit more gracefully :)
I tried to search for issues between SELinux and dlsym() but could not find anything that could explain what happens. I tried on a CentOS 6 system as well and the same thing happens, although binaries are now linked against libselinux instead of libsepol.
I may ask for help on a SELinux mailing list. I will let you know if I can find anything useful.
Thank you for your help.
Hi, Eric-Olivier!
Thank you very much for your effort. You might want to add calls to dlerror() in nocache.c's init() function to fail a bit more gracefully :)
Yeah, I did that while investigating. The thing is: the errors don't show up. I pushed some error handling fixes with 5de2538b362ff6f86e9697168a02c8096f5d0eec, anyway, it might help in some other situations.
I may ask for help on a SELinux mailing list. I will let you know if I can find anything useful.
Thanks!
Julius
I believe this is fixed with e6df5f6. (See issue #2 for details.)
Thanks!
Hi,
Have you had the opportunity to test nocache on an OS with SELinux installed? When I use it on a RHEL5 (64bit) system, with SELinux installed but disabled, I get a segmentation fault shortly after libsepol (from SELinux) is loaded:
I can use nocache with other binaries not linked against libsepol, on the same machine.
Would you know why this happens, and how to fix it?
Thank you.
And thank you for nocache :)