[yocto] [meta-security][PATCH][V2] samhain: fix build issues when using musl

Armin Kuster akuster808 at gmail.com
Fri Mar 24 07:25:14 PDT 2017


[v2]: Correct musl malloc fix.
remove HAVE_MALLOC_H define; this enables using the included defined mallinfo.

[V1]: Fix c99

x_dnmalloc.c:563:26: error: return type is an incomplete type
| #define public_mALLINFo mallinfo
| ^
| x_dnmalloc.c:1689:17: note: in expansion of macro 'public_mALLINFo'
| struct mallinfo public_mALLINFo() {

and
_dnmalloc.c:5527:17: error: unknown type name 'u_int'
| u_int rnd[(128 - 2*sizeof(struct timeval)) / sizeof(u_int)];
| ^~~~~

Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 recipes-security/samhain/files/c99_dnmalloc.patch | 18 ++++++++++++++++++
 recipes-security/samhain/samhain.inc              |  5 +++++
 2 files changed, 23 insertions(+)
 create mode 100644 recipes-security/samhain/files/c99_dnmalloc.patch

diff --git a/recipes-security/samhain/files/c99_dnmalloc.patch b/recipes-security/samhain/files/c99_dnmalloc.patch
new file mode 100644
index 0000000..2216564
--- /dev/null
+++ b/recipes-security/samhain/files/c99_dnmalloc.patch
@@ -0,0 +1,18 @@
+samhain: musl build fix c99
+
+Upstream-Status: Submitted
+Signed-off-by: Armin Kuster <akuster at mvista.com>
+
+Index: samhain-4.2.0/src/dnmalloc.c
+===================================================================
+--- samhain-4.2.0.orig/src/dnmalloc.c
++++ samhain-4.2.0/src/dnmalloc.c
+@@ -5524,7 +5524,7 @@ arc4_stir(void)
+         struct {
+                 struct timeval tv1;
+                 struct timeval tv2;
+-                u_int rnd[(128 - 2*sizeof(struct timeval)) / sizeof(u_int)];
++                unsigned char rnd[(128 - 2*sizeof(struct timeval)) / sizeof(unsigned char)];
+         } rdat;
+ #if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+         ssize_t sz = 0;
diff --git a/recipes-security/samhain/samhain.inc b/recipes-security/samhain/samhain.inc
index 789150b..d558e6b 100644
--- a/recipes-security/samhain/samhain.inc
+++ b/recipes-security/samhain/samhain.inc
@@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=8ca43cbc842c2336e835926c2166c28b"
 SRC_URI = "http://la-samhna.de/archive/samhain_signed-${PV}.tar.gz \
 	   file://${INITSCRIPT_NAME}.init \
 	   file://${INITSCRIPT_NAME}.default \
+           file://c99_dnmalloc.patch \
 	  "
 
 SRC_URI[md5sum] = "d98a55646b14f9419fcedde909d1bf02"
@@ -75,6 +76,10 @@ do_configure () {
 	${EXTRA_OECONF}
 }
 
+do_compile_prepend_libc-musl () {
+	sed -i 's/^#define HAVE_MALLOC_H.*//' ${B}/config.h
+}
+
 # Install the init script, it's default file, and the extraneous
 # documentation.
 do_install_append () {
-- 
2.7.4




More information about the yocto mailing list