Reproducer for ghostlock
cover Reproducer for ghostlock
Test for CVE-2026-43499 (GhostLock), a stack use-after-free in the rtmutex PI code, fixed in kernel v7.1:3bfdc63936dd ("rtmutex: Use waiter::task instead of current in remove_waiter()")
Reproducer based on the Nebula Security writeup and open-sourced PoC
(https://nebusec.ai/research/ionstack-part-2/, https://github.com/NebuSec/CyberMeowfia).
Beware, this test will crash the system on a vulnerable kernel.
Assisted by Kimi K3 for the analysis and written mostly with Gemini Pro 3.1 Max.
---
Andrea Cervesato (2):
lapi/prctl: add more fallback definitions
cve: add CVE-2026-43499 reproducer
configure.ac | 2 + include/lapi/prctl.h | 25 +++++ runtest/cve | 1 + testcases/cve/.gitignore | 1 + testcases/cve/Makefile | 2 +- testcases/cve/ghostlock.c | 252 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 282 insertions(+), 1 deletion(-)
---
base-commit: 6891f922f21a56238d3225c9a83e08f4f7c1765b
change-id: 20260801-cve-ghostlock-6ee4b2f69fd6
Best regards,
Signature · 5 lines
Andrea Cervesato <[email protected]> -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 1/2 lapi/prctl: add more fallback definitions
From: Andrea Cervesato <[email protected]>
Add the following fallback definitions:
- PR_SET_MM
- PR_SET_MM_MAP
- PR_SET_MM_MAP_SIZE
- struct prctl_mm_map
--- configure.ac | 2 ++ include/lapi/prctl.h | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+)
configure.ac +2 -0
@@ -286,6 +286,8 @@ AC_CHECK_TYPES([struct fsxattr],,,[#include <linux/fs.h>]) AC_CHECK_TYPES([struct logical_block_metadata_cap],,,[#include <linux/fs.h>]) +AC_CHECK_TYPES([struct prctl_mm_map],,,[#include <linux/prctl.h>]) + AC_CHECK_TYPES([struct sockaddr_vm],,,[ #include <sys/socket.h> #include <linux/vm_sockets.h>
include/lapi/prctl.h +25 -0
@@ -7,6 +7,7 @@#ifndef LAPI_PRCTL_H__ #define LAPI_PRCTL_H__ +#include <stdint.h> #include <sys/prctl.h> #ifndef PR_SET_NAME
@@ -59,4 +60,28 @@# define PR_SET_SPECULATION_CTRL 53#endif +#ifndef PR_SET_MM +# define PR_SET_MM 35 +#endif +#ifndef PR_SET_MM_MAP +# define PR_SET_MM_MAP 14 +#endif +#ifndef PR_SET_MM_MAP_SIZE +# define PR_SET_MM_MAP_SIZE 15 +#endif + +#ifndef HAVE_STRUCT_PRCTL_MM_MAP +struct prctl_mm_map { +uint64_t start_code, end_code; +uint64_t start_data, end_data; +uint64_t start_brk, brk; +uint64_t start_stack; +uint64_t arg_start, arg_end; +uint64_t env_start, env_end; +uint64_t *auxv; +uint32_t auxv_size; +uint32_t exe_fd; +}; +#endif +#endif /* LAPI_PRCTL_H__ */
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] lapi/prctl: add more fallback definitions
Hi Andrea,
Quoted 1 line · Andrea Cervesato
lapi/prctl: add more fallback definitions
--- [PATCH 2/2] ---
Review
Quoted 7 lines
(quoted diff) +6
-0+ static const int try_sizes[] = { + MAX_AUXV_QWORDS, + MAX_AUXV_QWORDS - 4, + MAX_AUXV_QWORDS - 8 + }; + valid_auxv_size = try_sizes[i] * sizeof(uint64_t);
Could these sizes either use the native word size, or could the test be restricted to the 64-bit architectures on which the reproducer works?
On i386, the smallest attempted size is 320 bytes, but the kernel's saved_auxv is only 56 * sizeof(unsigned long), or 224 bytes. prctl_set_mm_map() therefore rejects all three attempts, and setup reports TBROK. With no supported_archs restriction, the cve runtest entry runs this test on 32-bit x86.
Verdict - Needs revision
---
Note:
The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.
Regards,
LTP AI Reviewer
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] lapi/prctl: add more fallback definitions
In reply to Andrea CervesatoHi!
configure.ac AC_CHECK_TYPES([struct fsxattr],,,[#include <linux/fs.h>]) · line 289
Quoted 13 lines
configure.ac | 2 ++ include/lapi/prctl.h | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+)configure.ac +1
-0@@ -286,6 +286,8 @@ AC_CHECK_TYPES([struct fsxattr],,,[#include <linux/fs.h>]) AC_CHECK_TYPES([struct logical_block_metadata_cap],,,[#include <linux/fs.h>]) +AC_CHECK_TYPES([struct prctl_mm_map],,,[#include <linux/prctl.h>])
^ This must be sys/prctl.h
You are checking linux/prctl.h but include sys/prctl.h in lapi/prctl.h which breaks compilation on all targets in CI.
Signature · 5 lines
Cyril Hrubis [email protected] -- Mailing list info: https://lists.linux.it/listinfo/ltp
Re: [LTP] [PATCH 1/2] lapi/prctl: add more fallback definitions
Hi Cyril,
Quoted 2 lines
You are checking
linux/prctl.hbut includesys/prctl.hinlapi/prctl.hwhich breaks compilation on all targets in CI.
yeah, I sent a new version that will fix it + 32bit run
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 2/2 cve: add CVE-2026-43499 reproducer
In reply to Andrea CervesatoFrom: Andrea Cervesato <[email protected]>
Add "Ghostlock" reproducer for CVE-2026-43499.
Reproducer based on the Nebula Security writeup and open-sourced PoC
(https://nebusec.ai/research/ionstack-part-2/,
https://github.com/NebuSec/CyberMeowfia).
Beware, this test will crash the system on a vulnerable kernel.
--- runtest/cve | 1 + testcases/cve/.gitignore | 1 + testcases/cve/Makefile | 2 +- testcases/cve/ghostlock.c | 252 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 255 insertions(+), 1 deletion(-)
runtest/cve +1 -0
@@ -101,3 +101,4 @@ cve-2026-43494 io_uring04 cve-2026-46300 xfrm02 cve-2026-46300-skb-segment xfrm03 cve-2026-46331 cve-2026-46331 +cve-2026-43499 ghostlock
testcases/cve/.gitignore +1 -0
@@ -16,3 +16,4 @@ tcindex01 cve-2025-38236 cve-2025-21756 cve-2026-46331 +ghostlock
testcases/cve/Makefile +1 -1
@@ -11,7 +11,7 @@ stack_clash: CFLAGS += -fno-optimize-sibling-calls -Wno-infinite-recursion cve-2016-7042: LDLIBS += $(KEYUTILS_LIBS) -cve-2014-0196 cve-2016-7117 cve-2017-2671 cve-2017-17052 cve-2017-17053: CFLAGS += -pthread +cve-2014-0196 cve-2016-7117 cve-2017-2671 cve-2017-17052 cve-2017-17053 ghostlock: CFLAGS += -pthread cve-2014-0196 cve-2016-7117 cve-2017-2671: LDLIBS += -lrt ifneq ($(ANDROID),1)
testcases/cve/ghostlock.c new file +252 -0
252 lines not on this page · raw message
Signature · 5 lines
2.51.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp