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
  • kernel
  • trace
  • fgraph.c
Find file BlameHistoryPermalink
  • Steven Rostedt (Google)'s avatar
    function_graph: Add READ_ONCE() when accessing fgraph_array[] · 63a8dfb8
    Steven Rostedt (Google) authored Jun 13, 2024
    In function_graph_enter() there's a loop that looks at fgraph_array[]
    elements which are fgraph_ops. It first tests if it is a fgraph_stub op,
    and if so skips it, as that's just there as a place holder. Then it checks
    the fgraph_ops filters to see if the ops wants to trace the current
    function.
    
    But if the compiler reloads the fgraph_array[] after the check against
    fgraph_stub, it could race with the fgraph_array[] being updated with the
    fgraph_stub. That would cause the stub to be processed. But the stub has a
    null "func_hash" field which will cause a NULL pointer dereference.
    
    Add a READ_ONCE() so that the gops that is compared against the
    fgraph_stub is also the gops that is processed later.
    
    Link: https://lore.kernel.org/all/CA+G9fYsSVJQZH=nM=1cjTc94PgSnMF9y65BnOv6XSoCG_b6wmw@mail.gmail.com/
    Link: https://lore.kernel.org/linux-trace-kernel/20240613095223.1f07e3a4@rorschach.local.home
    
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Fixes: cc60ee81
    
     ("function_graph: Use static_call and branch to optimize entry function")
    Reported-by: default avatarNaresh Kamboju <naresh.kamboju@linaro.org>
    Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
    Acked-by: default avatarMasami Hiramatsu (Google) <mhiramat@kernel.org>
    63a8dfb8
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7