Skip to contentSkip to conversation

tpm-tools: updatet 1.3.9.1

PATCH In review Armin Kuster 2 participants 7 messages Mar 22, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 tpm-tools: updatet 1.3.9.1

---
 recipes-tpm/tpm-tools/tpm-tools_git.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
recipes-tpm/tpm-tools/tpm-tools_git.bb +2 -2
index 83f1091..f670bff 100644
@@ -12,13 +12,13 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=059e8cd6165cb4c31e351f2b69388fd9"
 DEPENDS = "libtspi openssl"
 DEPENDS_class-native = "trousers-native"
 
-SRCREV = "80954ab83be8d091c6e3112514945556aaa09d39"
+SRCREV = "5c5126bedf2da97906358adcfb8c43c86e7dd0ee"
 SRC_URI = " \
 	git://git.code.sf.net/p/trousers/tpm-tools \
 	file://tpm-tools-extendpcr.patch \
 	"
 
-PV = "1.3.9+git${SRCPV}"
+PV = "1.3.9.1+git${SRCPV}"
 
 inherit autotools-brokensep gettext
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 2/6 swtpm: fix musl build issues

add two fixes for musl build issues.

also update to latest tip

---
 recipes-tpm/swtpm/files/fix_fcntl_h.patch | 21 +++++++++++++++++++++
 recipes-tpm/swtpm/files/ioctl_h.patch     | 22 ++++++++++++++++++++++
 recipes-tpm/swtpm/swtpm_1.0.bb            |  4 +++-
 3 files changed, 46 insertions(+), 1 deletion(-)
 create mode 100644 recipes-tpm/swtpm/files/fix_fcntl_h.patch
 create mode 100644 recipes-tpm/swtpm/files/ioctl_h.patch
recipes-tpm/swtpm/files/fix_fcntl_h.patch new file +21 -0
new file mode 100644
index 0000000..e844045
@@ -0,0 +1,21 @@
+logging: Fix musl build issue with fcntl
+
+ error: #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.h> [-Werror=cpp]
+ #warning redirecting incorrect #include <sys/fcntl.h> to <fcntl.
+
+Upstream-Status: Pending
+Signed-off-by: Armin Kuster <[email protected]>
+
+Index: git/src/swtpm/logging.c
+===================================================================
+--- git.orig/src/swtpm/logging.c
++++ git/src/swtpm/logging.c
+@@ -43,7 +43,7 @@
+ #include <errno.h>
+ #include <string.h>
+ #include <sys/types.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <stdarg.h>
recipes-tpm/swtpm/files/ioctl_h.patch new file +22 -0
new file mode 100644
index 0000000..d736bc6
@@ -0,0 +1,22 @@
+tpm_ioctl: fix musl for missing ioctl
+
+tpm_ioctl.c: In function 'ioctl_to_cmd':
+tpm_ioctl.c:86:26: error: '_IOC_NRSHIFT' undeclared (first use in this function)
+     return ((ioctlnum >> _IOC_NRSHIFT) & _IOC_NRMASK) + 1;
+
+
+Upstream-status:
+Signed-off-by: Armin Kuster <[email protected]>
+
+Index: git/src/swtpm_ioctl/tpm_ioctl.c
+===================================================================
+--- git.orig/src/swtpm_ioctl/tpm_ioctl.c
++++ git/src/swtpm_ioctl/tpm_ioctl.c
+@@ -58,6 +58,7 @@
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <sys/ioctl.h>
++#include <asm/ioctl.h>
+ #include <getopt.h>
+ #include <sys/un.h>
+ #include <sys/types.h>
recipes-tpm/swtpm/swtpm_1.0.bb +3 -1
index 7b9662a..99c6fdc 100644
@@ -10,11 +10,13 @@ DEPENDS = "libtasn1 fuse expect socat glib-2.0 libtpm libtpm-native"
 DEPENDS += "tpm-tools-native expect-native socat-native"
 RDEPENDS_${PN} += "tpm-tools"
 
-SRCREV = "65d8e4d83447f4c13a41a6f995bd0490f49bc5ef"
+SRCREV = "d7bbe3de5cc58c1dca41149df89cfdc08019a722"
 SRC_URI = " \
 	git://github.com/stefanberger/swtpm.git \
 	file://fix_signed_issue.patch \
 	file://fix_lib_search_path.patch \
+        file://fix_fcntl_h.patch \
+        file://ioctl_h.patch \
 	"
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.7.4
#2 lore raw

PATCH 3/6 trousers: Fix musl compile error

In reply to Armin Kuster

use POSIX getpwent instead of getpwent_r
This was causing the libtspi to have the getpwent_r with when loaded via tpm-tools, it would fail.

