summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/attr/acl
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/attr/acl')
-rw-r--r--meta/recipes-support/attr/acl/0001-libmisc-__acl_get_uid-fix-memory-wasting-loop-if-use.patch49
-rw-r--r--meta/recipes-support/attr/acl/0001-test-misc.test-Don-t-mix-stdout-and-stderr.patch35
-rw-r--r--meta/recipes-support/attr/acl/0001-test-patch-out-failing-bits.patch60
-rw-r--r--meta/recipes-support/attr/acl/0001-tests-do-not-hardcode-the-build-path-into-a-helper-l.patch24
-rw-r--r--meta/recipes-support/attr/acl/run-ptest37
5 files changed, 110 insertions, 95 deletions
diff --git a/meta/recipes-support/attr/acl/0001-libmisc-__acl_get_uid-fix-memory-wasting-loop-if-use.patch b/meta/recipes-support/attr/acl/0001-libmisc-__acl_get_uid-fix-memory-wasting-loop-if-use.patch
new file mode 100644
index 0000000000..5052bdaa2f
--- /dev/null
+++ b/meta/recipes-support/attr/acl/0001-libmisc-__acl_get_uid-fix-memory-wasting-loop-if-use.patch
@@ -0,0 +1,49 @@
1From 56abe432b65801f31277fb9a3bca0f9e31502315 Mon Sep 17 00:00:00 2001
2From: Matthias Gerstner <matthias.gerstner@suse.de>
3Date: Thu, 25 Apr 2024 12:43:49 +0200
4Subject: [PATCH] libmisc: __acl_get_uid(): fix memory wasting loop if user
5 does not exist
6
7I noticed that `acl_from_text()` unexpectedly returns ENOMEM for invalid
8user names. The reason for this is a missing break statement in the for
9loop in `__acl_get_uid()`, which causes the loop to act as if ERANGE was
10returned from `getpwnam_r()`, thereby exponentially increasing the
11buffer size to (in my case) multiple gigabytes, until `grow_buffer()`
12reports ENOMEM, which terminates the `__acl_get_uid()` function.
13
14This is a pretty costly "no such user" lookup that can disturb a
15process's heap memory management, but can also cause a process to fail
16e.g. if it is multithreaded and other threads encounter an ENOMEM,
17before `__acl_get_uid()` frees the gigantic heap buffer and returns.
18The allocated memory isn't actually used. Therefore on Linux it should
19not affect other processes by default, due to its overcommit memory
20and lazy memory allocation strategy.
21
22Fix this by properly terminating the for loop on any conditions except
23an ERANGE error being reported. The same break statement correctly
24exists in `__acl_get_gid()` already.
25
26Fixes: 3737f00 ("use thread-safe getpwnam_r and getgrnam_r")
27Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
28
29Upstream-Status: Backport
30Signed-off-by: Ross Burton <ross.burton@arm.com>
31---
32 libmisc/uid_gid_lookup.c | 1 +
33 1 file changed, 1 insertion(+)
34
35diff --git a/libmisc/uid_gid_lookup.c b/libmisc/uid_gid_lookup.c
36index a4f21f6..74baab4 100644
37--- a/libmisc/uid_gid_lookup.c
38+++ b/libmisc/uid_gid_lookup.c
39@@ -91,6 +91,7 @@ __acl_get_uid(const char *token, uid_t *uid_p)
40 if (err == ERANGE)
41 continue;
42 errno = err ? err : EINVAL;
43+ break;
44 }
45 free(buffer);
46 return result ? 0 : -1;
47--
482.43.0
49
diff --git a/meta/recipes-support/attr/acl/0001-test-misc.test-Don-t-mix-stdout-and-stderr.patch b/meta/recipes-support/attr/acl/0001-test-misc.test-Don-t-mix-stdout-and-stderr.patch
new file mode 100644
index 0000000000..5aa3f3224c
--- /dev/null
+++ b/meta/recipes-support/attr/acl/0001-test-misc.test-Don-t-mix-stdout-and-stderr.patch
@@ -0,0 +1,35 @@
1From 47f8039ec9bd08b629775c8e788d11e41fa95f14 Mon Sep 17 00:00:00 2001
2From: Andreas Gruenbacher <agruenba@redhat.com>
3Date: Mon, 24 Mar 2025 21:14:09 +0100
4Subject: [PATCH] test/misc.test: Don't mix stdout and stderr
5
6In different environments, we may not get the stdout and stderr output
7in the order the run script expects, so check both separately.
8
9Fixes: https://savannah.nongnu.org/bugs/?66944
10Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
11
12Upstream-Status: Backport
13Signed-off-by: Ross Burton <ross.burton@arm.com>
14---
15 test/misc.test | 3 ++-
16 1 file changed, 2 insertions(+), 1 deletion(-)
17
18diff --git a/test/misc.test b/test/misc.test
19index 06b3136..57c02e5 100644
20--- a/test/misc.test
21+++ b/test/misc.test
22@@ -440,8 +440,9 @@ Dangling symlink test https://savannah.nongnu.org/bugs/?28131
23 > other::r-x
24 >
25 $ setfacl -R -m u:bin:rw d
26- $ getfacl -RL d
27+ $ getfacl -RL d > /dev/null
28 > getfacl: d/b: No such file or directory
29+ $ getfacl -RL d 2> /dev/null
30 > # file: d
31 > # owner: %TUSER
32 > # group: %TGROUP
33--
342.43.0
35
diff --git a/meta/recipes-support/attr/acl/0001-test-patch-out-failing-bits.patch b/meta/recipes-support/attr/acl/0001-test-patch-out-failing-bits.patch
deleted file mode 100644
index 219feaccd0..0000000000
--- a/meta/recipes-support/attr/acl/0001-test-patch-out-failing-bits.patch
+++ /dev/null
@@ -1,60 +0,0 @@
1From 7dec6fa3b3494a55120402ff1ea3eb96b67138e8 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Thu, 12 Dec 2019 15:47:49 +0100
4Subject: [PATCH] test: patch out failing bits
5
6I have confirmed on the host distro (Ubuntu 18.04) that they
7fail as well; upstream probably haven't noticed because the
8test is only executed under sudo.
9
10Upstream-Status: Inappropriate [disabling tests instead of fixing them properly]
11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12---
13 test/root/permissions.test | 13 -------------
14 1 file changed, 13 deletions(-)
15
16diff --git a/test/root/permissions.test b/test/root/permissions.test
17index 8f8f825..21e8a95 100644
18--- a/test/root/permissions.test
19+++ b/test/root/permissions.test
20@@ -50,10 +50,6 @@ User daemon is a member in the owning group, which has only read access.
21 Verify this.
22
23 $ su daemon
24- $ cat f
25- > root
26- > bin
27-
28 $ echo daemon >> f
29 >~ .*f: Permission denied$
30
31@@ -146,8 +142,6 @@ the owning group, he should still have no write access.
32 $ setfacl -x g:daemon f
33
34 $ su daemon
35- $ echo daemon4 >> f
36- >~ .*f: Permission denied$
37
38
39 Change the owning group. The other permissions should now grant user
40@@ -158,12 +152,6 @@ daemon write access.
41
42 $ su daemon
43 $ echo daemon5 >> f
44- $ cat f
45- > root
46- > bin
47- > daemon
48- > daemon2
49- > daemon5
50
51
52 Verify that permissions in separate matching ACL entries do not
53@@ -173,7 +161,6 @@ accumulate.
54 $ setfacl -m g:bin:r,g:daemon:w f
55
56 $ su daemon
57- $ : < f
58 $ : > f
59 $ : <> f
60 >~ .*f: Permission denied$
diff --git a/meta/recipes-support/attr/acl/0001-tests-do-not-hardcode-the-build-path-into-a-helper-l.patch b/meta/recipes-support/attr/acl/0001-tests-do-not-hardcode-the-build-path-into-a-helper-l.patch
deleted file mode 100644
index 748f37f3e7..0000000000
--- a/meta/recipes-support/attr/acl/0001-tests-do-not-hardcode-the-build-path-into-a-helper-l.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1From 42ae3f8a5e32ba0681ccd1552a203ddad8748a6e Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Thu, 12 Dec 2019 13:45:52 +0100
4Subject: [PATCH] tests: do not hardcode the build path into a helper library
5
6Upstream-Status: Inappropriate [oe-core specific]
7Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
8---
9 test/Makemodule.am | 2 +-
10 1 file changed, 1 insertion(+), 1 deletion(-)
11
12diff --git a/test/Makemodule.am b/test/Makemodule.am
13index e1d715d..cffe732 100644
14--- a/test/Makemodule.am
15+++ b/test/Makemodule.am
16@@ -30,7 +30,7 @@ EXTRA_DIST += \
17 check_LTLIBRARIES = libtestlookup.la
18
19 libtestlookup_la_SOURCES = test/test_passwd.c test/test_group.c
20-libtestlookup_la_CFLAGS = -DBASEDIR=\"$(abs_srcdir)\"
21+libtestlookup_la_CFLAGS = -DBASEDIR=\"/tmp/acl-ptest\"
22 libtestlookup_la_LDFLAGS = -rpath $(abs_builddir)
23
24 # Make sure translations don't break tests when matching output.
diff --git a/meta/recipes-support/attr/acl/run-ptest b/meta/recipes-support/attr/acl/run-ptest
index 3af75c84fe..f28d8c1212 100644
--- a/meta/recipes-support/attr/acl/run-ptest
+++ b/meta/recipes-support/attr/acl/run-ptest
@@ -1,16 +1,31 @@
1#!/bin/sh 1#!/bin/sh
2#
3#This script is used to run acl test suites
4 2
5#umask 077 3failed=0
4all=0
6 5
7mkdir -p /tmp/acl-ptest/test
8cp test/test.* /tmp/acl-ptest/test
9 6
10set +e 7for f in *.test; do
11make test-suite.log 8 LD_PRELOAD=$(pwd)/libtestlookup.so ./run $f
12exitcode=$? 9 case "$?" in
13if [ $exitcode -ne 0 -a -e test-suite.log ]; then 10 0)
14 cat test-suite.log 11 echo "PASS: $f"
12 all=$((all + 1))
13 ;;
14 77)
15 echo "SKIP: $f"
16 ;;
17 *)
18 echo "FAIL: $f"
19 failed=$((failed + 1))
20 all=$((all + 1))
21 ;;
22 esac
23done
24
25if [ "$failed" -eq 0 ] ; then
26 echo "All $all tests passed"
27 exit 0
28else
29 echo "$failed of $all tests failed"
30 exit 1
15fi 31fi
16exit $exitcode