-
Notifications
You must be signed in to change notification settings - Fork 122
Introduce signal intercepting example #46
base: master
Are you sure you want to change the base?
Conversation
BTW, this can be used to handle nasty pointers pass to pmemfile via syscall interfaces, e.g.:
|
So, this info could be added to the source file and/or to some README. Reviewed 3 of 3 files at r1. Comments from Reviewable |
This build fails. Not quite sure why. |
520920f
to
c49e7af
Compare
I think there is something really wrong with the docker related scripts, which wasn't manifested until #48 was merged. |
c49e7af
to
722410d
Compare
It is a nice first attempt to demonstrate the idea, far from complete. To give it a try, start the dummy program which installs a signal handler: LD_LIBRARY_PATH=./examples LD_PRELOAD=libsignal_interceptor.so ./examples/signaller Send it a USR! signal, and see what happens.
722410d
to
154f91f
Compare
Codecov Report
@@ Coverage Diff @@
## master #46 +/- ##
=======================================
Coverage 69.71% 69.71%
=======================================
Files 19 19
Lines 1433 1433
Branches 391 391
=======================================
Hits 999 999
Misses 235 235
Partials 199 199
Continue to review full report at Codecov.
|
static const char busy_msg[] = "Sorry, I'm busy!\n"; | ||
syscall_no_intercept(SYS_write, 2, busy_msg, strlen(busy_msg)); | ||
|
||
/* XXX Another signal can arrive here, and that makes me a sad panda. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use atomic and increase it before filling deferred_queue? That should solve this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would solve this.
But, after I made this PR, I realized it is not easy to prove correctness under all circumstances. A signal can arrive anytime, while serving rt_sigaction, while executing the deferred signals, while executing a signal that arrived while handling a deferred signal... And what if the user installed a signal handler which writes to some log on segfault, or mmap's something into memory on segfault, to be able to continue -- we just defer such a signal, and try to resume instead, which doesn't work.
So, there are a lot of details to work out.
It is a nice first attempt to demonstrate the idea, far from complete.
To give it a try, start the dummy program which installs a signal handler:
LD_LIBRARY_PATH=./examples LD_PRELOAD=libsignal_interceptor.so ./examples/signaller
Send it a USR1 signal, and see what happens.
Ref: #4
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)