From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Marco Elver <elver@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Kees Cook <keescook@chromium.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
Dmitry Vyukov <dvyukov@google.com>,
kasan-dev@googlegroups.com
Subject: Re: [PATCH v2 1/2] tracing: Add task_prctl_unknown tracepoint
Date: Thu, 7 Nov 2024 10:52:37 -0500 [thread overview]
Message-ID: <3326c8a1-36c7-476b-8afa-2957f5bd5426@efficios.com> (raw)
In-Reply-To: <CANpmjNPWLOfXBMYV0_Eon6NgKPyDorTxwS4b67ZKz7hyz5i13A@mail.gmail.com>
On 2024-11-07 10:46, Marco Elver wrote:
> On Thu, 7 Nov 2024 at 16:45, Mathieu Desnoyers
> <mathieu.desnoyers@efficios.com> wrote:
>>
>> On 2024-11-07 07:25, Marco Elver wrote:
>>> prctl() is a complex syscall which multiplexes its functionality based
>>> on a large set of PR_* options. Currently we count 64 such options. The
>>> return value of unknown options is -EINVAL, and doesn't distinguish from
>>> known options that were passed invalid args that also return -EINVAL.
>>>
>>> To understand if programs are attempting to use prctl() options not yet
>>> available on the running kernel, provide the task_prctl_unknown
>>> tracepoint.
>>>
>>> Note, this tracepoint is in an unlikely cold path, and would therefore
>>> be suitable for continuous monitoring (e.g. via perf_event_open).
>>>
>>> While the above is likely the simplest usecase, additionally this
>>> tracepoint can help unlock some testing scenarios (where probing
>>> sys_enter or sys_exit causes undesirable performance overheads):
>>>
>>> a. unprivileged triggering of a test module: test modules may register a
>>> probe to be called back on task_prctl_unknown, and pick a very large
>>> unknown prctl() option upon which they perform a test function for an
>>> unprivileged user;
>>>
>>> b. unprivileged triggering of an eBPF program function: similar
>>> as idea (a).
>>>
>>> Example trace_pipe output:
>>>
>>> test-484 [000] ..... 631.748104: task_prctl_unknown: comm=test option=1234 arg2=101 arg3=102 arg4=103 arg5=104
>>>
>>
>> My concern is that we start adding tons of special-case
>> tracepoints to the implementation of system calls which
>> are redundant with the sys_enter/exit tracepoints.
>>
>> Why favor this approach rather than hooking on sys_enter/exit ?
>
> It's __extremely__ expensive when deployed at scale. See note in
> commit description above.
I suspect you base the overhead analysis on the x86-64 implementation
of sys_enter/exit tracepoint and especially the overhead caused by
the SYSCALL_WORK_SYSCALL_TRACEPOINT thread flag, am I correct ?
If that is causing a too large overhead, we should investigate if
those can be improved instead of adding tracepoints in the
implementation of system calls.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
next prev parent reply other threads:[~2024-11-07 15:54 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 12:25 Marco Elver
2024-11-07 12:25 ` [PATCH v2 2/2] tracing: Remove pid in task_rename tracing output Marco Elver
2024-11-07 15:34 ` [PATCH v2 1/2] tracing: Add task_prctl_unknown tracepoint Steven Rostedt
2024-11-07 15:46 ` Marco Elver
2024-11-07 15:44 ` Mathieu Desnoyers
2024-11-07 15:46 ` Marco Elver
2024-11-07 15:52 ` Steven Rostedt
2024-11-07 15:52 ` Mathieu Desnoyers [this message]
2024-11-07 15:57 ` Marco Elver
2024-11-07 16:04 ` Steven Rostedt
2024-11-07 16:36 ` Mathieu Desnoyers
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=3326c8a1-36c7-476b-8afa-2957f5bd5426@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=oleg@redhat.com \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®