This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: Using systemtap for rewriting syscalls?
- From: Riccardo Murri <riccardo dot murri at uzh dot ch>
- To: Josh Stone <jistone at redhat dot com>
- Cc: systemtap at sourceware dot org
- Date: Thu, 7 Apr 2016 21:46:21 +0200
- Subject: Re: Using systemtap for rewriting syscalls?
- Authentication-results: sourceware.org; auth=none
- References: <loom dot 20160405T230430-700 at post dot gmane dot org> <5704508A dot 5030404 at redhat dot com>
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