summaryrefslogtreecommitdiffstats
path: root/recipes-mac/AppArmor/files/0001-regression-tests-Don-t-build-syscall_sysctl-if-missi.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-mac/AppArmor/files/0001-regression-tests-Don-t-build-syscall_sysctl-if-missi.patch')
-rw-r--r--recipes-mac/AppArmor/files/0001-regression-tests-Don-t-build-syscall_sysctl-if-missi.patch96
1 files changed, 0 insertions, 96 deletions
diff --git a/recipes-mac/AppArmor/files/0001-regression-tests-Don-t-build-syscall_sysctl-if-missi.patch b/recipes-mac/AppArmor/files/0001-regression-tests-Don-t-build-syscall_sysctl-if-missi.patch
deleted file mode 100644
index 3cd1e88..0000000
--- a/recipes-mac/AppArmor/files/0001-regression-tests-Don-t-build-syscall_sysctl-if-missi.patch
+++ /dev/null
@@ -1,96 +0,0 @@
1From 7a7c7fb346ded6f017c8df44486778a5f032d41a Mon Sep 17 00:00:00 2001
2From: John Johansen <john.johansen@canonical.com>
3Date: Tue, 29 Sep 2020 03:05:22 -0700
4Subject: [PATCH] regression tests: Don't build syscall_sysctl if missing
5 kernel headers
6
7sys/sysctl.h is not guaranteed to exist anymore since
8https://sourceware.org/pipermail/glibc-cvs/2020q2/069366.html
9
10which is a follow on to the kernel commit
1161a47c1ad3a4 sysctl: Remove the sysctl system call
12
13While the syscall_sysctl currently checks if the kernel supports
14sysctrs before running the tests. The tests can't even build if the
15kernel headers don't have the sysctl defines.
16
17Fixes: https://gitlab.com/apparmor/apparmor/-/issues/119
18Fixes: https://bugs.launchpad.net/apparmor/+bug/1897288
19MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/637
20Signed-off-by: John Johansen <john.johansen@canonical.com>
21Acked-by: Steve Beattie <steve.beattie@canonical.com>
22(cherry picked from commit 2e5a266eb715fc7e526520235a6450444775791f)
23
24Upstream-Status: Backport
25Signed-off-by: Armin Kuster <akuster808@gmail.com>
26
27---
28 tests/regression/apparmor/Makefile | 10 +++++++++-
29 tests/regression/apparmor/syscall_sysctl.sh | 15 +++++++++++----
30 2 files changed, 20 insertions(+), 5 deletions(-)
31
32diff --git a/tests/regression/apparmor/Makefile b/tests/regression/apparmor/Makefile
33index 198ca421..c3d0cfb7 100644
34--- a/tests/regression/apparmor/Makefile
35+++ b/tests/regression/apparmor/Makefile
36@@ -69,6 +69,9 @@ endif # USE_SYSTEM
37
38 CFLAGS += -g -O0 -Wall -Wstrict-prototypes
39
40+USE_SYSCTL:=$(shell echo "#include <sys/sysctl.h>" | cpp -dM >/dev/null 2>/dev/null && echo true)
41+
42+
43 SRC=access.c \
44 at_secure.c \
45 introspect.c \
46@@ -130,7 +133,6 @@ SRC=access.c \
47 syscall_sethostname.c \
48 syscall_setdomainname.c \
49 syscall_setscheduler.c \
50- syscall_sysctl.c \
51 sysctl_proc.c \
52 tcp.c \
53 transition.c \
54@@ -146,6 +148,12 @@ ifneq (,$(findstring $(shell uname -i),i386 i486 i586 i686 x86 x86_64))
55 SRC+=syscall_ioperm.c syscall_iopl.c
56 endif
57
58+#only do sysctl syscall test if defines installed and OR supported by the
59+# kernel
60+ifeq ($(USE_SYSCTL),true)
61+SRC+=syscall_sysctl.c
62+endif
63+
64 #only do dbus if proper libs are installl
65 ifneq (,$(shell pkg-config --exists dbus-1 && echo TRUE))
66 SRC+=dbus_eavesdrop.c dbus_message.c dbus_service.c dbus_unrequested_reply.c
67diff --git a/tests/regression/apparmor/syscall_sysctl.sh b/tests/regression/apparmor/syscall_sysctl.sh
68index f93946f3..5f856984 100644
69--- a/tests/regression/apparmor/syscall_sysctl.sh
70+++ b/tests/regression/apparmor/syscall_sysctl.sh
71@@ -148,11 +148,18 @@ test_sysctl_proc()
72 # check if the kernel supports CONFIG_SYSCTL_SYSCALL
73 # generally we want to encourage kernels to disable it, but if it's
74 # enabled we want to test against it
75-settest syscall_sysctl
76-if ! res="$(${test} ro 2>&1)" && [ "$res" = "FAIL: sysctl read failed - Function not implemented" ] ; then
77- echo " WARNING: syscall sysctl not implemented, skipping tests ..."
78+# In addition test that sysctl exists in the kernel headers, if it does't
79+# then we can't even built the syscall_sysctl test
80+if echo "#include <sys/sysctl.h>" | cpp -dM >/dev/null 2>/dev/null ; then
81+ settest syscall_sysctl
82+
83+ if ! res="$(${test} ro 2>&1)" && [ "$res" = "FAIL: sysctl read failed - Function not implemented" ] ; then
84+ echo " WARNING: syscall sysctl not implemented, skipping tests ..."
85+ else
86+ test_syscall_sysctl
87+ fi
88 else
89- test_syscall_sysctl
90+ echo " WARNING: syscall sysctl not supported by kernel headers, skipping tests ..."
91 fi
92
93 # now test /proc/sys/ paths
94--
952.17.1
96