From: "fche at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug tapsets/23160] 4.17 breaks syscalls tapset
Date: Fri, 11 May 2018 21:27:00 -0000 [thread overview]
Message-ID: <bug-23160-6586-bqzoiTpcNt@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-23160-6586@http.sourceware.org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=23160
--- Comment #1 from Frank Ch. Eigler <fche at redhat dot com> ---
As a curiosity, I have a little prototype hacky solution to this problem.
It involves:
- hooking into the __$ARCH_sys_$SYSCALL function (__x64_sys_read etc.)
- grabbing its $regs (pt_regs*) parameter
- reusing the nd_$SYSCALL probe alias parameter handling (int_arg(2) etc.)
... but how? Add this to some common .stp file:
function set_user_mode(r) %{
c->uregs = (void*)STAP_ARG_r;
c->user_mode_p = 1;
%}
... and a variant of this to every sysc_*.stp file:
probe __nd_syscall.read = kernel.function("__x64_sys_read")
{
set_user_mode($regs)
}
Then the preexisting nd_syscall.read alias works unmodified:
probe nd_syscall.read =
__nd_syscall.read
{
@_SYSCALL_READ_NAME
asmlinkage()
fd = int_arg(1)
buf_uaddr = pointer_arg(2)
[...]
}
i.e., the set_user_mode function tricks probes built upon this alias
into thinking that the pt_regs* given to the new syscall wrapper is the
new proper register set for later registers.stp function calls to read
from.
(Season to taste; adjust kernel.function -> kprobe.function() and int_arg(2)
to fetch $regs probably.)
One big downside: no access to individual parameters as context variables.
I guess we missed that with nd_syscall probes already. But that means that
it's not possible to modify the parameters in the stap probe before they
get relayed to the real __do_sys_FUNCTION.
--
You are receiving this mail because:
You are the assignee for the bug.
next prev parent reply other threads:[~2018-05-11 21:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-10 18:01 [Bug tapsets/23160] New: " fche at redhat dot com
2018-05-11 21:27 ` fche at redhat dot com [this message]
2018-06-15 21:23 ` [Bug tapsets/23160] " fche at redhat dot com
2018-07-03 13:33 ` mcermak at redhat dot com
2018-07-09 18:16 ` fche at redhat dot com
2018-10-11 13:27 ` juddin at redhat dot com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-23160-6586-bqzoiTpcNt@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=systemtap@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).