Closed Nereuxofficial closed 1 year ago
Sorry I didn't see this notification!
I don't have a Linux machine ready atm, but I'll see if I can reproduce this with WSL.
Looks like the Segfault is because you're calling let file = File::open("/etc/timezone").unwrap();
inside your hook. That triggers another call to open
, which triggers your detour again, creating a recursive loop and overflowing the stack
Thanks for your help! That worked, for some reason i just assumed File::open would not use a syscall but that could've easily have been prevented by using strace.
I'm trying to use this crate to (for now) detour the open syscall in cat to use my own syscall, however i've run into issues with Segfaults which i am sadly unable to fix(Probably due to me being inexperienced).
Anyway here are the relevant code sections:
And i'm calling it with:
LD_PRELOAD=$PWD/target/debug/libfast_way_to_holiday.so /usr/bin/cat /etc/hosts
However that causes a Segfault.
And i wrote a test using this code:
So at this point i decided to ask for help since i'm out of ideas. Also thanks for forking this crate and making it work on the latest nightly. I'd be happy to clean up my code and add another example for this repo once it works.