KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Using function interposition for open() with Python doesn't seem to work after the first few calls. I suspect Python is doing some kind of initialization, or something is temporarily bypassing my function. Here the open call is clearly hooked: $ cat a hi $ LD_PRELOAD=./libinterpose_python.so cat a sandbox_init() open() hi Here it happens once during Python initialization: $ LD_PRELOAD=./libinterpose_python.so python sandbox_init() Python 2.7.2 (default, Jun 12 2011, 20:20:34) [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. open() >>> sandbox_fini() Here it doesn't happen at all, and there's no error to indicate the file handle had write privileges removed: $ LD_PRELOAD=./libinterpose_python.so python3 -c 'b = open("a", "w"); b.write("hi\n"); b.flush()' sandbox_init() sandbox_fini() The code is here . Build with make -f Makefile.interpose_python . A full solution is given here .
Tags (comma-separated)
Save Edits
Cancel