{"id":"CVE-2024-50164","summary":"bpf: Fix overloading of MEM_UNINIT's meaning","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Fix overloading of MEM_UNINIT's meaning\n\nLonial reported an issue in the BPF verifier where check_mem_size_reg()\nhas the following code:\n\n    if (!tnum_is_const(reg-\u003evar_off))\n        /* For unprivileged variable accesses, disable raw\n         * mode so that the program is required to\n         * initialize all the memory that the helper could\n         * just partially fill up.\n         */\n         meta = NULL;\n\nThis means that writes are not checked when the register containing the\nsize of the passed buffer has not a fixed size. Through this bug, a BPF\nprogram can write to a map which is marked as read-only, for example,\n.rodata global maps.\n\nThe problem is that MEM_UNINIT's initial meaning that \"the passed buffer\nto the BPF helper does not need to be initialized\" which was added back\nin commit 435faee1aae9 (\"bpf, verifier: add ARG_PTR_TO_RAW_STACK type\")\ngot overloaded over time with \"the passed buffer is being written to\".\n\nThe problem however is that checks such as the above which were added later\nvia 06c1c049721a (\"bpf: allow helpers access to variable memory\") set meta\nto NULL in order force the user to always initialize the passed buffer to\nthe helper. Due to the current double meaning of MEM_UNINIT, this bypasses\nverifier write checks to the memory (not boundary checks though) and only\nassumes the latter memory is read instead.\n\nFix this by reverting MEM_UNINIT back to its original meaning, and having\nMEM_WRITE as an annotation to BPF helpers in order to then trigger the\nBPF verifier checks for writing to memory.\n\nSome notes: check_arg_pair_ok() ensures that for ARG_CONST_SIZE{,_OR_ZERO}\nwe can access fn-\u003earg_type[arg - 1] since it must contain a preceding\nARG_PTR_TO_MEM. For check_mem_reg() the meta argument can be removed\naltogether since we do check both BPF_READ and BPF_WRITE. Same for the\nequivalent check_kfunc_mem_size_reg().","modified":"2026-05-18T05:59:01.686390101Z","published":"2024-11-07T09:31:41.012Z","related":["USN-7276-1","USN-7277-1","openSUSE-SU-2024:14500-1","openSUSE-SU-2025:14705-1"],"database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/50xxx/CVE-2024-50164.json"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/43f4df339a4d375bedcad29a61ae6f0ee7a048f8"},{"type":"WEB","url":"https://git.kernel.org/stable/c/48068ccaea957469f1adf78dfd2c1c9a7e18f0fe"},{"type":"WEB","url":"https://git.kernel.org/stable/c/54bc31682660810af1bed7ca7a19f182df8d3df8"},{"type":"WEB","url":"https://git.kernel.org/stable/c/8ea607330a39184f51737c6ae706db7fdca7628e"},{"type":"WEB","url":"https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2024/50xxx/CVE-2024-50164.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-50164"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"97e6d7dab1ca4648821c790a2b7913d6d5d549db"},{"fixed":"43f4df339a4d375bedcad29a61ae6f0ee7a048f8"},{"fixed":"48068ccaea957469f1adf78dfd2c1c9a7e18f0fe"},{"fixed":"54bc31682660810af1bed7ca7a19f182df8d3df8"},{"fixed":"8ea607330a39184f51737c6ae706db7fdca7628e"}]},{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"0"},{"last_affected":"6099a6c8a749a5c8d5f8b4c4342022a92072a02b"},{"last_affected":"bfe25df63048edd4ceaf78a2fc755d5e2befc978"},{"last_affected":"717c39718dbc4f7ebcbb7b625fb11851cd9007fe"},{"last_affected":"5d0bba8232bf22ce13747cbfc8f696318ff01a50"},{"last_affected":"70674d11d14eeecad90be4b409a22b902112ba32"},{"last_affected":"a08d942ecbf46e23a192093f6983cb1d779f4fa8"}]}],"versions":["v5.18","v5.18-rc1","v5.18.1","v5.17.12","v5.15.44","v5.15.43","v5.17.11","v5.18-rc7","v5.18-rc2","v5.17.10","v5.15.42","v5.17.9","v5.15.41","v5.17.8","v5.15.40","v5.18-rc5","v5.17","v5.18-rc4","v5.18-rc3","v5.18-rc6","v5.17.7","v5.15.39","v5.17.6","v5.15.38","v5.17.5","v5.15.37","v5.15.36","v5.17.4","v5.15.35","v5.17.3","v5.15.34","v5.15.33","v5.17.2","v5.15.32","v5.17.1","v5.17-rc6","v5.17-rc4","v5.15.31","v5.17-rc8","v5.17-rc7","v5.15.30","v5.17-rc1","v5.15.29","v5.17-rc3","v5.15.28","v5.17-rc2","v5.15.27","v5.15.26","v5.17-rc5","v5.16","v5.15.25","v5.15.24","v5.15.23","v5.15.22","v5.15.21","v5.15.20","v5.15.19","v5.15.18","v5.15.17","v5.15.16","v5.15.15","v5.16-rc1","v5.15.14","v5.16-rc8","v5.15.13","v5.16-rc5","v5.16-rc6","v5.15.12","v5.16-rc7","v5.15.11","v5.16-rc3","v5.16-rc2","v5.15.10","v5.15.9","v5.16-rc4","v5.15.8","v5.15.7","v5.15","v5.15.6","v5.15.5","v5.15.4","v5.15.3","v5.15.2","v5.15.1","v5.15-rc2","v5.15-rc1","v5.15-rc4","v5.15-rc7","v5.15-rc3","v5.15-rc5","v5.15-rc6","v5.14","v5.14-rc3","v5.14-rc1","v5.14-rc2","v5.14-rc7","v5.14-rc6","v5.13-rc1","v5.14-rc5","v5.14-rc4","v5.13","v5.13-rc6","v5.13-rc7","v5.13-rc3","v5.13-rc2","v5.13-rc4","v5.13-rc5","v5.12","v5.12-rc2","v5.12-rc1-dontuse","v5.12-rc1","v5.12-rc8","v5.12-rc3","v5.12-rc7","v5.12-rc5","v5.12-rc6","v5.12-rc4","v5.10","v5.11","v5.11-rc3","v5.11-rc7","v5.11-rc6","v5.11-rc5","v5.11-rc1","v5.11-rc4","v5.11-rc2","v5.10-rc1","v5.10-rc7","v5.10-rc4","v5.10-rc3","v5.10-rc6","v5.9","v5.10-rc2","v5.10-rc5","v5.9-rc1","v5.9-rc7","v5.9-rc8","v5.9-rc6","v5.9-rc4","v5.9-rc5","v5.9-rc3","v5.9-rc2","v5.8","v5.7","v5.8-rc2","v5.8-rc1","v5.8-rc7","v5.8-rc5","v5.8-rc3","v5.8-rc4","v5.8-rc6","v5.7-rc4","v5.7-rc7","v5.7-rc1","v5.7-rc3","v5.7-rc2","v5.7-rc5","v5.7-rc6","v5.6","v5.6-rc1","v5.6-rc7","v5.6-rc6","v5.6-rc3","v5.6-rc4","v5.6-rc2","v5.6-rc5","v5.5","v5.5-rc5","v5.5-rc7","v5.5-rc2","v5.5-rc1","v5.4","v5.5-rc4","v5.5-rc3","v5.5-rc6","v5.4-rc1","v5.4-rc6","v5.4-rc3","v5.4-rc4","v5.4-rc8","v5.4-rc7","v5.4-rc5","v5.3","v5.4-rc2","v5.3-rc5","v5.3-rc1","v5.3-rc2","v5.3-rc3","v5.3-rc8","v5.3-rc7","v5.3-rc4","v5.2","v5.3-rc6","v5.2-rc2","v5.2-rc7","v5.2-rc4","v5.2-rc1","v5.2-rc5","v5.2-rc6","v5.2-rc3","v5.1","v5.0-rc8","v5.1-rc7","v5.1-rc1","v5.1-rc6","v5.1-rc5","v5.0","v5.1-rc3","v5.1-rc2","v5.1-rc4","v5.0-rc1","v5.0-rc4","v5.0-rc3","v5.0-rc6","v5.0-rc7","v5.0-rc2","v5.0-rc5","v4.20-rc1","v4.19","v4.20","v4.20-rc7","v4.20-rc5","v4.20-rc6","v4.20-rc4","v4.20-rc2","v4.20-rc3","v4.19-rc2","v4.19-rc8","v4.19-rc4","v4.19-rc1","v4.19-rc7","v4.19-rc6","v4.19-rc5","v4.19-rc3","v4.18","v4.18-rc1","v4.18-rc8","v4.18-rc2","v4.18-rc5","v4.18-rc6","v4.18-rc7","v4.17","v4.18-rc3","v4.18-rc4","v4.17-rc1","v4.17-rc2","v4.17-rc7","v4.17-rc3","v4.17-rc4","v4.16","v4.17-rc6","v4.17-rc5","v4.16-rc7","v4.16-rc4","v4.16-rc1","v4.16-rc2","v4.16-rc5","v4.16-rc3","v4.16-rc6","v4.14","v4.15","v4.15-rc1","v4.15-rc4","v4.15-rc9","v4.15-rc8","v4.15-rc7","v4.15-rc3","v4.15-rc2","v4.15-rc5","v4.15-rc6","v4.14-rc1","v4.14-rc7","v4.14-rc3","v4.13","v4.14-rc8","v4.14-rc4","v4.14-rc6","v4.14-rc2","v4.14-rc5","v4.13-rc2","v4.13-rc1","v4.13-rc3","v4.13-rc7","v4.13-rc4","v4.13-rc5","v4.13-rc6","v4.12-rc1","v4.12","v4.12-rc5","v4.12-rc7","v4.12-rc6","v4.12-rc4","v4.12-rc2","v4.12-rc3","v4.11","v4.11-rc1","v4.11-rc6","v4.11-rc8","v4.11-rc7","v4.11-rc3","v4.11-rc5","v4.11-rc2","v4.11-rc4","v4.10","v4.9","v4.10-rc8","v4.10-rc3","v4.10-rc1","v4.10-rc7","v4.10-rc6","v4.10-rc2","v4.10-rc5","v4.10-rc4","v4.9-rc7","v4.9-rc6","v4.9-rc8","v4.9-rc1","v4.9-rc5","v4.9-rc3","v4.9-rc4","v4.9-rc2","v4.8","v4.8-rc8","v4.8-rc2","v4.8-rc1","v4.8-rc7","v4.8-rc6","v4.8-rc5","v4.8-rc4","v4.8-rc3","v4.7","v4.7-rc4","v4.7-rc2","v4.7-rc1","v4.7-rc7","v4.7-rc6","v4.7-rc3","v4.7-rc5","v4.6","v4.6-rc1","v4.6-rc6","v4.6-rc4","v4.6-rc7","v4.6-rc5","v4.5-rc4","v4.6-rc2","v4.6-rc3","v4.5","v4.4","v4.5-rc1","v4.5-rc6","v4.5-rc2","v4.5-rc7","v4.5-rc5","v4.5-rc3","v4.4-rc1","v4.4-rc2","v4.4-rc8","v4.4-rc3","v4.4-rc7","v4.4-rc5","v4.4-rc6","v4.4-rc4","v4.3","v4.3-rc1","v4.3-rc6","v4.3-rc4","v4.3-rc2","v4.3-rc7","v4.3-rc5","v4.3-rc3","v4.2","v4.2-rc2","v4.2-rc1","v4.2-rc8","v4.2-rc4","v4.2-rc6","v4.2-rc7","v4.0-rc5","v4.2-rc5","v4.2-rc3","v4.1-rc2","v4.1","v4.1-rc1","v4.1-rc8","v4.1-rc7","v4.1-rc6","v4.1-rc3","v4.1-rc4","v4.0","v4.1-rc5","v4.0-rc1","v4.0-rc2","v4.0-rc7","v4.0-rc3","v4.0-rc6","v4.0-rc4","v3.19","v3.19-rc7","v3.19-rc5","v3.19-rc1","v3.19-rc6","v3.19-rc4","v3.18-rc1","v3.19-rc3","v3.19-rc2","v3.18","v3.18-rc7","v3.18-rc6","v3.18-rc2","v3.18-rc3","v3.18-rc4","v3.18-rc5","v3.17","v3.17-rc1","v3.17-rc7","v3.17-rc2","v3.17-rc4","v3.16","v3.17-rc5","v3.17-rc6","v3.17-rc3","v3.16-rc7","v3.16-rc1","v3.16-rc3","v3.16-rc5","v3.16-rc6","v3.16-rc2","v3.16-rc4","v3.13","v3.15","v3.15-rc5","v3.15-rc8","v3.15-rc1","v3.15-rc6","v3.15-rc3","v3.15-rc7","v3.15-rc2","v3.15-rc4","v3.14","v3.14-rc4","v3.14-rc8","v3.14-rc7","v3.14-rc6","v3.14-rc1","v3.14-rc2","v3.14-rc5","v3.14-rc3","v3.13-rc6","v3.13-rc8","v3.12","v3.13-rc7","v3.13-rc1","v3.13-rc4","v3.13-rc3","v3.13-rc5","v3.13-rc2","v3.12-rc7","v3.12-rc3","v3.12-rc6","v3.12-rc1","v3.12-rc5","v3.11","v3.12-rc2","v3.12-rc4","v3.11-rc7","v3.11-rc2","v3.11-rc5","v3.11-rc1","v3.11-rc3","v3.11-rc4","v3.11-rc6","v3.10-rc2","v3.10","v3.10-rc7","v3.10-rc6","v3.10-rc1","v3.10-rc5","v3.10-rc3","v3.10-rc4","v3.9","v3.9-rc2","v3.9-rc7","v3.9-rc8","v3.9-rc3","v3.9-rc6","v3.9-rc5","v3.9-rc4","v3.9-rc1","v3.8","v3.8-rc7","v3.8-rc6","v3.8-rc5","v3.8-rc2","v3.8-rc1","v3.8-rc3","v3.8-rc4","v3.7","v3.7-rc1","v3.6","v3.7-rc6","v3.7-rc7","v3.7-rc3","v3.7-rc8","v3.7-rc2","v3.7-rc4","v3.7-rc5","v3.6-rc7","v3.6-rc1","v3.5-rc3","v3.6-rc6","v3.6-rc5","v3.5","v3.6-rc3","v3.6-rc4","v3.6-rc2","v3.4-rc4","v3.5-rc7","v3.5-rc5","v3.5-rc6","v3.5-rc2","v3.5-rc1","v3.5-rc4","v3.4","v3.4-rc2","v3.4-rc1","v3.4-rc7","v3.4-rc6","v3.4-rc3","v3.4-rc5","v3.3","v3.3-rc6","v3.3-rc3","v3.3-rc7","v3.3-rc2","v3.3-rc5","v3.2","v3.3-rc4","v3.3-rc1","v3.2-rc4","v3.2-rc7","v3.2-rc6","v3.2-rc5","v3.2-rc3","v3.1","v3.2-rc2","v3.2-rc1","v3.1-rc1","v3.1-rc9","v3.1-rc8","v3.1-rc10","v3.1-rc7","v3.1-rc3","v3.1-rc2","v3.1-rc4","v3.1-rc5","v3.0","v3.1-rc6","v3.0-rc7","v3.0-rc4","v3.0-rc6","v3.0-rc5","v3.0-rc3","v3.0-rc1","v2.6.39","v3.0-rc2","v2.6.38","v2.6.39-rc2","v2.6.39-rc7","v2.6.39-rc5","v2.6.39-rc1","v2.6.38-rc7","v2.6.39-rc6","v2.6.39-rc4","v2.6.39-rc3","v2.6.37","v2.6.38-rc1","v2.6.38-rc8","v2.6.38-rc2","v2.6.38-rc6","v2.6.38-rc5","v2.6.38-rc4","v2.6.38-rc3","v2.6.37-rc4","v2.6.37-rc2","v2.6.36","v2.6.37-rc5","v2.6.37-rc8","v2.6.37-rc7","v2.6.37-rc6","v2.6.37-rc1","v2.6.37-rc3","v2.6.36-rc6","v2.6.35-rc4","v2.6.36-rc8","v2.6.35","v2.6.36-rc7","v2.6.36-rc3","v2.6.36-rc5","v2.6.36-rc4","v2.6.36-rc2","v2.6.36-rc1","v2.6.35-rc5","v2.6.35-rc6","v2.6.34","v2.6.35-rc3","v2.6.35-rc1","v2.6.35-rc2","v2.6.34-rc7","v2.6.34-rc6","v2.6.34-rc5","v2.6.34-rc4","v2.6.34-rc3","v2.6.34-rc2","v2.6.34-rc1","v2.6.33","v2.6.33-rc6","v2.6.33-rc8","v2.6.33-rc4","v2.6.33-rc5","v2.6.33-rc3","v2.6.33-rc7","v2.6.33-rc2","v2.6.32","v2.6.33-rc1","v2.6.32-rc8","v2.6.32-rc7","v2.6.32-rc6","v2.6.31","v2.6.32-rc5","v2.6.32-rc4","v2.6.32-rc2","v2.6.32-rc1","v2.6.32-rc3","v2.6.31-rc9","v2.6.31-rc1","v2.6.31-rc7","v2.6.31-rc8","v2.6.31-rc6","v2.6.30-rc6","v2.6.30","v2.6.31-rc4","v2.6.31-rc5","v2.6.31-rc3","v2.6.31-rc2","v2.6.30-rc7","v2.6.30-rc8","v2.6.30-rc5","v2.6.30-rc3","v2.6.30-rc4","v2.6.30-rc1","v2.6.30-rc2","v2.6.29","v2.6.29-rc8","v2.6.29-rc7","v2.6.29-rc5","v2.6.29-rc1","v2.6.29-rc6","v2.6.29-rc4","v2.6.29-rc3","v2.6.29-rc2","v2.6.28","v2.6.28-rc7","v2.6.28-rc9","v2.6.28-rc8","v2.6.28-rc6","v2.6.28-rc5","v2.6.28-rc4","v2.6.28-rc2","v2.6.28-rc3","v2.6.28-rc1","v2.6.27","v2.6.27-rc7","v2.6.27-rc9","v2.6.27-rc8","v2.6.27-rc5","v2.6.27-rc6","v2.6.27-rc4","v2.6.27-rc1","v2.6.27-rc3","v2.6.27-rc2","v2.6.26","v2.6.26-rc9","v2.6.26-rc8","v2.6.26-rc3","v2.6.26-rc7","v2.6.26-rc6","v2.6.26-rc5","v2.6.26-rc4","v2.6.26-rc2","v2.6.26-rc1","v2.6.25","v2.6.25-rc7","v2.6.25-rc9","v2.6.25-rc8","v2.6.25-rc6","v2.6.25-rc5","v2.6.25-rc3","v2.6.25-rc4","v2.6.24","v2.6.25-rc2","v2.6.25-rc1","v2.6.24-rc8","v2.6.24-rc7","v2.6.24-rc6","v2.6.24-rc5","v2.6.24-rc4","v2.6.24-rc3","v2.6.24-rc2","v2.6.24-rc1","v2.6.23","v2.6.23-rc9","v2.6.23-rc8","v2.6.23-rc5","v2.6.23-rc7","v2.6.23-rc6","v2.6.23-rc4","v2.6.23-rc3","v2.6.23-rc2","v2.6.23-rc1","v2.6.22","v2.6.22-rc7","v2.6.22-rc6","v2.6.22-rc5","v2.6.22-rc4","v2.6.22-rc3","v2.6.22-rc2","v2.6.22-rc1","v2.6.21","v2.6.21-rc7","v2.6.21-rc6","v2.6.21-rc5","v2.6.21-rc4","v2.6.21-rc3","v2.6.21-rc2","v2.6.21-rc1","v2.6.20-rc7","v2.6.20-rc6","v2.6.20-rc5","v2.6.20-rc4","v2.6.20-rc3","v2.6.20-rc1","v2.6.20-rc2","v2.6.19-rc2","v2.6.18","v2.6.19-rc1","v2.6.18-rc6","v2.6.18-rc5","v2.6.18-rc3","v2.6.18-rc2","v2.6.18-rc1","v2.6.17","v2.6.17-rc4","v2.6.17-rc6","v2.6.17-rc5","v2.6.17-rc3","v2.6.17-rc2","v2.6.17-rc1","v2.6.16","v2.6.16-rc6","v2.6.16-rc4","v2.6.16-rc5","v2.6.16-rc3","v2.6.16-rc2","v2.6.16-rc1","v2.6.15-rc7","v2.6.15-rc5","v2.6.15-rc4","v2.6.15-rc2","v2.6.15-rc1","v2.6.14-rc3","v2.6.14-rc2","v2.6.14-rc1","v2.6.13","v2.6.13-rc7","v2.6.13-rc6","v2.6.13-rc5","v2.6.13-rc3","v2.6.13-rc4","v2.6.13-rc2","v2.6.13-rc1","v2.6.12-rc4","v2.6.12-rc3","v2.6.12-rc2"],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-50164.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.19.0"},{"fixed":"6.1.125"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.6.59"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.7.0"},{"fixed":"6.11.6"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-50164.json"}}],"schema_version":"1.7.5"}