diff options
author | Armin Kuster <akuster808@gmail.com> | 2020-10-03 09:35:38 -0700 |
---|---|---|
committer | Armin Kuster <akuster@mvista.com> | 2020-10-09 07:02:01 -0700 |
commit | b8c437bf701a5b575e996716eb64f938d99e8b08 (patch) | |
tree | f48b41cb3fa888a6f36f605ac8955b40312ed9f3 | |
parent | 21489a2942be16c2c838b8d70a4871cb8bc265dd (diff) | |
download | meta-security-b8c437bf701a5b575e996716eb64f938d99e8b08.tar.gz |
apparmor: update to 3.0
skip ptest for now, on todo list for fix.
Runtime test pass
remove patch now included in update: 0001-regression-tests-Don-t-build-syscall_sysctl-if-missi.patch
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | recipes-mac/AppArmor/apparmor_3.0.bb (renamed from recipes-mac/AppArmor/apparmor_2.13.4.bb) | 62 | ||||
-rw-r--r-- | recipes-mac/AppArmor/files/0001-Revert-profiles-Update-make-check-to-select-tools-ba.patch | 91 | ||||
-rw-r--r-- | recipes-mac/AppArmor/files/0001-apparmor-fix-manpage-order.patch | 43 | ||||
-rw-r--r-- | recipes-mac/AppArmor/files/0001-regression-tests-Don-t-build-syscall_sysctl-if-missi.patch | 96 | ||||
-rw-r--r-- | recipes-mac/AppArmor/files/functions | 2 |
5 files changed, 158 insertions, 136 deletions
diff --git a/recipes-mac/AppArmor/apparmor_2.13.4.bb b/recipes-mac/AppArmor/apparmor_3.0.bb index 6ba1ea8..9c98199 100644 --- a/recipes-mac/AppArmor/apparmor_2.13.4.bb +++ b/recipes-mac/AppArmor/apparmor_3.0.bb | |||
@@ -11,10 +11,10 @@ SECTION = "admin" | |||
11 | LICENSE = "GPLv2 & GPLv2+ & BSD-3-Clause & LGPLv2.1+" | 11 | LICENSE = "GPLv2 & GPLv2+ & BSD-3-Clause & LGPLv2.1+" |
12 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=fd57a4b0bc782d7b80fd431f10bbf9d0" | 12 | LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=fd57a4b0bc782d7b80fd431f10bbf9d0" |
13 | 13 | ||
14 | DEPENDS = "bison-native apr gettext-native coreutils-native" | 14 | DEPENDS = "bison-native apr gettext-native coreutils-native swig-native" |
15 | 15 | ||
16 | SRC_URI = " \ | 16 | SRC_URI = " \ |
17 | git://gitlab.com/apparmor/apparmor.git;protocol=https;branch=apparmor-2.13 \ | 17 | git://gitlab.com/apparmor/apparmor.git;protocol=https;branch=apparmor-3.0 \ |
18 | file://disable_perl_h_check.patch \ | 18 | file://disable_perl_h_check.patch \ |
19 | file://crosscompile_perl_bindings.patch \ | 19 | file://crosscompile_perl_bindings.patch \ |
20 | file://apparmor.rc \ | 20 | file://apparmor.rc \ |
@@ -23,32 +23,31 @@ SRC_URI = " \ | |||
23 | file://apparmor.service \ | 23 | file://apparmor.service \ |
24 | file://0001-Makefile.am-suppress-perllocal.pod.patch \ | 24 | file://0001-Makefile.am-suppress-perllocal.pod.patch \ |
25 | file://run-ptest \ | 25 | file://run-ptest \ |
26 | file://0001-regression-tests-Don-t-build-syscall_sysctl-if-missi.patch \ | 26 | file://0001-apparmor-fix-manpage-order.patch \ |
27 | file://0001-Revert-profiles-Update-make-check-to-select-tools-ba.patch \ | ||
27 | " | 28 | " |
28 | 29 | ||
29 | SRCREV = "df0ac742f7a1146181d8734d03334494f2015134" | 30 | SRCREV = "5d51483bfecf556183558644dc8958135397a7e2" |
30 | S = "${WORKDIR}/git" | 31 | S = "${WORKDIR}/git" |
31 | 32 | ||
32 | PARALLEL_MAKE = "" | 33 | PARALLEL_MAKE = "" |
33 | 34 | ||
34 | COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*" | 35 | COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*" |
35 | 36 | ||
36 | inherit pkgconfig autotools-brokensep update-rc.d python3native perlnative ptest cpan manpages systemd features_check | 37 | inherit pkgconfig autotools-brokensep update-rc.d python3native perlnative cpan systemd features_check bash-completion |
38 | |||
37 | REQUIRED_DISTRO_FEATURES = "apparmor" | 39 | REQUIRED_DISTRO_FEATURES = "apparmor" |
38 | 40 | ||
39 | PACKAGECONFIG ??= "python perl aa-decode" | 41 | PACKAGECONFIG ?= "python perl aa-decode" |
40 | PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages" | 42 | PACKAGECONFIG[manpages] = "--enable-man-pages, --disable-man-pages" |
41 | PACKAGECONFIG[python] = "--with-python, --without-python, python3 swig-native" | 43 | PACKAGECONFIG[python] = "--with-python, --without-python, python3 , python3-core python3-modules" |
42 | PACKAGECONFIG[perl] = "--with-perl, --without-perl, perl perl-native swig-native" | 44 | PACKAGECONFIG[perl] = "--with-perl, --without-perl, " |
43 | PACKAGECONFIG[apache2] = ",,apache2," | 45 | PACKAGECONFIG[apache2] = ",,apache2," |
44 | PACKAGECONFIG[aa-decode] = ",,,bash" | 46 | PACKAGECONFIG[aa-decode] = ",,,bash" |
45 | 47 | ||
46 | PAMLIB="${@bb.utils.contains('DISTRO_FEATURES', 'pam', '1', '0', d)}" | ||
47 | HTTPD="${@bb.utils.contains('PACKAGECONFIG', 'apache2', '1', '0', d)}" | ||
48 | |||
49 | python() { | 48 | python() { |
50 | if 'apache2' in d.getVar('PACKAGECONFIG').split() and \ | 49 | if 'apache2' in d.getVar('PACKAGECONFIG').split() and \ |
51 | 'webserver' not in d.getVar('BBFILE_COLLECTIONS').split(): | 50 | 'webserver' not in d.getVar('BBFILE_COLLECTIONS').split(): |
52 | raise bb.parse.SkipRecipe('Requires meta-webserver to be present.') | 51 | raise bb.parse.SkipRecipe('Requires meta-webserver to be present.') |
53 | } | 52 | } |
54 | 53 | ||
@@ -64,24 +63,18 @@ do_configure() { | |||
64 | } | 63 | } |
65 | 64 | ||
66 | do_compile () { | 65 | do_compile () { |
67 | # Fixes: | ||
68 | # | sed -ie 's///g' Makefile.perl | ||
69 | # | sed: -e expression #1, char 0: no previous regular expression | ||
70 | #| Makefile:478: recipe for target 'Makefile.perl' failed | ||
71 | sed -i "s@sed -ie 's///g' Makefile.perl@@" ${S}/libraries/libapparmor/swig/perl/Makefile | 66 | sed -i "s@sed -ie 's///g' Makefile.perl@@" ${S}/libraries/libapparmor/swig/perl/Makefile |
72 | |||
73 | |||
74 | oe_runmake -C ${B}/libraries/libapparmor | 67 | oe_runmake -C ${B}/libraries/libapparmor |
75 | oe_runmake -C ${B}/binutils | 68 | oe_runmake -C ${B}/binutils |
76 | oe_runmake -C ${B}/utils | 69 | oe_runmake -C ${B}/utils |
77 | oe_runmake -C ${B}/parser | 70 | oe_runmake -C ${B}/parser |
78 | oe_runmake -C ${B}/profiles | 71 | oe_runmake -C ${B}/profiles |
79 | 72 | ||
80 | if test -z "${HTTPD}" ; then | 73 | if ${@bb.utils.contains('PACKAGECONFIG','apache2','true','false', d)}; then |
81 | oe_runmake -C ${B}/changehat/mod_apparmor | 74 | oe_runmake -C ${B}/changehat/mod_apparmor |
82 | fi | 75 | fi |
83 | 76 | ||
84 | if test -z "${PAMLIB}" ; then | 77 | if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then |
85 | oe_runmake -C ${B}/changehat/pam_apparmor | 78 | oe_runmake -C ${B}/changehat/pam_apparmor |
86 | fi | 79 | fi |
87 | } | 80 | } |
@@ -95,31 +88,21 @@ do_install () { | |||
95 | oe_runmake -C ${B}/parser DESTDIR="${D}" install | 88 | oe_runmake -C ${B}/parser DESTDIR="${D}" install |
96 | oe_runmake -C ${B}/profiles DESTDIR="${D}" install | 89 | oe_runmake -C ${B}/profiles DESTDIR="${D}" install |
97 | 90 | ||
98 | # If perl is disabled this script won't be any good | ||
99 | if ! ${@bb.utils.contains('PACKAGECONFIG','perl','true','false', d)}; then | ||
100 | rm -f ${D}${sbindir}/aa-notify | ||
101 | fi | ||
102 | |||
103 | if ! ${@bb.utils.contains('PACKAGECONFIG','aa-decode','true','false', d)}; then | 91 | if ! ${@bb.utils.contains('PACKAGECONFIG','aa-decode','true','false', d)}; then |
104 | rm -f ${D}${sbindir}/aa-decode | 92 | rm -f ${D}${sbindir}/aa-decode |
105 | fi | 93 | fi |
106 | 94 | ||
107 | if test -z "${HTTPD}" ; then | 95 | if ${@bb.utils.contains('PACKAGECONFIG','apache2','true','false', d)}; then |
108 | oe_runmake -C ${B}/changehat/mod_apparmor DESTDIR="${D}" install | 96 | oe_runmake -C ${B}/changehat/mod_apparmor DESTDIR="${D}" install |
109 | fi | 97 | fi |
110 | 98 | ||
111 | if test -z "${PAMLIB}" ; then | 99 | if ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'true', 'false', d)}; then |
100 | install -d ${D}/lib/security | ||
112 | oe_runmake -C ${B}/changehat/pam_apparmor DESTDIR="${D}" install | 101 | oe_runmake -C ${B}/changehat/pam_apparmor DESTDIR="${D}" install |
113 | fi | 102 | fi |
114 | 103 | ||
115 | # aa-easyprof is installed by python-tools-setup.py, fix it up | 104 | install -m 755 ${WORKDIR}/apparmor ${D}/${INIT_D_DIR}/apparmor |
116 | sed -i -e 's:/usr/bin/env.*:/usr/bin/python3:' ${D}${bindir}/aa-easyprof | 105 | install -m 755 ${WORKDIR}/functions ${D}/lib/apparmor |
117 | chmod 0755 ${D}${bindir}/aa-easyprof | ||
118 | |||
119 | install ${WORKDIR}/apparmor ${D}/${INIT_D_DIR}/apparmor | ||
120 | install ${WORKDIR}/functions ${D}/lib/apparmor | ||
121 | sed -i -e 's/getconf _NPROCESSORS_ONLN/nproc/' ${D}/lib/apparmor/functions | ||
122 | sed -i -e 's/ls -AU/ls -A/' ${D}/lib/apparmor/functions | ||
123 | 106 | ||
124 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | 107 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then |
125 | install -d ${D}${systemd_system_unitdir} | 108 | install -d ${D}${systemd_system_unitdir} |
@@ -138,8 +121,8 @@ do_compile_ptest_arm () { | |||
138 | 121 | ||
139 | do_compile_ptest () { | 122 | do_compile_ptest () { |
140 | sed -i -e 's/cpp \-dM/${HOST_PREFIX}gcc \-dM/' ${B}/tests/regression/apparmor/Makefile | 123 | sed -i -e 's/cpp \-dM/${HOST_PREFIX}gcc \-dM/' ${B}/tests/regression/apparmor/Makefile |
141 | oe_runmake -C ${B}/tests/regression/apparmor | 124 | oe_runmake -C ${B}/tests/regression/apparmor USE_SYSTEM=0 |
142 | oe_runmake -C ${B}/libraries/libapparmor | 125 | oe_runmake -C ${B}/libraries/libapparmor |
143 | } | 126 | } |
144 | 127 | ||
145 | do_install_ptest () { | 128 | do_install_ptest () { |
@@ -189,12 +172,13 @@ SYSTEMD_AUTO_ENABLE ?= "enable" | |||
189 | 172 | ||
190 | PACKAGES += "mod-${PN}" | 173 | PACKAGES += "mod-${PN}" |
191 | 174 | ||
192 | FILES_${PN} += "/lib/apparmor/ ${sysconfdir}/apparmor ${PYTHON_SITEPACKAGES_DIR}" | 175 | FILES_${PN} += "/lib/apparmor/ /lib/security/ ${sysconfdir}/apparmor ${PYTHON_SITEPACKAGES_DIR}" |
193 | FILES_mod-${PN} = "${libdir}/apache2/modules/*" | 176 | FILES_mod-${PN} = "${libdir}/apache2/modules/*" |
194 | 177 | ||
195 | # Add coreutils and findutils only if sysvinit scripts are in use | 178 | # Add coreutils and findutils only if sysvinit scripts are in use |
196 | RDEPENDS_${PN} += "${@["coreutils findutils", ""][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd')]} ${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}" | 179 | RDEPENDS_${PN} += "glibc-utils ${@["coreutils findutils", ""][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd')]} ${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}" |
197 | RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}" | 180 | RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}" |
198 | RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib bash" | 181 | RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib bash" |
199 | 182 | ||
183 | INSANE_SKIP_${PN} = "ldflags" | ||
200 | PRIVATE_LIBS_${PN}-ptest = "libapparmor.so*" | 184 | PRIVATE_LIBS_${PN}-ptest = "libapparmor.so*" |
diff --git a/recipes-mac/AppArmor/files/0001-Revert-profiles-Update-make-check-to-select-tools-ba.patch b/recipes-mac/AppArmor/files/0001-Revert-profiles-Update-make-check-to-select-tools-ba.patch new file mode 100644 index 0000000..791437d --- /dev/null +++ b/recipes-mac/AppArmor/files/0001-Revert-profiles-Update-make-check-to-select-tools-ba.patch | |||
@@ -0,0 +1,91 @@ | |||
1 | From 5ed21abbef4d4c2983e70bd2868fb817150e883e Mon Sep 17 00:00:00 2001 | ||
2 | From: Armin Kuster <akuster808@gmail.com> | ||
3 | Date: Sat, 3 Oct 2020 11:26:46 -0700 | ||
4 | Subject: [PATCH] Revert "profiles: Update 'make check' to select tools based | ||
5 | on USE_SYSTEM" | ||
6 | |||
7 | This reverts commit 6016f931ebf7b61e1358f19453ef262d9d184a4e. | ||
8 | |||
9 | Upstream-Statue: OE specific | ||
10 | These changes cause during packaging with perms changing. | ||
11 | |||
12 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
13 | |||
14 | --- | ||
15 | profiles/Makefile | 50 ++++++++++------------------------------------- | ||
16 | 1 file changed, 10 insertions(+), 40 deletions(-) | ||
17 | |||
18 | diff --git a/profiles/Makefile b/profiles/Makefile | ||
19 | index ba47fc16..5384cb05 100644 | ||
20 | --- a/profiles/Makefile | ||
21 | +++ b/profiles/Makefile | ||
22 | @@ -35,49 +35,9 @@ EXTRAS_SOURCE=./apparmor/profiles/extras/ | ||
23 | SUBDIRS=$(shell find ${PROFILES_SOURCE} -type d -print) | ||
24 | TOPLEVEL_PROFILES=$(filter-out ${SUBDIRS}, $(wildcard ${PROFILES_SOURCE}/*)) | ||
25 | |||
26 | -ifdef USE_SYSTEM | ||
27 | - PYTHONPATH= | ||
28 | - PARSER?=apparmor_parser | ||
29 | - LOGPROF?=aa-logprof | ||
30 | -else | ||
31 | - # PYTHON_DIST_BUILD_PATH based on libapparmor/swig/python/test/Makefile.am | ||
32 | - PYTHON_DIST_BUILD_PATH = ../libraries/libapparmor/swig/python/build/$$($(PYTHON) -c "import distutils.util; import platform; print(\"lib.%s-%s\" %(distutils.util.get_platform(), platform.python_version()[:3]))") | ||
33 | - LIBAPPARMOR_PATH=../libraries/libapparmor/src/.libs/ | ||
34 | - LD_LIBRARY_PATH=$(LIBAPPARMOR_PATH):$(PYTHON_DIST_BUILD_PATH) | ||
35 | - PYTHONPATH=../utils/:$(PYTHON_DIST_BUILD_PATH) | ||
36 | - PARSER?=../parser/apparmor_parser | ||
37 | - # use ../utils logprof | ||
38 | - LOGPROF?=LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) PYTHONPATH=$(PYTHONPATH) $(PYTHON) ../utils/aa-logprof | ||
39 | -endif | ||
40 | - | ||
41 | # $(PWD) is wrong when using "make -C profiles" - explicitely set it here to get the right value | ||
42 | PWD=$(shell pwd) | ||
43 | |||
44 | -.PHONY: test-dependencies | ||
45 | -test-dependencies: __parser __libapparmor | ||
46 | - | ||
47 | - | ||
48 | -.PHONY: __parser __libapparmor | ||
49 | -__parser: | ||
50 | -ifndef USE_SYSTEM | ||
51 | - @if [ ! -f $(PARSER) ]; then \ | ||
52 | - echo "error: $(PARSER) is missing. Pick one of these possible solutions:" 1>&2; \ | ||
53 | - echo " 1) Test using the in-tree parser by building it first and then trying again. See the top-level README for help." 1>&2; \ | ||
54 | - echo " 2) Test using the system parser by adding USE_SYSTEM=1 to your make command." 1>&2; \ | ||
55 | - exit 1; \ | ||
56 | - fi | ||
57 | -endif | ||
58 | - | ||
59 | -__libapparmor: | ||
60 | -ifndef USE_SYSTEM | ||
61 | - @if [ ! -f $(LIBAPPARMOR_PATH)libapparmor.so ]; then \ | ||
62 | - echo "error: $(LIBAPPARMOR_PATH)libapparmor.so is missing. Pick one of these possible solutions:" 1>&2; \ | ||
63 | - echo " 1) Build against the in-tree libapparmor by building it first and then trying again. See the top-level README for help." 1>&2; \ | ||
64 | - echo " 2) Build against the system libapparmor by adding USE_SYSTEM=1 to your make command." 1>&2; \ | ||
65 | - exit 1; \ | ||
66 | - fi | ||
67 | -endif | ||
68 | - | ||
69 | local: | ||
70 | for profile in ${TOPLEVEL_PROFILES}; do \ | ||
71 | fn=$$(basename $$profile); \ | ||
72 | @@ -109,6 +69,16 @@ else | ||
73 | Q= | ||
74 | endif | ||
75 | |||
76 | +ifndef PARSER | ||
77 | +# use system parser | ||
78 | +PARSER=../parser/apparmor_parser | ||
79 | +endif | ||
80 | + | ||
81 | +ifndef LOGPROF | ||
82 | +# use ../utils logprof | ||
83 | +LOGPROF=PYTHONPATH=../utils $(PYTHON) ../utils/aa-logprof | ||
84 | +endif | ||
85 | + | ||
86 | .PHONY: docs | ||
87 | # docs: should we have some here? | ||
88 | docs: | ||
89 | -- | ||
90 | 2.17.1 | ||
91 | |||
diff --git a/recipes-mac/AppArmor/files/0001-apparmor-fix-manpage-order.patch b/recipes-mac/AppArmor/files/0001-apparmor-fix-manpage-order.patch new file mode 100644 index 0000000..9f3dce4 --- /dev/null +++ b/recipes-mac/AppArmor/files/0001-apparmor-fix-manpage-order.patch | |||
@@ -0,0 +1,43 @@ | |||
1 | From c9baef0c70122e1be33b627874772e6e9a5d7744 Mon Sep 17 00:00:00 2001 | ||
2 | From: Armin Kuster <akuster808@gmail.com> | ||
3 | Date: Fri, 2 Oct 2020 19:43:44 -0700 | ||
4 | Subject: [PATCH] apparmor: fix manpage order | ||
5 | |||
6 | It trys to create a symlink before the man pages are installed. | ||
7 | |||
8 | ln -sf aa-status.8 /(path}/apparmor/3.0-r0/image/usr/share/man/man8/apparmor_status.8 | ||
9 | | ln: failed to create symbolic link '{path}/apparmor/3.0-r0/image/usr/share/man/man8/apparmor_status.8': No such file or directory | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
13 | |||
14 | ... | ||
15 | |||
16 | install -d /{path}/apparmor/3.0-r0/image/usr/share/man/man8 ; install -m 644 aa-status.8 /{path}/apparmor/3.0-r0/image/usr/share/man/man8; | ||
17 | |||
18 | Signed-off-by: Armin Kuster <akuster@mvista.com> | ||
19 | --- | ||
20 | binutils/Makefile | 2 +- | ||
21 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/binutils/Makefile b/binutils/Makefile | ||
24 | index 99e54875..3f1d0011 100644 | ||
25 | --- a/binutils/Makefile | ||
26 | +++ b/binutils/Makefile | ||
27 | @@ -156,12 +156,12 @@ install-arch: arch | ||
28 | install -m 755 -d ${SBINDIR} | ||
29 | ln -sf aa-status ${SBINDIR}/apparmor_status | ||
30 | install -m 755 ${SBINTOOLS} ${SBINDIR} | ||
31 | - ln -sf aa-status.8 ${DESTDIR}/${MANDIR}/man8/apparmor_status.8 | ||
32 | |||
33 | .PHONY: install-indep | ||
34 | install-indep: indep | ||
35 | $(MAKE) -C po install NAME=${NAME} DESTDIR=${DESTDIR} | ||
36 | $(MAKE) install_manpages DESTDIR=${DESTDIR} | ||
37 | + ln -sf aa-status.8 ${DESTDIR}/${MANDIR}/man8/apparmor_status.8 | ||
38 | |||
39 | ifndef VERBOSE | ||
40 | .SILENT: clean | ||
41 | -- | ||
42 | 2.17.1 | ||
43 | |||
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 @@ | |||
1 | From 7a7c7fb346ded6f017c8df44486778a5f032d41a Mon Sep 17 00:00:00 2001 | ||
2 | From: John Johansen <john.johansen@canonical.com> | ||
3 | Date: Tue, 29 Sep 2020 03:05:22 -0700 | ||
4 | Subject: [PATCH] regression tests: Don't build syscall_sysctl if missing | ||
5 | kernel headers | ||
6 | |||
7 | sys/sysctl.h is not guaranteed to exist anymore since | ||
8 | https://sourceware.org/pipermail/glibc-cvs/2020q2/069366.html | ||
9 | |||
10 | which is a follow on to the kernel commit | ||
11 | 61a47c1ad3a4 sysctl: Remove the sysctl system call | ||
12 | |||
13 | While the syscall_sysctl currently checks if the kernel supports | ||
14 | sysctrs before running the tests. The tests can't even build if the | ||
15 | kernel headers don't have the sysctl defines. | ||
16 | |||
17 | Fixes: https://gitlab.com/apparmor/apparmor/-/issues/119 | ||
18 | Fixes: https://bugs.launchpad.net/apparmor/+bug/1897288 | ||
19 | MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/637 | ||
20 | Signed-off-by: John Johansen <john.johansen@canonical.com> | ||
21 | Acked-by: Steve Beattie <steve.beattie@canonical.com> | ||
22 | (cherry picked from commit 2e5a266eb715fc7e526520235a6450444775791f) | ||
23 | |||
24 | Upstream-Status: Backport | ||
25 | Signed-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 | |||
32 | diff --git a/tests/regression/apparmor/Makefile b/tests/regression/apparmor/Makefile | ||
33 | index 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 | ||
67 | diff --git a/tests/regression/apparmor/syscall_sysctl.sh b/tests/regression/apparmor/syscall_sysctl.sh | ||
68 | index 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 | -- | ||
95 | 2.17.1 | ||
96 | |||
diff --git a/recipes-mac/AppArmor/files/functions b/recipes-mac/AppArmor/files/functions index cef8cfe..e9e2bbf 100644 --- a/recipes-mac/AppArmor/files/functions +++ b/recipes-mac/AppArmor/files/functions | |||
@@ -144,7 +144,7 @@ clear_cache_var() { | |||
144 | 144 | ||
145 | read_features_dir() | 145 | read_features_dir() |
146 | { | 146 | { |
147 | for f in `ls -AU "$1"` ; do | 147 | for f in `ls -A "$1"` ; do |
148 | if [ -f "$1/$f" ] ; then | 148 | if [ -f "$1/$f" ] ; then |
149 | read -r KF < "$1/$f" || true | 149 | read -r KF < "$1/$f" || true |
150 | echo -n "$f {$KF } " | 150 | echo -n "$f {$KF } " |