summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-security
diff options
context:
space:
mode:
authorAkash Hadke <hadkeakash4@gmail.com>2022-10-21 15:12:11 +0200
committerKhem Raj <raj.khem@gmail.com>2022-10-21 09:57:59 -0700
commit51a12d6e8e5c492a058aca82507438ef3402d36d (patch)
tree2b3c685ca6071c8060bf0903b2f36ad74c2fd166 /meta-oe/recipes-security
parentcfac82c560e514333ebb1de772778554d1aca49c (diff)
downloadmeta-openembedded-51a12d6e8e5c492a058aca82507438ef3402d36d.tar.gz
audit: Fix compile error for audit_2.8.5
Fix below compile errors 1. Fix build with linux 5.17+ audit errors out due to swig munging it does with kernel headers | audit_wrap.c: In function '_wrap_audit_rule_data_buf_set': | audit_wrap.c:4701:17: error: cast specifies array type | 4701 | arg1->buf = (char [])(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); | | ^ | audit_wrap.c:4701:15: error: invalid use of flexible array member | 4701 | arg1->buf = (char [])(char *)memcpy(malloc((size)*sizeof(char)), (const char *)(arg2), sizeof(char)*(size)); | | ^ | audit_wrap.c:4703:15: error: invalid use of flexible array member | 4703 | arg1->buf = 0; | | ^ These errors are due to VLAIS from kernel headers, so we copy linux/audit.h and make the needed change in local audit.h and make needed arrangements in build to use it when building audit package Take reference of upstream commit ee3c680c3 audit: Upgrade to 3.0.8 and fix build with linux 5.17+ Update 0002-Fixed-swig-host-contamination-issue.patch 2. Fix ipx.h missing file bug for kernel 5.15 ipx.h header file is removed in kernel 5.15 Link: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/net?id=6c9b40844751ea30c72f7a2f92f4d704bc6b2927 which is causing below error for system with kernel equal and higher than 5.15 | ../../git/auparse/interpret.c:48:10: fatal error: linux/ipx.h: No such file or directory | 48 | #include <linux/ipx.h> | | ^~~~~~~~~~~~~ Add below patch to fix this issue. 0001-Make-IPX-packet-interpretation-dependent-on-the-ipx-header.patch Link: https://github.com/linux-audit/audit-userspace/commit/6b09724c69d91668418ddb3af00da6db6755208c Signed-off-by: Akash Hadke <akash.hadke@kpit.com> Signed-off-by: Akash Hadke <hadkeakash4@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe/recipes-security')
-rw-r--r--meta-oe/recipes-security/audit/audit/0001-Make-IPX-packet-interpretation-dependent-on-the-ipx-header.patch65
-rw-r--r--meta-oe/recipes-security/audit/audit/0002-Fixed-swig-host-contamination-issue.patch9
-rw-r--r--meta-oe/recipes-security/audit/audit_2.8.5.bb6
3 files changed, 78 insertions, 2 deletions
diff --git a/meta-oe/recipes-security/audit/audit/0001-Make-IPX-packet-interpretation-dependent-on-the-ipx-header.patch b/meta-oe/recipes-security/audit/audit/0001-Make-IPX-packet-interpretation-dependent-on-the-ipx-header.patch
new file mode 100644
index 000000000..054f50ab2
--- /dev/null
+++ b/meta-oe/recipes-security/audit/audit/0001-Make-IPX-packet-interpretation-dependent-on-the-ipx-header.patch
@@ -0,0 +1,65 @@
1From 6b09724c69d91668418ddb3af00da6db6755208c Mon Sep 17 00:00:00 2001
2From: Steve Grubb <sgrubb@redhat.com>
3Date: Thu, 2 Sep 2021 15:01:12 -0400
4Subject: [PATCH] Make IPX packet interpretation dependent on the ipx header
5 file existing
6
7Upstream-Status: Backport [https://github.com/linux-audit/audit-userspace/commit/6b09724c69d91668418ddb3af00da6db6755208c.patch]
8Comment: Remove one hunk from changelog file and refresh rest hunks as per codebase of audit_2.8.5
9Signed-off-by: Akash Hadke <akash.hadke@kpit.com>
10---
11 auparse/interpret.c | 8 ++++++--
12 configure.ac | 6 ++++++
13 2 files changed, 12 insertions(+), 2 deletions(-)
14
15diff --git a/auparse/interpret.c b/auparse/interpret.c
16index 63829aa0e..6c316456d 100644
17--- a/auparse/interpret.c 2022-10-14 11:22:20.833880000 +0200
18+++ b/auparse/interpret.c 2022-10-14 11:35:13.196455950 +0200
19@@ -44,8 +44,10 @@
20 #include <linux/ax25.h>
21 #include <linux/atm.h>
22 #include <linux/x25.h>
23-#include <linux/if.h> // FIXME: remove when ipx.h is fixed
24-#include <linux/ipx.h>
25+#ifdef HAVE_IPX_HEADERS
26+ #include <linux/if.h> // FIXME: remove when ipx.h is fixed
27+ #include <linux/ipx.h>
28+#endif
29 #include <linux/capability.h>
30 #include <sys/personality.h>
31 #include <sys/prctl.h>
32@@ -1158,6 +1160,7 @@
33 x->sax25_call.ax25_call[6]);
34 }
35 break;
36+#ifdef HAVE_IPX_HEADERS
37 case AF_IPX:
38 {
39 const struct sockaddr_ipx *ip =
40@@ -1167,6 +1170,7 @@
41 str, ip->sipx_port, ip->sipx_network);
42 }
43 break;
44+#endif
45 case AF_ATMPVC:
46 {
47 const struct sockaddr_atmpvc* at =
48diff --git a/configure.ac b/configure.ac
49index 8f541e4c0..005eb0b5b 100644
50--- a/configure.ac 2022-10-14 11:22:20.833880000 +0200
51+++ b/configure.ac 2022-10-14 11:36:32.391044084 +0200
52@@ -414,6 +414,12 @@
53 AC_DEFINE_UNQUOTED(HAVE_LIBWRAP, [], Define if tcp_wrappers support is enabled )
54 fi
55
56+# linux/ipx.h - deprecated in 2018
57+AC_CHECK_HEADER(linux/ipx.h, ipx_headers=yes, ipx_headers=no)
58+if test $ipx_headers = yes ; then
59+ AC_DEFINE(HAVE_IPX_HEADERS,1,[IPX packet interpretation])
60+fi
61+
62 # See if we want to support lower capabilities for plugins
63 LIBCAP_NG_PATH
64
65
diff --git a/meta-oe/recipes-security/audit/audit/0002-Fixed-swig-host-contamination-issue.patch b/meta-oe/recipes-security/audit/audit/0002-Fixed-swig-host-contamination-issue.patch
index 4a1b97997..39a090c83 100644
--- a/meta-oe/recipes-security/audit/audit/0002-Fixed-swig-host-contamination-issue.patch
+++ b/meta-oe/recipes-security/audit/audit/0002-Fixed-swig-host-contamination-issue.patch
@@ -13,6 +13,11 @@ Upstream-Status: Inappropriate [embedded specific]
13Signed-off-by: Anders Hedlund <anders.hedlund@windriver.com> 13Signed-off-by: Anders Hedlund <anders.hedlund@windriver.com>
14Signed-off-by: Joe Slater <jslater@windriver.com> 14Signed-off-by: Joe Slater <jslater@windriver.com>
15Signed-off-by: Yi Zhao <yi.zhao@windriver.com> 15Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
16
17Comment: Refresh hunk from auditswig.i to fix build with linux 5.17+
18Reference-Commit: ee3c680c3 audit: Upgrade to 3.0.8 and fix build with linux 5.17+
19Signed-off-by: Akash Hadke <akash.hadke@kpit.com>
20Signed-off-by: Akash Hadke <hadkeakash4@gmail.com>
16--- 21---
17 bindings/swig/python3/Makefile.am | 3 ++- 22 bindings/swig/python3/Makefile.am | 3 ++-
18 bindings/swig/src/auditswig.i | 2 +- 23 bindings/swig/src/auditswig.i | 2 +-
@@ -43,12 +48,12 @@ diff --git a/bindings/swig/src/auditswig.i b/bindings/swig/src/auditswig.i
43index 7ebb373..424fb68 100644 48index 7ebb373..424fb68 100644
44--- a/bindings/swig/src/auditswig.i 49--- a/bindings/swig/src/auditswig.i
45+++ b/bindings/swig/src/auditswig.i 50+++ b/bindings/swig/src/auditswig.i
46@@ -39,7 +39,7 @@ signed 51@@ -39,7 +39,7 @@
47 #define __attribute(X) /*nothing*/ 52 #define __attribute(X) /*nothing*/
48 typedef unsigned __u32; 53 typedef unsigned __u32;
49 typedef unsigned uid_t; 54 typedef unsigned uid_t;
50-%include "/usr/include/linux/audit.h" 55-%include "/usr/include/linux/audit.h"
51+%include "linux/audit.h" 56+%include "../lib/audit.h"
52 #define __extension__ /*nothing*/ 57 #define __extension__ /*nothing*/
53 #include <stdint.h> 58 #include <stdint.h>
54 %include "../lib/libaudit.h" 59 %include "../lib/libaudit.h"
diff --git a/meta-oe/recipes-security/audit/audit_2.8.5.bb b/meta-oe/recipes-security/audit/audit_2.8.5.bb
index 347c85506..f846b27f9 100644
--- a/meta-oe/recipes-security/audit/audit_2.8.5.bb
+++ b/meta-oe/recipes-security/audit/audit_2.8.5.bb
@@ -14,6 +14,7 @@ SRC_URI = "git://github.com/linux-audit/${BPN}-userspace.git;branch=2.8_maintena
14 file://auditd \ 14 file://auditd \
15 file://auditd.service \ 15 file://auditd.service \
16 file://audit-volatile.conf \ 16 file://audit-volatile.conf \
17 file://0001-Make-IPX-packet-interpretation-dependent-on-the-ipx-header.patch \
17" 18"
18 19
19S = "${WORKDIR}/git" 20S = "${WORKDIR}/git"
@@ -72,6 +73,11 @@ FILES:${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}"
72CONFFILES:auditd = "${sysconfdir}/audit/audit.rules" 73CONFFILES:auditd = "${sysconfdir}/audit/audit.rules"
73RDEPENDS:auditd = "bash" 74RDEPENDS:auditd = "bash"
74 75
76do_configure:prepend() {
77 sed -e 's|buf\[];|buf[0];|g' ${STAGING_INCDIR}/linux/audit.h > ${S}/lib/audit.h
78 sed -i -e 's|#include <linux/audit.h>|#include "audit.h"|g' ${S}/lib/libaudit.h
79}
80
75do_install:append() { 81do_install:append() {
76 rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.a 82 rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.a
77 rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.la 83 rm -f ${D}/${libdir}/python${PYTHON_BASEVERSION}/site-packages/*.la