{"id":"CVE-2024-42161","state":"PUBLISHED","title":"bpf: Avoid uninitialized value in BPF_CORE_READ_BITFIELD","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Avoid uninitialized value in BPF_CORE_READ_BITFIELD\n\n[Changes from V1:\n - Use a default branch in the switch statement to initialize `val'.]\n\nGCC warns that `val' may be used uninitialized in the\nBPF_CRE_READ_BITFIELD macro, defined in bpf_core_read.h as:\n\n\t[...]\n\tunsigned long long val;\t\t\t\t\t\t      \\\n\t[...]\t\t\t\t\t\t\t\t      \\\n\tswitch (__CORE_RELO(s, field, BYTE_SIZE)) {\t\t\t      \\\n\tcase 1: val = *(const unsigned char *)p; break;\t\t\t      \\\n\tcase 2: val = *(const unsigned short *)p; break;\t\t      \\\n\tcase 4: val = *(const unsigned int *)p; break;\t\t\t      \\\n\tcase 8: val = *(const unsigned long long *)p; break;\t\t      \\\n        }       \t\t\t\t\t\t\t      \\\n\t[...]\n\tval;\t\t\t\t\t\t\t\t      \\\n\t}\t\t\t\t\t\t\t\t      \\\n\nThis patch adds a default entry in the switch statement that sets\n`val' to zero in order to avoid the warning, and random values to be\nused in case __builtin_preserve_field_info returns unexpected values\nfor BPF_FIELD_BYTE_SIZE.\n\nTested in bpf-next master.\nNo regressions.","publishedAt":"2024-07-30T07:47:03.136Z","updatedAt":"2026-05-11T20:28:10.007Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"b694989bb13ed5f166e633faa1eb0f21c6d261a6","versionType":"git"},{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"3364c2ed1c241989847f19cf83e3db903ce689e3","versionType":"git"},{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"a21d76bd0b0d39518e9a4c19f6cf7c042a974aff","versionType":"git"},{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"7e5471b5efebc30dd0bc035cda86693a5c73d45f","versionType":"git"},{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"ff941a8449e712eaf7efca1a13bfb9afd3d99fc2","versionType":"git"},{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"009367099eb61a4fc2af44d4eb06b6b4de7de6db","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["tools/lib/bpf/bpf_core_read.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.5","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.5","versionType":"semver"},{"version":"5.10.222","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.163","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.98","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.39","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.9.9","status":"unaffected","lessThanOrEqual":"6.9.*","versionType":"semver"},{"version":"6.10","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["tools/lib/bpf/bpf_core_read.h"]}],"references":["https://git.kernel.org/stable/c/b694989bb13ed5f166e633faa1eb0f21c6d261a6","https://git.kernel.org/stable/c/3364c2ed1c241989847f19cf83e3db903ce689e3","https://git.kernel.org/stable/c/a21d76bd0b0d39518e9a4c19f6cf7c042a974aff","https://git.kernel.org/stable/c/7e5471b5efebc30dd0bc035cda86693a5c73d45f","https://git.kernel.org/stable/c/ff941a8449e712eaf7efca1a13bfb9afd3d99fc2","https://git.kernel.org/stable/c/009367099eb61a4fc2af44d4eb06b6b4de7de6db","https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html"],"weaknesses":[],"ingestedAt":"2026-10-29T20:07:47.831Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2024/42xxx/CVE-2024-42161.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-42161","state":"PUBLISHED","datePublished":"2024-07-30T07:47:03.136Z","dateUpdated":"2026-05-11T20:28:10.007Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-07-29T15:50:41.196Z"},"containers":{"cna":{"title":"bpf: Avoid uninitialized value in BPF_CORE_READ_BITFIELD","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Avoid uninitialized value in BPF_CORE_READ_BITFIELD\n\n[Changes from V1:\n - Use a default branch in the switch statement to initialize `val'.]\n\nGCC warns that `val' may be used uninitialized in the\nBPF_CRE_READ_BITFIELD macro, defined in bpf_core_read.h as:\n\n\t[...]\n\tunsigned long long val;\t\t\t\t\t\t      \\\n\t[...]\t\t\t\t\t\t\t\t      \\\n\tswitch (__CORE_RELO(s, field, BYTE_SIZE)) {\t\t\t      \\\n\tcase 1: val = *(const unsigned char *)p; break;\t\t\t      \\\n\tcase 2: val = *(const unsigned short *)p; break;\t\t      \\\n\tcase 4: val = *(const unsigned int *)p; break;\t\t\t      \\\n\tcase 8: val = *(const unsigned long long *)p; break;\t\t      \\\n        }       \t\t\t\t\t\t\t      \\\n\t[...]\n\tval;\t\t\t\t\t\t\t\t      \\\n\t}\t\t\t\t\t\t\t\t      \\\n\nThis patch adds a default entry in the switch statement that sets\n`val' to zero in order to avoid the warning, and random values to be\nused in case __builtin_preserve_field_info returns unexpected values\nfor BPF_FIELD_BYTE_SIZE.\n\nTested in bpf-next master.\nNo regressions."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"b694989bb13ed5f166e633faa1eb0f21c6d261a6","versionType":"git"},{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"3364c2ed1c241989847f19cf83e3db903ce689e3","versionType":"git"},{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"a21d76bd0b0d39518e9a4c19f6cf7c042a974aff","versionType":"git"},{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"7e5471b5efebc30dd0bc035cda86693a5c73d45f","versionType":"git"},{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"ff941a8449e712eaf7efca1a13bfb9afd3d99fc2","versionType":"git"},{"version":"ee26dade0e3bcd8a34ae7520e373fb69365fce7a","status":"affected","lessThan":"009367099eb61a4fc2af44d4eb06b6b4de7de6db","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["tools/lib/bpf/bpf_core_read.h"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.5","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.5","versionType":"semver"},{"version":"5.10.222","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.163","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.98","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.39","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.9.9","status":"unaffected","lessThanOrEqual":"6.9.*","versionType":"semver"},{"version":"6.10","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["tools/lib/bpf/bpf_core_read.h"]}],"references":[{"url":"https://git.kernel.org/stable/c/b694989bb13ed5f166e633faa1eb0f21c6d261a6"},{"url":"https://git.kernel.org/stable/c/3364c2ed1c241989847f19cf83e3db903ce689e3"},{"url":"https://git.kernel.org/stable/c/a21d76bd0b0d39518e9a4c19f6cf7c042a974aff"},{"url":"https://git.kernel.org/stable/c/7e5471b5efebc30dd0bc035cda86693a5c73d45f"},{"url":"https://git.kernel.org/stable/c/ff941a8449e712eaf7efca1a13bfb9afd3d99fc2"},{"url":"https://git.kernel.org/stable/c/009367099eb61a4fc2af44d4eb06b6b4de7de6db"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-05-11T20:28:10.007Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"5.10.222"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"5.15.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"6.1.98"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"6.6.39"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"6.9.9"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.5","versionEndExcluding":"6.10"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://git.kernel.org/stable/c/b694989bb13ed5f166e633faa1eb0f21c6d261a6","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/3364c2ed1c241989847f19cf83e3db903ce689e3","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/a21d76bd0b0d39518e9a4c19f6cf7c042a974aff","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/7e5471b5efebc30dd0bc035cda86693a5c73d45f","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/ff941a8449e712eaf7efca1a13bfb9afd3d99fc2","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/009367099eb61a4fc2af44d4eb06b6b4de7de6db","tags":["x_transferred"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html"}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2025-11-03T22:02:24.334Z"}},{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2024-42161","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2024-09-10T16:14:52.496894Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2024-09-11T17:34:33.542Z"}}]}}}