summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/libcap/files/CVE-2023-2602.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/libcap/files/CVE-2023-2602.patch')
-rw-r--r--meta/recipes-support/libcap/files/CVE-2023-2602.patch52
1 files changed, 52 insertions, 0 deletions
diff --git a/meta/recipes-support/libcap/files/CVE-2023-2602.patch b/meta/recipes-support/libcap/files/CVE-2023-2602.patch
new file mode 100644
index 0000000000..ca04d7297a
--- /dev/null
+++ b/meta/recipes-support/libcap/files/CVE-2023-2602.patch
@@ -0,0 +1,52 @@
1Backport of:
2
3From bc6b36682f188020ee4770fae1d41bde5b2c97bb Mon Sep 17 00:00:00 2001
4From: "Andrew G. Morgan" <morgan@kernel.org>
5Date: Wed, 3 May 2023 19:18:36 -0700
6Subject: Correct the check of pthread_create()'s return value.
7
8This function returns a positive number (errno) on error, so the code
9wasn't previously freeing some memory in this situation.
10
11Discussion:
12
13 https://stackoverflow.com/a/3581020/14760867
14
15Credit for finding this bug in libpsx goes to David Gstir of
16X41 D-Sec GmbH (https://x41-dsec.de/) who performed a security
17audit of the libcap source code in April of 2023. The audit
18was sponsored by the Open Source Technology Improvement Fund
19(https://ostif.org/).
20
21Audit ref: LCAP-CR-23-01 (CVE-2023-2602)
22
23Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
24
25Upstream-Status: Backport [import from ubuntu https://git.launchpad.net/ubuntu/+source/libcap2/tree/debian/patches/CVE-2023-2602.patch?h=ubuntu/focal-security
26Upstream commit https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=bc6b36682f188020ee4770fae1d41bde5b2c97bb]
27CVE: CVE-2023-2602
28Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
29---
30 psx/psx.c | 2 +-
31 1 file changed, 1 insertion(+), 1 deletion(-)
32
33--- a/libcap/psx.c
34+++ b/libcap/psx.c
35@@ -272,7 +272,7 @@ int psx_pthread_create(pthread_t *thread
36
37 psx_wait_for_idle();
38 int ret = pthread_create(thread, attr, start_routine, arg);
39- if (ret != -1) {
40+ if (ret == 0) {
41 psx_do_registration(*thread);
42 }
43 psx_resume_idle();
44@@ -287,7 +287,7 @@ int __wrap_pthread_create(pthread_t *thr
45 void *(*start_routine) (void *), void *arg) {
46 psx_wait_for_idle();
47 int ret = __real_pthread_create(thread, attr, start_routine, arg);
48- if (ret != -1) {
49+ if (ret == 0) {
50 psx_do_registration(*thread);
51 }
52 psx_resume_idle();