CVE-2023-52828: bpf: Detect IP == ksym.end as part of BPF program

Published May 21, 2024
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

bpf: Detect IP == ksym.end as part of BPF program

Now that bpfthrow kfunc is the first such call instruction that has noreturn semantics within the verifier, this also kicks in dead code elimination in unprecedented ways. For one, any instruction following a bpfthrow call will never be marked as seen. Moreover, if a callchain ends up throwing, any instructions after the call instruction to the eventually throwing subprog in callers will also never be marked as seen.

The tempting way to fix this would be to emit extra 'int3' instructions which bump the jitedlen of a program, and ensure that during runtime when a program throws, we can discover its boundaries even if the call instruction to bpfthrow (or to subprogs that always throw) is emitted as the final instruction in the program.

An example of such a program would be this:

dosomething(): ... r0 = 0 exit

foo(): r1 = 0 call bpfthrow r0 = 0 exit

bar(cond): if r1 != 0 goto pc+2 call dosomething exit call foo r0 = 0 // Never seen by verifier exit //

main(ctx): r1 = ... call bar r0 = 0 exit

Here, if we do end up throwing, the stacktrace would be the following:

bpfthrow foo bar main

In bar, the final instruction emitted will be the call to foo, as such, the return address will be the subsequent instruction (which the JIT emits as int3 on x86). This will end up lying outside the jitedlen of the program, thus, when unwinding, we will fail to discover the return address as belonging to any program and end up in a panic due to the unreliable stack unwinding of BPF programs that we never expect.

To remedy this case, make bpfprogksymfind treat IP == ksym.end as part of the BPF program, so that isbpftextaddress returns true when such a case occurs, and we are able to unwind reliably when the final instruction ends up being a call instruction.

Affected Software

6 affected components
Linux Kernel
Linux Linux kernel<5.10.202
Linux Linux kernel>=5.11<5.15.140
Linux Linux kernel>=5.16<6.1.64
Linux Linux kernel>=6.2<6.5.13
Linux Linux kernel>=6.6<6.6.3

Event History

May 21, 2024
CVE Published
via MITRE·03:31 PM
Data Sourced
via MITRE·03:31 PM
Description
Data Sourced
via NVD·04:15 PM
RemedyDescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2023-52828?

CVE-2023-52828 has been classified with a medium severity risk in the Linux kernel.

2

How do I fix CVE-2023-52828?

To fix CVE-2023-52828, update to the latest patched version of the Linux kernel that addresses this vulnerability.

3

What impact does CVE-2023-52828 have?

CVE-2023-52828 can potentially allow a local attacker to exploit BPF programs leading to unauthorized actions within the kernel.

4

Which versions of the Linux kernel are affected by CVE-2023-52828?

CVE-2023-52828 affects certain versions of the Linux kernel prior to the implementation of the fix.

5

Is CVE-2023-52828 publicly known?

Yes, CVE-2023-52828 has been publicly disclosed and documented in the CVE database.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203