Marco Elver c38904ebb7 tracing: Add task_prctl_unknown tracepoint
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-380     [001] .....    78.142904: task_prctl_unknown: option=1234 arg2=101 arg3=102 arg4=103 arg5=104

Signed-off-by: Marco Elver <elver@google.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Link: https://lore.kernel.org/r/20241108113455.2924361-1-elver@google.com
Signed-off-by: Kees Cook <kees@kernel.org>
2024-12-22 20:28:11 -08:00
..
2024-11-20 09:54:49 -08:00
2024-12-09 10:00:25 -08:00
2024-06-15 10:43:06 -07:00
2024-11-20 09:21:11 -08:00
2024-12-20 10:13:26 -08:00
2024-11-18 17:34:05 -08:00
2024-11-29 11:43:29 -08:00
2024-07-29 10:45:54 -07:00
2024-11-05 17:12:28 -08:00
2024-09-03 21:15:26 -07:00
2024-11-03 01:28:06 -05:00
2024-09-19 10:18:15 +02:00
2023-12-01 09:51:44 -08:00
2024-11-03 01:28:06 -05:00
2024-09-27 08:18:43 -07:00
2023-10-04 10:41:57 -07:00
2023-12-29 12:22:29 -08:00
2024-07-18 12:19:20 -07:00
2024-11-03 01:28:06 -05:00
2024-05-30 15:31:38 -07:00
2024-11-22 20:36:11 -08:00
2024-11-03 01:28:06 -05:00