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
  • bpf
  • verifier.c
Find file BlameHistoryPermalink
  • Alexei Starovoitov's avatar
    bpf: Fix may_goto with negative offset. · 2b2efe19
    Alexei Starovoitov authored Jun 19, 2024
    Zac's syzbot crafted a bpf prog that exposed two bugs in may_goto.
    The 1st bug is the way may_goto is patched. When offset is negative
    it should be patched differently.
    The 2nd bug is in the verifier:
    when current state may_goto_depth is equal to visited state may_goto_depth
    it means there is an actual infinite loop. It's not correct to prune
    exploration of the program at this point.
    Note, that this check doesn't limit the program to only one may_goto insn,
    since 2nd and any further may_goto will increment may_goto_depth only
    in the queued state pushed for future exploration. The current state
    will have may_goto_depth == 0 regardless of number of may_goto insns
    and the verifier has to explore the program until bpf_exit.
    
    Fixes: 011832b9
    
     ("bpf: Introduce may_goto instruction")
    Reported-by: default avatarZac Ecob <zacecob@protonmail.com>
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
    Acked-by: default avatarEduard Zingerman <eddyz87@gmail.com>
    Closes: https://lore.kernel.org/bpf/CAADnVQL-15aNp04-cyHRn47Yv61NXfYyhopyZtUyxNojUZUXpA@mail.gmail.com/
    Link: https://lore.kernel.org/bpf/20240619235355.85031-1-alexei.starovoitov@gmail.com
    2b2efe19
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7