new file mode 100644
@@ -0,0 +1,47 @@
+From a51273125b90157de70ae2615a91f82c1775615b Mon Sep 17 00:00:00 2001
+From: Kris Gavvala <kris.gavvala@windriver.com>
+Date: Fri, 12 Jun 2026 14:55:11 -0700
+Subject: [PATCH] libcap: fix hang in libcap_psx_test
+
+When running libcap_psx_test on some non-x86-64 targets, a hang occurs.
+In thread_fork_exit(), the forked child calls exit(0), which invokes exit
+handlers and blocks waiting for an internal lock.
+
+Use of exit() is unsafe in a forked child of a multithreaded process because
+of the internal handlers that can causing blocking.
+
+This commit replaces exit() with _exit() in the child to bypass
+exit handling and prevent a deadlock from occuring.
+
+Signed-off-by: Kris Gavvala <kris.gavvala@windriver.com>
+Upstream-Status: Submitted [morgan@kernel.org]
+Upstream tracking: [https://github.com/AndrewGMorgan/libcap_mirror/issues/12#issue-4652587116]
+
+---
+ tests/libcap_psx_test.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/tests/libcap_psx_test.c b/tests/libcap_psx_test.c
+index 58a13ec..693aeb5 100644
+--- a/tests/libcap_psx_test.c
++++ b/tests/libcap_psx_test.c
+@@ -24,13 +24,13 @@ static void *thread_fork_exit(void *data) {
+ if (pid == 0) {
+ if (cap_prctlw(PR_SET_KEEPCAPS, !start, 0, 0, 0, 0) != 0) {
+ perror("failed to set proc");
+- exit(1);
++ _exit(1);
+ }
+ if (cap_prctlw(PR_GET_KEEPCAPS, 0, 0, 0, 0, 0) == start) {
+ perror("failed to have set forked proc");
+- exit(1);
++ _exit(1);
+ }
+- exit(0);
++ _exit(0);
+ }
+ int res;
+ if (waitpid(pid, &res, 0) != pid || res != 0) {
+--
+2.49.0
+
@@ -18,6 +18,7 @@ SRC_URI:append:class-nativesdk = " \
"
SRC_URI:append = " \
file://run-ptest \
+ file://0001-libcap-fix-hang-in-libcap_psx_test.patch \
"
SRC_URI[sha256sum] = "0d621e562fd932ccf67b9660fb018e468a683d7b827541df27813228c996bb11"
This adresses a bug in libcap_psx_test, one of the ptests. libcap_psx_test checks that capability state remains consistent when concurrent changes to process capability state are made across multiple threads that each perform a fork(). libcap_psx_test outputs that it passed, but leaves a child process in an S state after executing. A fix was found by changing the exit() in a child process to _exit, avoiding the exit handlers that were causing the deadlock. Signed-off-by: Kris Gavvala <kris.gavvala@windriver.com> --- ...1-libcap-fix-hang-in-libcap_psx_test.patch | 47 +++++++++++++++++++ meta/recipes-support/libcap/libcap_2.78.bb | 1 + 2 files changed, 48 insertions(+) create mode 100644 meta/recipes-support/libcap/files/0001-libcap-fix-hang-in-libcap_psx_test.patch