[ Yocto #11095]

---
 ...path-use-POSIX-getpwent-instead-of-getpwe.patch | 49 ++++++++++++++++++++++
 recipes-tpm/trousers/trousers_git.bb               |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 recipes-tpm/trousers/files/get-user-ps-path-use-POSIX-getpwent-instead-of-getpwe.patch
recipes-tpm/trousers/files/get-user-ps-path-use-POSIX-getpwent-instead-of-getpwe.patch new file +49 -0
new file mode 100644
index 0000000..3f5a144
@@ -0,0 +1,49 @@
+trousers: fix compiling with musl
+
+use POSIX getpwent instead of getpwent_r
+
+Upstream-Status: Submitted
+
+Signed-off-by: Armin Kuster <[email protected]>
+
+Index: git/src/tspi/ps/tspps.c
+===================================================================
+--- git.orig/src/tspi/ps/tspps.c
++++ git/src/tspi/ps/tspps.c
+@@ -66,9 +66,6 @@ get_user_ps_path(char **file)
+ 	TSS_RESULT result;
+ 	char *file_name = NULL, *home_dir = NULL;
+ 	struct passwd *pwp;
+-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
+-	struct passwd pw;
+-#endif
+ 	struct stat stat_buf;
+ 	char buf[PASSWD_BUFSIZE];
+ 	uid_t euid;
+@@ -96,24 +93,15 @@ get_user_ps_path(char **file)
+ #else
+ 	setpwent();
+ 	while (1) {
+-#if (defined (__linux) || defined (linux) || defined(__GLIBC__))
+-		rc = getpwent_r(&pw, buf, PASSWD_BUFSIZE, &pwp);
+-		if (rc) {
+-			LogDebugFn("USER PS: Error getting path to home directory: getpwent_r: %s",
+-				   strerror(rc));
+-			endpwent();
+-			return TSPERR(TSS_E_INTERNAL_ERROR);
+-		}
+-
+-#elif (defined (__FreeBSD__) || defined (__OpenBSD__))
+ 		if ((pwp = getpwent()) == NULL) {
+ 			LogDebugFn("USER PS: Error getting path to home directory: getpwent: %s",
+                                    strerror(rc));
+ 			endpwent();
++#if (defined (__FreeBSD__) || defined (__OpenBSD__))
+ 			MUTEX_UNLOCK(user_ps_path);
++#endif
+ 			return TSPERR(TSS_E_INTERNAL_ERROR);
+ 		}
+-#endif
+ 		if (euid == pwp->pw_uid) {
+                         home_dir = strdup(pwp->pw_dir);
+                         break;
recipes-tpm/trousers/trousers_git.bb +1 -0
index 6671808..352374c 100644
@@ -14,6 +14,7 @@ SRC_URI = " \
     	file://trousers.init.sh \
     	file://trousers-udev.rules \
     	file://tcsd.service \
+        file://get-user-ps-path-use-POSIX-getpwent-instead-of-getpwe.patch \
     	"
 
 S = "${WORKDIR}/git"
Signature · 1 line
2.7.4
#3 lore raw

PATCH 4/6 samhain: fix build issues when using musl

In reply to Armin Kuster

musl does not supply malloc.
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)]; | ^~~~~

---
 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
recipes-security/samhain/files/c99_dnmalloc.patch new file +27 -0
new file mode 100644
index 0000000..397a1f1
@@ -0,0 +1,27 @@
+samhain: musl build fix
+
+Upstream-Status: Submitted
+Signed-off-by: Armin Kuster <[email protected]>
+
+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;
recipes-security/samhain/samhain.inc +1 -0
index 789150b..e69bb35 100644
@@ -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"
Signature · 1 line
2.7.4
#4 lore raw

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

Quoted 1 line · Armin Kuster

musl does not supply malloc.

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

Quoted 73 lines

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)]; | ^~~~~

---
 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
recipes-security/samhain/files/c99_dnmalloc.patch new file +27 -0
new file mode 100644
index 0000000..397a1f1
@@ -0,0 +1,27 @@
+samhain: musl build fix
+
+Upstream-Status: Submitted
+Signed-off-by: Armin Kuster <[email protected]>
+
+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;
recipes-security/samhain/samhain.inc +1 -1
index 789150b..e69bb35 100644
@@ -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
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#5 lore raw

PATCH 5/6 samhain-server: fix config error with acl

In reply to Armin Kuster

when acl is enabled this error occurrs.
configure: error: in `/home/akuster/oss/maint/openembedded-core/build/tmp-glibc/work/x86_64-linux/samhain-server-native/4.2.0-r0/samhain-4.2.0':
| configure: error: --enable-posix-acl was given, but test for acl support failed

add missing depends.

---
 recipes-security/samhain/samhain-server_4.2.0.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
recipes-security/samhain/samhain-server_4.2.0.bb +2 -2
index 35f8775..7ef84db 100644
@@ -20,8 +20,8 @@ PACKAGECONFIG[logwatch]  = "--enable-login-watch,"" , "
 PACKAGECONFIG[mounts]  = "--enable-mounts-check","" , "
 PACKAGECONFIG[userfiles]  = "--enable-userfiles","" , "
 PACKAGECONFIG[ipv6]  = "--enable-ipv6,"--disable-ipv6","
-PACKAGECONFIG[selinux] = "--enable-selinux, --disable-selinux"
-PACKAGECONFIG[acl] = " --enable-posix-acl , --disable-posix-acl"
+PACKAGECONFIG[selinux] = "--enable-selinux, --disable-selinux, libselinux"
+PACKAGECONFIG[acl] = " --enable-posix-acl , --disable-posix-acl, acl"
 
 SRC_URI += "file://samhain-server-volatiles"
 
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/6 build-image: remove ROOTFS_PKGMANAGE_BOOTSTRAP

In reply to Armin Kuster
---
 recipes-security/images/security-build-image.bb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-security/images/security-build-image.bb +1 -1
index 6745338..1a7af86 100644
@@ -8,7 +8,7 @@ IMAGE_INSTALL = "\
     packagegroup-core-security \
     os-release \
     ${@bb.utils.contains("DISTRO_FEATURES", "x11", "packagegroup-xfce-base", "", d)} \
-    ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
+    ${CORE_IMAGE_EXTRA_INSTALL}"
 
 IMAGE_LINGUAS ?= " "
 
Signature · 1 line
2.7.4