[yocto] [meta-security][PATCH 4/6] samhain: fix build issues when using musl

Khem Raj raj.khem at gmail.com
Wed Mar 22 07:36:28 PDT 2017


On Wed, Mar 22, 2017 at 5:46 AM, Armin Kuster <akuster808 at gmail.com> wrote:
> musl does not supply malloc.

it does provide malloc but it does not provide mallinfo() which is
glibc specific

> also c99 fix
>
> 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 | 27 +++++++++++++++++++++++
>  recipes-security/samhain/samhain.inc              |  1 +
>  2 files changed, 28 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..397a1f1
> --- /dev/null
> +++ b/recipes-security/samhain/files/c99_dnmalloc.patch
> @@ -0,0 +1,27 @@
> +samhain: musl build fix
> +
> +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
> +@@ -821,7 +821,7 @@ extern Void_t*     sbrk();
> + /* On *BSD, malloc.h is deprecated, and on some *BSD including
> +  * it may actually raise an error.
> +  */
> +-#if defined(HAVE_MALLOC_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
> ++#if defined(HAVE_MALLOC_H) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && defined(__GLIBC__)
> + #include <malloc.h>
> + #else
> +
> +@@ -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..e69bb35 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"
> --
> 2.7.4
>
> --
> _______________________________________________
> yocto mailing list
> yocto at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/yocto



More information about the yocto mailing list