• Arnaldo Carvalho de Melo's avatar
    perf trace beauty: Beautify arch_prctl()'s arguments · fb7068e7
    Arnaldo Carvalho de Melo authored
    This actually so far, AFAIK is available only in x86, so the code was
    put in place with x86 prefixes, in arches where it is not available it
    will just not be called, so no further mechanisms are needed at this
    time.
    
    Later, when other arches wire this up, we'll just look at the uname
    (live sessions) or perf_env data in the perf.data header to auto-wire
    the right beautifier.
    
    With this the output is the same as produced by 'strace' when used with
    the following ~/.perfconfig:
    
      # cat ~/.perfconfig
      [llvm]
    	dump-obj = true
      [trace]
    	  add_events = /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
    	  show_zeros = yes
    	  show_duration = no
    	  no_inherit = yes
    	  show_timestamp = no
    	  show_arg_names = no
    	  args_alignment = -40
    	  show_prefix = yes
      #
    
    And, on fedora 29, since the string tables are generated from the kernel
    sources, we don't know about 0x3001, just like strace:
    
      --- /tmp/strace 2018-12-17 11:22:08.707586721 -0300
      +++ /tmp/trace  2018-12-18 11:11:32.037512729 -0300
      @@ -1,49 +1,49 @@
      -arch_prctl(0x3001 /* ARCH_??? */, 0x7ffc8a92dc80) = -1 EINVAL (Invalid argument)
      +arch_prctl(0x3001 /* ARCH_??? */, 0x7ffe4eb93ae0) = -1 EINVAL (Invalid argument)
      -arch_prctl(ARCH_SET_FS, 0x7faf6700f540) = 0
      +arch_prctl(ARCH_SET_FS, 0x7fb507364540) = 0
    
    And that seems to be related to the CET/Shadow Stack feature, that
    userland in Fedora 29 (glibc 2.28) are querying the kernel about, that
    0x3001 seems to be ARCH_CET_STATUS, I'll check the situation and test
    with a fedora 29 kernel to see if the other codes are used.
    
    A diff that ignores the different pointers for different runs needs to
    be put in place in the upcoming regression tests comparing 'perf trace's
    output to strace's.
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Jiri Olsa <jolsa@kernel.org>
    Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Wang Nan <wangnan0@huawei.com>
    Link: https://lkml.kernel.org/n/tip-73a9prs8ktkrt97trtdmdjs8@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    fb7068e7
Build 344 Bytes