Using systemtap for rewriting syscalls?
Riccardo Murri
riccardo.murri@uzh.ch
Thu Apr 7 19:46:00 GMT 2016
Hi Josh,
> global mocked;
> probe kernel.function("vfs_fstatat").call {
> if (user_string($filename) == "/path/to/bad/dir") {
> mocked[tid()] = 1; // remember for the .return
> $stat->dev = 123;
> $stat->ino = 456;
> // ...
> $flag = -1; // bad flag bits will trigger EINVAL
> }
> }
> probe kernel.function("vfs_fstatat").return {
> if (tid() in mocked) {
> delete mocked[tid()];
> $return = 0; // mock success!
> }
> }
>
Thanks, this is exactly what I was looking for!
Unfortunately, I was not able to try it out due to missing "debuginfo"
package in the repos, so in the end I had to reboot anyway. But I'll
keep it in the toolbox in case the same issue happens again.
Thank you very much!
Riccardo
--
Riccardo Murri
http://www.s3it.uzh.ch/about/team/#Riccardo.Murri
S3IT: Services and Support for Science IT
University of Zurich
Winterthurerstrasse 190, CH-8057 Zürich (Switzerland)
Tel: +41 44 635 4208
Fax: +41 44 635 6888
More information about the Systemtap
mailing list