tools headers UAPI: Sync linux/prctl.h with the kernel sources
authorArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 17 Dec 2020 18:01:08 +0000 (15:01 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 18 Dec 2020 20:32:28 +0000 (17:32 -0300)
To pick a new prctl introduced in:

  1446e1df9eb183fd ("kernel: Implement selective syscall userspace redirection")

That results in:

  $ tools/perf/trace/beauty/prctl_option.sh > before
  $ cp include/uapi/linux/prctl.h tools/include/uapi/linux/prctl.h
  $ tools/perf/trace/beauty/prctl_option.sh > after
  $ diff -u before after
  --- before 2020-12-17 15:00:42.012537367 -0300
  +++ after 2020-12-17 15:00:49.832699463 -0300
  @@ -53,6 +53,7 @@
    [56] = "GET_TAGGED_ADDR_CTRL",
    [57] = "SET_IO_FLUSHER",
    [58] = "GET_IO_FLUSHER",
  + [59] = "SET_SYSCALL_USER_DISPATCH",
   };
   static const char *prctl_set_mm_options[] = {
    [1] = "START_CODE",
  $

Now users can do:

  # perf trace -e syscalls:sys_enter_prctl --filter "option==SET_SYSCALL_USER_DISPATCH"
^C#
  # trace -v -e syscalls:sys_enter_prctl --filter "option==SET_SYSCALL_USER_DISPATCH"
  New filter for syscalls:sys_enter_prctl: (option==0x3b) && (common_pid != 5519 && common_pid != 3404)
^C#

And also when prctl appears in a session, its options will be
translated to the string.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Gabriel Krisman Bertazi <krisman@collabora.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/include/uapi/linux/prctl.h

index 7f08277..90deb41 100644 (file)
@@ -247,4 +247,9 @@ struct prctl_mm_map {
 #define PR_SET_IO_FLUSHER              57
 #define PR_GET_IO_FLUSHER              58
 
+/* Dispatch syscalls to a userspace handler */
+#define PR_SET_SYSCALL_USER_DISPATCH   59
+# define PR_SYS_DISPATCH_OFF           0
+# define PR_SYS_DISPATCH_ON            1
+
 #endif /* _LINUX_PRCTL_H */