CVE-2022-50778
Buffer Overflow in Linux Kernel hidinput_allocate() Causes Panic
Publication date: 2025-12-24
Last updated on: 2025-12-24
Assigner: kernel.org
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| linux | kernel | * |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-UNKNOWN |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability occurs in the Linux kernel when both CONFIG_FORTIFY and CONFIG_UBSAN_LOCAL_BOUNDS are enabled. It involves the __compiletime_strlen() function, which uses __builtin_object_size() to check string lengths at compile time. However, for strings whose values depend on runtime control flow, __builtin_object_size() returns the maximum possible size, causing __compiletime_strlen() to access memory beyond the actual string length at runtime. This leads to a runtime panic during certain Android Compatibility Test Suite tests, specifically in the hidinput_allocate() function where a local string's length is miscalculated due to control flow dependency.
How can this vulnerability impact me? :
This vulnerability can cause a runtime panic (crash) in the Linux kernel when running specific tests or potentially in other scenarios where the affected code path is executed. This can lead to system instability or denial of service due to the kernel fault triggered by out-of-bounds memory access in the __compiletime_strlen() function.
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, ensure that your Linux kernel is updated to a version where the fix for __compiletime_strlen() under UBSAN_BOUNDS_LOCAL is applied. Specifically, the fix involves cleaning up the hidinput_allocate() function to avoid runtime calls to strlen() on control-flow-dependent local strings and adding a __builtin_constant_p() check in the macro to prevent faults. Enabling CONFIG_FORTIFY=y and CONFIG_UBSAN_LOCAL_BOUNDS=y with the patched kernel will prevent the runtime panic.