diff options
author | Armin Kuster <akuster808@gmail.com> | 2020-10-06 16:05:23 -0700 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2020-10-10 16:21:31 -0700 |
commit | 11dd919372837814c4c499b4034a7df15fc00bfe (patch) | |
tree | 99bfd6c47102e8c46b895c4c81b851949c4bca28 | |
parent | c5b5737ef3e54ed1dc92ce6a3fad72d376b2a31b (diff) | |
download | meta-security-11dd919372837814c4c499b4034a7df15fc00bfe.tar.gz |
apparmor: fix build for on musl
Signed-off-by: Armin Kuster <akuster808@gmail.com>
6 files changed, 185 insertions, 1 deletions
diff --git a/recipes-mac/AppArmor/apparmor_3.0.bb b/recipes-mac/AppArmor/apparmor_3.0.bb index 9c98199..35e95a0 100644 --- a/recipes-mac/AppArmor/apparmor_3.0.bb +++ b/recipes-mac/AppArmor/apparmor_3.0.bb | |||
@@ -25,6 +25,11 @@ SRC_URI = " \ | |||
25 | file://run-ptest \ | 25 | file://run-ptest \ |
26 | file://0001-apparmor-fix-manpage-order.patch \ | 26 | file://0001-apparmor-fix-manpage-order.patch \ |
27 | file://0001-Revert-profiles-Update-make-check-to-select-tools-ba.patch \ | 27 | file://0001-Revert-profiles-Update-make-check-to-select-tools-ba.patch \ |
28 | file://0001-libapparmor-add-missing-include-for-socklen_t.patch \ | ||
29 | file://0002-libapparmor-add-aa_features_new_from_file-to-public-.patch \ | ||
30 | file://0003-libapparmor-add-_aa_asprintf-to-private-symbols.patch \ | ||
31 | file://0001-aa_status-Fix-build-issue-with-musl.patch \ | ||
32 | file://0001-parser-Makefile-dont-force-host-cpp-to-detect-reallo.patch \ | ||
28 | " | 33 | " |
29 | 34 | ||
30 | SRCREV = "5d51483bfecf556183558644dc8958135397a7e2" | 35 | SRCREV = "5d51483bfecf556183558644dc8958135397a7e2" |
@@ -175,8 +180,12 @@ PACKAGES += "mod-${PN}" | |||
175 | FILES_${PN} += "/lib/apparmor/ /lib/security/ ${sysconfdir}/apparmor ${PYTHON_SITEPACKAGES_DIR}" | 180 | FILES_${PN} += "/lib/apparmor/ /lib/security/ ${sysconfdir}/apparmor ${PYTHON_SITEPACKAGES_DIR}" |
176 | FILES_mod-${PN} = "${libdir}/apache2/modules/*" | 181 | FILES_mod-${PN} = "${libdir}/apache2/modules/*" |
177 | 182 | ||
183 | DEPENDS_append_libc-musl = " fts " | ||
184 | RDEPENDS_${PN}_libc-musl += "musl-utils" | ||
185 | RDEPENDS_${PN}_libc-glibc += "glibc-utils" | ||
186 | |||
178 | # Add coreutils and findutils only if sysvinit scripts are in use | 187 | # Add coreutils and findutils only if sysvinit scripts are in use |
179 | RDEPENDS_${PN} += "glibc-utils ${@["coreutils findutils", ""][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd')]} ${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}" | 188 | RDEPENDS_${PN} += "${@["coreutils findutils", ""][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd')]} ${@bb.utils.contains('PACKAGECONFIG','python','python3-core python3-modules','', d)}" |
180 | RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}" | 189 | RDEPENDS_${PN}_remove += "${@bb.utils.contains('PACKAGECONFIG','perl','','perl', d)}" |
181 | RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib bash" | 190 | RDEPENDS_${PN}-ptest += "perl coreutils dbus-lib bash" |
182 | 191 | ||
diff --git a/recipes-mac/AppArmor/files/0001-aa_status-Fix-build-issue-with-musl.patch b/recipes-mac/AppArmor/files/0001-aa_status-Fix-build-issue-with-musl.patch new file mode 100644 index 0000000..239562a --- /dev/null +++ b/recipes-mac/AppArmor/files/0001-aa_status-Fix-build-issue-with-musl.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From 2bf15cc68f31c9f41962bb60a669ab2b453a039b Mon Sep 17 00:00:00 2001 | ||
2 | From: Armin Kuster <akuster808@gmail.com> | ||
3 | Date: Wed, 7 Oct 2020 08:27:11 -0700 | ||
4 | Subject: [PATCH] aa_status: Fix build issue with musl | ||
5 | |||
6 | add limits.h | ||
7 | |||
8 | aa_status.c:269:22: error: 'PATH_MAX' undeclared (first use in this function); did you mean 'AF_MAX'? | ||
9 | | 269 | real_exe = calloc(PATH_MAX + 1, sizeof(char)); | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
13 | --- | ||
14 | binutils/aa_status.c | 1 + | ||
15 | 1 file changed, 1 insertion(+) | ||
16 | |||
17 | diff --git a/binutils/aa_status.c b/binutils/aa_status.c | ||
18 | index 78b03409..41f1954e 100644 | ||
19 | --- a/binutils/aa_status.c | ||
20 | +++ b/binutils/aa_status.c | ||
21 | @@ -10,6 +10,7 @@ | ||
22 | #include <stdio.h> | ||
23 | #include <stdlib.h> | ||
24 | #include <string.h> | ||
25 | +#include <limits.h> | ||
26 | #include <sys/types.h> | ||
27 | #include <sys/stat.h> | ||
28 | #include <sys/wait.h> | ||
29 | -- | ||
30 | 2.17.1 | ||
31 | |||
diff --git a/recipes-mac/AppArmor/files/0001-libapparmor-add-missing-include-for-socklen_t.patch b/recipes-mac/AppArmor/files/0001-libapparmor-add-missing-include-for-socklen_t.patch new file mode 100644 index 0000000..2a56d8b --- /dev/null +++ b/recipes-mac/AppArmor/files/0001-libapparmor-add-missing-include-for-socklen_t.patch | |||
@@ -0,0 +1,36 @@ | |||
1 | From 47263a3a74d7973e7a54b17db6aa903701468ffd Mon Sep 17 00:00:00 2001 | ||
2 | From: Patrick Steinhardt <ps@pks.im> | ||
3 | Date: Sat, 3 Oct 2020 20:37:55 +0200 | ||
4 | Subject: [PATCH] libapparmor: add missing include for `socklen_t` | ||
5 | |||
6 | While `include/sys/apparmor.h` makes use of `socklen_t`, it doesn't | ||
7 | include the `<sys/socket.h>` header to make its declaration available. | ||
8 | While this works on systems using glibc via transitive includes, it | ||
9 | breaks compilation on musl libc. | ||
10 | |||
11 | Fix the issue by including the header. | ||
12 | |||
13 | Signed-off-by: Patrick Steinhardt <ps@pks.im> | ||
14 | |||
15 | Upstream-Status: Backport | ||
16 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
17 | |||
18 | --- | ||
19 | libraries/libapparmor/include/sys/apparmor.h | 1 + | ||
20 | 1 file changed, 1 insertion(+) | ||
21 | |||
22 | diff --git a/libraries/libapparmor/include/sys/apparmor.h b/libraries/libapparmor/include/sys/apparmor.h | ||
23 | index 32892d06..d70eff94 100644 | ||
24 | --- a/libraries/libapparmor/include/sys/apparmor.h | ||
25 | +++ b/libraries/libapparmor/include/sys/apparmor.h | ||
26 | @@ -21,6 +21,7 @@ | ||
27 | #include <stdbool.h> | ||
28 | #include <stdint.h> | ||
29 | #include <unistd.h> | ||
30 | +#include <sys/socket.h> | ||
31 | #include <sys/types.h> | ||
32 | |||
33 | #ifdef __cplusplus | ||
34 | -- | ||
35 | 2.17.1 | ||
36 | |||
diff --git a/recipes-mac/AppArmor/files/0001-parser-Makefile-dont-force-host-cpp-to-detect-reallo.patch b/recipes-mac/AppArmor/files/0001-parser-Makefile-dont-force-host-cpp-to-detect-reallo.patch new file mode 100644 index 0000000..9f7ad3c --- /dev/null +++ b/recipes-mac/AppArmor/files/0001-parser-Makefile-dont-force-host-cpp-to-detect-reallo.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | From 965bb9c3e464f756b258a7c259a92bce3cde74e7 Mon Sep 17 00:00:00 2001 | ||
2 | From: Armin Kuster <akuster@mvista.com> | ||
3 | Date: Wed, 7 Oct 2020 20:50:38 -0700 | ||
4 | Subject: [PATCH] parser/Makefile: dont force host cpp to detect reallocarray | ||
5 | |||
6 | In cross build environments, using the hosts cpp gives incorrect | ||
7 | detection of reallocarray. Change cpp to a variable. | ||
8 | |||
9 | fixes: | ||
10 | parser_misc.c: In function 'int capable_add_cap(const char*, int, unsigned int, capability_flags)': | ||
11 | | parser_misc.c:297:37: error: 'reallocarray' was not declared in this scope | ||
12 | | 297 | tmp = (struct capability_table *) reallocarray(cap_table, sizeof(struct capability_table), cap_table_size+1); | ||
13 | |||
14 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
15 | |||
16 | Upstream-Status: Pending | ||
17 | |||
18 | --- | ||
19 | parser/Makefile | 2 +- | ||
20 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
21 | |||
22 | diff --git a/parser/Makefile b/parser/Makefile | ||
23 | index acef3d77..8250ac45 100644 | ||
24 | --- a/parser/Makefile | ||
25 | +++ b/parser/Makefile | ||
26 | @@ -54,7 +54,7 @@ endif | ||
27 | CPPFLAGS += -D_GNU_SOURCE | ||
28 | |||
29 | STDLIB_INCLUDE:="\#include <stdlib.h>" | ||
30 | -HAVE_REALLOCARRAY:=$(shell echo $(STDLIB_INCLUDE) | cpp ${CPPFLAGS} | grep -q reallocarray && echo true) | ||
31 | +HAVE_REALLOCARRAY:=$(shell echo $(STDLIB_INCLUDE) | ${CPP} ${CPPFLAGS} | grep -q reallocarray && echo true) | ||
32 | |||
33 | WARNINGS = -Wall | ||
34 | CXX_WARNINGS = ${WARNINGS} ${EXTRA_WARNINGS} | ||
35 | -- | ||
36 | 2.17.1 | ||
37 | |||
diff --git a/recipes-mac/AppArmor/files/0002-libapparmor-add-aa_features_new_from_file-to-public-.patch b/recipes-mac/AppArmor/files/0002-libapparmor-add-aa_features_new_from_file-to-public-.patch new file mode 100644 index 0000000..333f40f --- /dev/null +++ b/recipes-mac/AppArmor/files/0002-libapparmor-add-aa_features_new_from_file-to-public-.patch | |||
@@ -0,0 +1,37 @@ | |||
1 | From c9255a03436e6a91bd4e410601da8d43a341ffc2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Patrick Steinhardt <ps@pks.im> | ||
3 | Date: Sat, 3 Oct 2020 20:58:45 +0200 | ||
4 | Subject: [PATCH] libapparmor: add `aa_features_new_from_file` to public | ||
5 | symbols | ||
6 | |||
7 | With AppArmor release 3.0, a new function `aa_features_new_from_file` | ||
8 | was added, but not added to the list of public symbols. As a result, | ||
9 | it's not possible to make use of this function when linking against | ||
10 | libapparmor.so. | ||
11 | |||
12 | Fix the issue by adding it to the symbol map. | ||
13 | |||
14 | Signed-off-by: Patrick Steinhardt <ps@pks.im> | ||
15 | |||
16 | Upstream-Status: Backport | ||
17 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
18 | |||
19 | --- | ||
20 | libraries/libapparmor/src/libapparmor.map | 1 + | ||
21 | 1 file changed, 1 insertion(+) | ||
22 | |||
23 | diff --git a/libraries/libapparmor/src/libapparmor.map b/libraries/libapparmor/src/libapparmor.map | ||
24 | index bbff51f5..1579509a 100644 | ||
25 | --- a/libraries/libapparmor/src/libapparmor.map | ||
26 | +++ b/libraries/libapparmor/src/libapparmor.map | ||
27 | @@ -117,6 +117,7 @@ APPARMOR_2.13.1 { | ||
28 | |||
29 | APPARMOR_3.0 { | ||
30 | global: | ||
31 | + aa_features_new_from_file; | ||
32 | aa_features_write_to_fd; | ||
33 | aa_features_value; | ||
34 | local: | ||
35 | -- | ||
36 | 2.17.1 | ||
37 | |||
diff --git a/recipes-mac/AppArmor/files/0003-libapparmor-add-_aa_asprintf-to-private-symbols.patch b/recipes-mac/AppArmor/files/0003-libapparmor-add-_aa_asprintf-to-private-symbols.patch new file mode 100644 index 0000000..543c7a1 --- /dev/null +++ b/recipes-mac/AppArmor/files/0003-libapparmor-add-_aa_asprintf-to-private-symbols.patch | |||
@@ -0,0 +1,34 @@ | |||
1 | From 9a8fee6bf1c79c261374d928b838b5eb9244ee9b Mon Sep 17 00:00:00 2001 | ||
2 | From: Patrick Steinhardt <ps@pks.im> | ||
3 | Date: Sat, 3 Oct 2020 21:04:57 +0200 | ||
4 | Subject: [PATCH] libapparmor: add _aa_asprintf to private symbols | ||
5 | |||
6 | While `_aa_asprintf` is supposed to be of private visibility, it's used | ||
7 | by apparmor_parser and thus required to be visible when linking. This | ||
8 | commit thus adds it to the list of private symbols to make it available | ||
9 | for linking in apparmor_parser. | ||
10 | |||
11 | Signed-off-by: Patrick Steinhardt <ps@pks.im> | ||
12 | |||
13 | Upstream-Status: Backport | ||
14 | Signed-off-by: Armin Kuster <akuster808@gmail.com> | ||
15 | |||
16 | --- | ||
17 | libraries/libapparmor/src/libapparmor.map | 1 + | ||
18 | 1 file changed, 1 insertion(+) | ||
19 | |||
20 | diff --git a/libraries/libapparmor/src/libapparmor.map b/libraries/libapparmor/src/libapparmor.map | ||
21 | index 1579509a..41e541ac 100644 | ||
22 | --- a/libraries/libapparmor/src/libapparmor.map | ||
23 | +++ b/libraries/libapparmor/src/libapparmor.map | ||
24 | @@ -127,6 +127,7 @@ APPARMOR_3.0 { | ||
25 | PRIVATE { | ||
26 | global: | ||
27 | _aa_is_blacklisted; | ||
28 | + _aa_asprintf; | ||
29 | _aa_autofree; | ||
30 | _aa_autoclose; | ||
31 | _aa_autofclose; | ||
32 | -- | ||
33 | 2.17.1 | ||
34 | |||