Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
  • linux
  • tools
  • perf
  • util
  • scripting-engines
  • trace-event-python.c
Find file BlameHistoryPermalink
  • Tony Jones's avatar
    perf script python: Use PyBytes for attr in trace-event-python · d90a375b
    Tony Jones authored Jan 23, 2019
    [ Upstream commit 72e0b15c
    
     ]
    
    With Python3.  PyUnicode_FromStringAndSize is unsafe to call on attr and will
    return NULL.  Use _PyBytes_FromStringAndSize (as with raw_buf).
    
    Below is the observed behavior without the fix.  Note it is first necessary
    to apply the prior fix (Add trace_context extension module to sys,modules):
    
      # ldd /usr/bin/perf | grep -i python
              libpython3.6m.so.1.0 => /usr/lib64/libpython3.6m.so.1.0 (0x00007f8e1dfb2000)
    
      # perf record -e raw_syscalls:sys_enter /bin/false
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.018 MB perf.data (21 samples) ]
    
      # perf script -g python | cat
      generated Python script: perf-script.py
    
      # perf script -s ./perf-script.py
      in trace_begin
      Segmentation fault (core dumped)
    
    Signed-off-by: default avatarTony Jones <tonyj@suse.de>
    Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
    Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jaroslav Škarvada <jskarvad@redhat.com>
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
    Cc: Seeteena Thoufeek <s1seetee@linux.vnet.ibm.com>
    Fixes: 66dfdff0 ("perf tools: Add Python 3 support")
    Link: http://lkml.kernel.org/r/20190124005229.16146-3-tonyj@suse.de
    
    
    Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    d90a375b
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7