# CVE-2021-47128: bpf, lockdown, audit: Fix buggy SELinux lockdown permission checks

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: None; Integrity impact: None; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.18% (percentile 4, 2026-11-26)
- **CWE:** CWE-667
- **Published:** 2024-03-15T20:14:32.366Z
- **Modified:** 2026-06-17T04:16:35.660Z

## Who should check

- Anyone running Linux \>= 59438b46471ae6cdfb761afc8c9beaf1e428a331, \< ff5039ec75c83d2ed5b781dc7733420ee8c985fc; \>= 59438b46471ae6cdfb761afc8c9beaf1e428a331, \< acc43fc6cf0d50612193813c5906a1ab9d433e1e; \>= 59438b46471ae6cdfb761afc8c9beaf1e428a331, \< ff40e51043af63715ab413995ff46996ecf9583f
- Anyone running Linux 5.6

## Description

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

bpf, lockdown, audit: Fix buggy SELinux lockdown permission checks

Commit 59438b46471a ("security,lockdown,selinux: implement SELinux lockdown")
added an implementation of the locked\_down LSM hook to SELinux, with the aim
to restrict which domains are allowed to perform operations that would breach
lockdown. This is indirectly also getting audit subsystem involved to report
events. The latter is problematic, as reported by Ondrej and Serhei, since it
can bring down the whole system via audit:

  1) The audit events that are triggered due to calls to security\_locked\_down()
     can OOM kill a machine, see below details \[0\].

  2) It also seems to be causing a deadlock via avc\_has\_perm()/slow\_avc\_audit()
     when trying to wake up kauditd, for example, when using trace\_sched\_switch()
     tracepoint, see details in \[1\]. Triggering this was not via some hypothetical
     corner case, but with existing tools like runqlat & runqslower from bcc, for
     example, which make use of this tracepoint. Rough call sequence goes like:

     rq\_lock(rq) -\> -------------------------+
       trace\_sched\_switch() -\>               \|
         bpf\_prog\_xyz() -\>                   +-\> deadlock
           selinux\_lockdown() -\>             \|
             audit\_log\_end() -\>              \|
               wake\_up\_interruptible() -\>    \|
                 try\_to\_wake\_up() -\>         \|
                   rq\_lock(rq) --------------+

What's worse is that the intention of 59438b46471a to further restrict lockdown
settings for specific applications in respect to the global lockdown policy is
completely broken for BPF. The SELinux policy rule for the current lockdown check
looks something like this:

  allow \<who\> \<who\> : lockdown { \<reason\> };

However, this doesn't match with the 'current' task where the security\_locked\_down()
is executed, example: httpd does a syscall. There is a tracing program attached
to the syscall which triggers a BPF program to run, which ends up doing a
bpf\_probe\_read\_kernel{,\_str}() helper call. The selinux\_lockdown() hook does
the permission check against 'current', that is, httpd in this example. httpd
has literally zero relation to this tracing program, and it would be nonsensical
having to write an SELinux policy rule against httpd to let the tracing helper
pass. The policy in this case needs to be against the entity that is installing
the BPF program. For example, if bpftrace would generate a histogram of syscall
counts by user space application:

  bpftrace -e 'tracepoint:raw\_syscalls:sys\_enter { @\[comm\] = count(); }'

bpftrace would then go and generate a BPF program from this internally. One way
of doing it \[for the sake of the example\] could be to call bpf\_get\_current\_task()
helper and then access current-\>comm via one of bpf\_probe\_read\_kernel{,\_str}()
helpers. So the program itself has nothing to do with httpd or any other random
app doing a syscall here. The BPF program \_explicitly initiated\_ the lockdown
check. The allow/deny policy belongs in the context of bpftrace: meaning, you
want to grant bpftrace access to use these helpers, but other tracers on the
system like my\_random\_tracer \_not\_.

Therefore fix all three issues at the same time by taking a completely different
approach for the security\_locked\_down() hook, that is, move the check into the
program verification phase where we actually retrieve the BPF func proto. This
also reliably gets the task (current) that is trying to install the BPF tracing
program, e.g. bpftrace/bcc/perf/systemtap/etc, and it also fixes the OOM since
we're moving this out of the BPF helper's fast-path which can be called several
millions of times per second.

The check is then also in line with other security\_locked\_down() hooks in the
system where the enforcement is performed at open/load time, for example,
open\_kcore() for /proc/kcore access or module\_sig\_check() for module signatures
just to pick f
---truncated---

## Affected and fixed versions

- Linux: \>= 59438b46471ae6cdfb761afc8c9beaf1e428a331, \< ff5039ec75c83d2ed5b781dc7733420ee8c985fc; \>= 59438b46471ae6cdfb761afc8c9beaf1e428a331, \< acc43fc6cf0d50612193813c5906a1ab9d433e1e; \>= 59438b46471ae6cdfb761afc8c9beaf1e428a331, \< ff40e51043af63715ab413995ff46996ecf9583f (cvelist)
- Linux: 5.6 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2021-47128. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-47128.md
Affected: Linux >= 59438b46471ae6cdfb761afc8c9beaf1e428a331, < ff5039ec75c83d2ed5b781dc7733420ee8c985fc; >= 59438b46471ae6cdfb761afc8c9beaf1e428a331, < acc43fc6cf0d50612193813c5906a1ab9d433e1e; >= 59438b46471ae6cdfb761afc8c9beaf1e428a331, < ff40e51043af63715ab413995ff46996ecf9583f; Linux 5.6
Fixed in: no fixed version listed yet

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2021-47128 being exploited?

There is no confirmed exploitation: CVE-2021-47128 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.18% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2021-47128?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2021-47128?

Linux \>= 59438b46471ae6cdfb761afc8c9beaf1e428a331, \< ff5039ec75c83d2ed5b781dc7733420ee8c985fc; \>= 59438b46471ae6cdfb761afc8c9beaf1e428a331, \< acc43fc6cf0d50612193813c5906a1ab9d433e1e; \>= 59438b46471ae6cdfb761afc8c9beaf1e428a331, \< ff40e51043af63715ab413995ff46996ecf9583f; Linux 5.6.

### Is there a fix for CVE-2021-47128?

No fixed version is listed in the sources yet. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2021-47128?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/ff5039ec75c83d2ed5b781dc7733420ee8c985fc>
- patch: <https://git.kernel.org/stable/c/acc43fc6cf0d50612193813c5906a1ab9d433e1e>
- patch: <https://git.kernel.org/stable/c/ff40e51043af63715ab413995ff46996ecf9583f>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2021-47128>

HTML: <https://flawdb.com/CVE-2021-47128> · JSON: <https://flawdb.com/api/v1/entries/CVE-2021-47128>
