CVE-2021-47081·Kernel vulnerability
In the Linux kernel, the following vulnerability has been resolved: habanalabs/gaudi: Fix a potential use after free in gaudi_memset_device_memory Our code analyzer reported a uaf. In gaudi_memset_device_memory, cb is get via hl_cb_kernel_create() with 2 refcount. If hl_cs_allocate_job() failed, the execution runs into release_cb branch. One ref of cb is dropped by hl_cb_put(cb) and could be freed if other thread also drops one ref. Then cb is used by cb->id later, which is a potential uaf. My patch add a variable 'id' to accept the value of cb->id before the hl_cb_put(cb) is called, to avoid the potential uaf.
- Severity
- high
- Software
- Kernel
- Fixed in
- 5.12.7
- Published
- 2024-03-01
Affected versions
From: 5.12
Until: 5.12.7
Fixed in: 5.12.7
How to fix this CVE
Update your Linux kernel to version 5.12.7 or later to resolve a use-after-free vulnerability in the Habana Labs GPU driver's memory initialization routine. This flaw could allow a local privileged attacker to cause memory corruption or system instability. Ensure kernel patches are applied through your distribution's standard update mechanism.
sudo dnf update kernel kernel-devel kernel-headersDefensia detects this vulnerability
How to check if you are affected
- Check current kernel version: uname -r | grep -E '^5\.12\.[0-6]($|[^0-9])'
- Verify Habana Labs driver presence: lsmod | grep -i habana or find /lib/modules/$(uname -r) -name '*habana*'
- Search kernel logs for gaudi_memset_device_memory errors: dmesg | grep -i 'gaudi\|memset' or journalctl -k | grep -i gaudi
- Confirm kernel update applied: uname -r should show 5.12.7 or higher, and verify with: cat /proc/version
FAQ
What is CVE-2021-47081?
This vulnerability is a use-after-free flaw in the Habana Labs Gaudi accelerator driver's memory initialization function. A reference count mismatch could cause a control block object to be freed while still in use, leading to memory corruption when accessed.
Is CVE-2021-47081 being actively exploited?
No, there is no evidence of active exploitation in the wild or public exploits available. However, the high CVSS score (7.8) indicates it poses a significant risk if exploited locally.
What versions of Kernel are affected by CVE-2021-47081?
Linux kernel versions 5.12 through 5.12.6 are affected. The vulnerability is fixed in kernel 5.12.7 and later versions.
How do I check if my server is vulnerable to CVE-2021-47081?
Run 'uname -r' and check if the output matches 5.12.0 through 5.12.6. If Habana Labs hardware is present (lsmod | grep habana), your system is at risk.
Does Defensia detect CVE-2021-47081?
Yes — Defensia's CVE advisory scanner compares installed package versions against the NVD database. If Linux kernel is installed on a monitored server, CVE-2021-47081 will appear in your dashboard with remediation steps.
Related Kernel CVEs
References
Track CVEs across your fleet automatically
Defensia scans your Linux servers and tells you exactly which ones are running vulnerable versions — including CVE-2021-47081. Free for 1 server.
Get started free