In the Linux kernel, the following vulnerability has been resolved:
bpf: fix potential 32-bit overflow when accessing ARRAY map element
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.
[ { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@063e092534d4c6785228e5b1eb6e9329f66ccbe4", "target": { "function": "array_map_update_elem", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-0afe1ed6", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "123392383068366731216273487604743305165", "length": 907.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@87ac0d600943994444e24382a87aa19acc4cd3d4", "target": { "function": "array_map_lookup_elem", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-101e9983", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "259433417690479640747873309536719481305", "length": 321.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@87ac0d600943994444e24382a87aa19acc4cd3d4", "target": { "function": "bpf_array_map_seq_start", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-1a8de084", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "183938619525575358780019720614393228785", "length": 424.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@063e092534d4c6785228e5b1eb6e9329f66ccbe4", "target": { "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-2028255c", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "line_hashes": [ "105564852361113332106977182293074780408", "196537601790818970690808096062327864548", "114809296289913070087460565554956847454", "180576442498551062722482318084266661974", "224997787711504467947952952825032897188", "44228231027612317372684672604380976470", "213225674834690421793691948977476439712", "74582578967791782239987547420097661861", "196104177430858657803883025461558625974", "18257511747492446634745976929009579845", "59370571231996346184764389847870592632", "60109161057393366438064238181354928612", "32602807228488887408921487887539804883", "148619567992250369000471992214196679604", "175940267259621380057978525703765290682", "46567488068152179473670629998175211752", "198588191644867980623455022697235986625", "266395432069033027607612576586298311305", "219355999508580405322927907977077285316", "141412862176343550576384442832453252525", "176125408614959741341104708622029096115", "182963603549092629650984064129603303384", "222727954167579664275340378096842276591", "81027186659807981659324958687740364513", "176125408614959741341104708622029096115", "182963603549092629650984064129603303384", "301110823617223324377338256077484337213", "53897401462879935218596059146152534012", "61318219583118953149000387557671745175", "163971205725856076579454430742241428361", "129352751586452939614859433404111093852", "289780201353361572013104908851948283340" ], "threshold": 0.9 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3c7256b880b3a5aa1895fd169a34aa4224a11862", "target": { "function": "bpf_for_each_array_elem", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-3d94fd41", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "101651913336293333336750907798179698775", "length": 712.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@063e092534d4c6785228e5b1eb6e9329f66ccbe4", "target": { "function": "array_map_free", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-4d41a0f1", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "330646432429964466014550450903451031011", "length": 506.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@87ac0d600943994444e24382a87aa19acc4cd3d4", "target": { "function": "array_map_update_elem", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-66e1aa74", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "123392383068366731216273487604743305165", "length": 907.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@063e092534d4c6785228e5b1eb6e9329f66ccbe4", "target": { "function": "bpf_for_each_array_elem", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-6bea77d2", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "101651913336293333336750907798179698775", "length": 712.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@87ac0d600943994444e24382a87aa19acc4cd3d4", "target": { "function": "array_map_free", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-6d1855e9", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "330646432429964466014550450903451031011", "length": 506.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@87ac0d600943994444e24382a87aa19acc4cd3d4", "target": { "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-88e5335b", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "line_hashes": [ "105564852361113332106977182293074780408", "196537601790818970690808096062327864548", "114809296289913070087460565554956847454", "180576442498551062722482318084266661974", "224997787711504467947952952825032897188", "44228231027612317372684672604380976470", "213225674834690421793691948977476439712", "74582578967791782239987547420097661861", "196104177430858657803883025461558625974", "18257511747492446634745976929009579845", "59370571231996346184764389847870592632", "60109161057393366438064238181354928612", "32602807228488887408921487887539804883", "148619567992250369000471992214196679604", "175940267259621380057978525703765290682", "46567488068152179473670629998175211752", "198588191644867980623455022697235986625", "266395432069033027607612576586298311305", "219355999508580405322927907977077285316", "141412862176343550576384442832453252525", "176125408614959741341104708622029096115", "182963603549092629650984064129603303384", "222727954167579664275340378096842276591", "81027186659807981659324958687740364513", "176125408614959741341104708622029096115", "182963603549092629650984064129603303384", "301110823617223324377338256077484337213", "53897401462879935218596059146152534012", "61318219583118953149000387557671745175", "163971205725856076579454430742241428361", "129352751586452939614859433404111093852", "289780201353361572013104908851948283340" ], "threshold": 0.9 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3c7256b880b3a5aa1895fd169a34aa4224a11862", "target": { "function": "array_map_free_timers", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-92ba2b40", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "43724790543197564854644562466867495262", "length": 311.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@063e092534d4c6785228e5b1eb6e9329f66ccbe4", "target": { "function": "bpf_array_map_seq_next", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-9bbd2058", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "214974958855900840971869257816353488616", "length": 436.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3c7256b880b3a5aa1895fd169a34aa4224a11862", "target": { "function": "bpf_array_map_seq_next", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-a4cbf4a4", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "214974958855900840971869257816353488616", "length": 436.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@87ac0d600943994444e24382a87aa19acc4cd3d4", "target": { "function": "array_map_free_timers", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-a5cbb8fc", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "43724790543197564854644562466867495262", "length": 311.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3c7256b880b3a5aa1895fd169a34aa4224a11862", "target": { "function": "array_map_update_elem", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-b24a3c2f", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "123392383068366731216273487604743305165", "length": 907.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3c7256b880b3a5aa1895fd169a34aa4224a11862", "target": { "function": "array_map_lookup_elem", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-b308f2bd", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "259433417690479640747873309536719481305", "length": 321.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3c7256b880b3a5aa1895fd169a34aa4224a11862", "target": { "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-c3e42235", "deprecated": false, "signature_version": "v1", "signature_type": "Line", "digest": { "line_hashes": [ "105564852361113332106977182293074780408", "196537601790818970690808096062327864548", "114809296289913070087460565554956847454", "180576442498551062722482318084266661974", "224997787711504467947952952825032897188", "44228231027612317372684672604380976470", "213225674834690421793691948977476439712", "74582578967791782239987547420097661861", "196104177430858657803883025461558625974", "18257511747492446634745976929009579845", "59370571231996346184764389847870592632", "60109161057393366438064238181354928612", "32602807228488887408921487887539804883", "148619567992250369000471992214196679604", "175940267259621380057978525703765290682", "46567488068152179473670629998175211752", "198588191644867980623455022697235986625", "266395432069033027607612576586298311305", "219355999508580405322927907977077285316", "141412862176343550576384442832453252525", "176125408614959741341104708622029096115", "182963603549092629650984064129603303384", "222727954167579664275340378096842276591", "81027186659807981659324958687740364513", "176125408614959741341104708622029096115", "182963603549092629650984064129603303384", "301110823617223324377338256077484337213", "53897401462879935218596059146152534012", "61318219583118953149000387557671745175", "163971205725856076579454430742241428361", "129352751586452939614859433404111093852", "289780201353361572013104908851948283340" ], "threshold": 0.9 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3c7256b880b3a5aa1895fd169a34aa4224a11862", "target": { "function": "array_map_free", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-cea5a5b8", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "330646432429964466014550450903451031011", "length": 506.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@063e092534d4c6785228e5b1eb6e9329f66ccbe4", "target": { "function": "array_map_free_timers", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-d5b9920f", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "43724790543197564854644562466867495262", "length": 311.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@3c7256b880b3a5aa1895fd169a34aa4224a11862", "target": { "function": "bpf_array_map_seq_start", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-dd9cdf69", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "183938619525575358780019720614393228785", "length": 424.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@87ac0d600943994444e24382a87aa19acc4cd3d4", "target": { "function": "bpf_for_each_array_elem", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-e3879226", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "101651913336293333336750907798179698775", "length": 712.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@063e092534d4c6785228e5b1eb6e9329f66ccbe4", "target": { "function": "bpf_array_map_seq_start", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-e82ae9bf", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "183938619525575358780019720614393228785", "length": 424.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@063e092534d4c6785228e5b1eb6e9329f66ccbe4", "target": { "function": "array_map_lookup_elem", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-e8f55f7c", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "259433417690479640747873309536719481305", "length": 321.0 } }, { "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@87ac0d600943994444e24382a87aa19acc4cd3d4", "target": { "function": "bpf_array_map_seq_next", "file": "kernel/bpf/arraymap.c" }, "id": "CVE-2022-50167-f2af399e", "deprecated": false, "signature_version": "v1", "signature_type": "Function", "digest": { "function_hash": "214974958855900840971869257816353488616", "length": 436.0 } } ]