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
You need to sign in or sign up before continuing.
  • linux
  • kernel
  • bpf
  • arraymap.c
Find file BlameHistoryPermalink
  • Andrii Nakryiko's avatar
    bpf: fix potential 32-bit overflow when accessing ARRAY map element · 87ac0d60
    Andrii Nakryiko authored Jul 14, 2022
    If BPF array map is bigger than 4GB, element pointer calculation can
    overflow because both index and elem_size are u32. Fix this everywhere
    by forcing 64-bit multiplication. Extract this formula into separate
    small helper and use it consistently in various places.
    
    Speculative-preventing formula utilizing index_mask trick is left as is,
    but explicit u64 casts are added in both places.
    
    Fixes: c85d6913
    
     ("bpf: move memory size checks to bpf_map_charge_init()")
    Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
    Link: https://lore.kernel.org/r/20220715053146.1291891-2-andrii@kernel.org
    
    
    Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
    87ac0d60
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7