From d5126e2e728319a8a72dec055477fd79e4218248 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Tue, 5 May 2020 15:01:16 +0200 Subject: libcap: update to 2.33 Signed-off-by: Alexander Kanavin Signed-off-by: Richard Purdie --- .../0001-tests-do-not-statically-link-a-test.patch | 32 +++++++-- ...ce-pthread_yield-with-standard-sched_yiel.patch | 24 +++++++ meta/recipes-support/libcap/libcap_2.32.bb | 77 --------------------- meta/recipes-support/libcap/libcap_2.33.bb | 78 ++++++++++++++++++++++ 4 files changed, 128 insertions(+), 83 deletions(-) create mode 100644 meta/recipes-support/libcap/files/0004-psx.c-replace-pthread_yield-with-standard-sched_yiel.patch delete mode 100644 meta/recipes-support/libcap/libcap_2.32.bb create mode 100644 meta/recipes-support/libcap/libcap_2.33.bb diff --git a/meta/recipes-support/libcap/files/0001-tests-do-not-statically-link-a-test.patch b/meta/recipes-support/libcap/files/0001-tests-do-not-statically-link-a-test.patch index e568cc47c5..912f33f165 100644 --- a/meta/recipes-support/libcap/files/0001-tests-do-not-statically-link-a-test.patch +++ b/meta/recipes-support/libcap/files/0001-tests-do-not-statically-link-a-test.patch @@ -1,4 +1,4 @@ -From 1179b423cce8d119b42cebfb3daa77c540fdca43 Mon Sep 17 00:00:00 2001 +From 24d59c99bcba065f1f40f49f870a5f6483b4b078 Mon Sep 17 00:00:00 2001 From: Alexander Kanavin Date: Wed, 15 Jan 2020 17:16:28 +0100 Subject: [PATCH] tests: do not statically link a test @@ -7,20 +7,40 @@ This fails on e.g. centos 7 Upstream-Status: Inappropriate [oe-core specific] Signed-off-by: Alexander Kanavin + --- - tests/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + tests/Makefile | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Makefile b/tests/Makefile -index 7162cf0..6af47af 100644 +index f9cec56..aa0d09b 100644 --- a/tests/Makefile +++ b/tests/Makefile -@@ -29,7 +29,7 @@ psx_test_wrap: psx_test.c $(DEPS) +@@ -29,23 +29,23 @@ psx_test_wrap: psx_test.c $(DEPS) run_libcap_psx_test: libcap_psx_test libcap_psx_test: libcap_psx_test.c $(DEPS) - $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBCAPLIB) $(LIBPSXLIB) -Wl,-wrap,pthread_create --static + $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBCAPLIB) $(LIBPSXLIB) -Wl,-wrap,pthread_create + run_libcap_launch_test: libcap_launch_test libcap_psx_launch_test noop + sudo ./libcap_launch_test + sudo ./libcap_psx_launch_test + + libcap_launch_test: libcap_launch_test.c $(DEPS) +- $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBCAPLIB) --static ++ $(CC) $(CFLAGS) $(IPATH) $< -o $@ $(LIBCAPLIB) + + # this varies only slightly from the above insofar as it currently + # only links in the pthreads fork support. TODO() we need to change + # the source to do something interesting with pthreads. + libcap_psx_launch_test: libcap_launch_test.c $(DEPS) +- $(CC) $(CFLAGS) $(IPATH) -DWITH_PTHREADS $< -o $@ $(LIBCAPLIB) $(LIBPSXLIB) -Wl,-wrap,pthread_create --static ++ $(CC) $(CFLAGS) $(IPATH) -DWITH_PTHREADS $< -o $@ $(LIBCAPLIB) $(LIBPSXLIB) -Wl,-wrap,pthread_create + + noop: noop.c +- $(CC) $(CFLAGS) $< -o $@ --static ++ $(CC) $(CFLAGS) $< -o $@ + clean: - rm -f psx_test psx_test_wrap libcap_psx_test + rm -f psx_test psx_test_wrap libcap_psx_test libcap_launch_test *~ diff --git a/meta/recipes-support/libcap/files/0004-psx.c-replace-pthread_yield-with-standard-sched_yiel.patch b/meta/recipes-support/libcap/files/0004-psx.c-replace-pthread_yield-with-standard-sched_yiel.patch new file mode 100644 index 0000000000..848ceb2c0c --- /dev/null +++ b/meta/recipes-support/libcap/files/0004-psx.c-replace-pthread_yield-with-standard-sched_yiel.patch @@ -0,0 +1,24 @@ +From a2c4cdb05d0e382101b13944c09c4375e8d7de5f Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin +Date: Tue, 31 Mar 2020 13:39:28 +0200 +Subject: [PATCH] psx.c: replace pthread_yield() with standard sched_yield() + +This was causing failures when building with musl C library in +particular. + +Upstream-Status: Pending +Signed-off-by: Alexander Kanavin +--- +diff --git a/libcap/psx.c b/libcap/psx.c +index 04d250f..7e4ac10 100644 +--- a/libcap/psx.c ++++ b/libcap/psx.c +@@ -533,7 +533,7 @@ long int __psx_syscall(long int syscall_nr, ...) { + if (!waiting) { + break; + } +- pthread_yield(); ++ sched_yield(); + } + + errno = restore_errno; diff --git a/meta/recipes-support/libcap/libcap_2.32.bb b/meta/recipes-support/libcap/libcap_2.32.bb deleted file mode 100644 index d78a58f7d2..0000000000 --- a/meta/recipes-support/libcap/libcap_2.32.bb +++ /dev/null @@ -1,77 +0,0 @@ -SUMMARY = "Library for getting/setting POSIX.1e capabilities" -HOMEPAGE = "http://sites.google.com/site/fullycapable/" - -# no specific GPL version required -LICENSE = "BSD | GPLv2" -LIC_FILES_CHKSUM = "file://License;md5=3f84fd6f29d453a56514cb7e4ead25f1" - -DEPENDS = "hostperl-runtime-native gperf-native" - -SRC_URI = "${KERNELORG_MIRROR}/linux/libs/security/linux-privs/${BPN}2/${BPN}-${PV}.tar.xz \ - file://0001-ensure-the-XATTR_NAME_CAPS-is-defined-when-it-is-use.patch \ - file://0002-tests-do-not-run-target-executables.patch \ - file://0001-tests-do-not-statically-link-a-test.patch \ - " -SRC_URI[md5sum] = "7416119c9fdcfd0e8dd190a432c668e9" -SRC_URI[sha256sum] = "1005e3d227f2340ad1e3360ef8b69d15e3c72a29c09f4894d7aac038bd26e2be" - -UPSTREAM_CHECK_URI = "https://www.kernel.org/pub/linux/libs/security/linux-privs/${BPN}2/" - -inherit lib_package - -# do NOT pass target cflags to host compilations -# -do_configure() { - # libcap uses := for compilers, fortunately, it gives us a hint - # on what should be replaced with ?= - sed -e 's,:=,?=,g' -i Make.Rules - sed -e 's,^BUILD_CFLAGS ?= $(.*CFLAGS),BUILD_CFLAGS := $(BUILD_CFLAGS),' -i Make.Rules -} - -PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" -PACKAGECONFIG_class-native ??= "" - -PACKAGECONFIG[pam] = "PAM_CAP=yes,PAM_CAP=no,libpam" - -EXTRA_OEMAKE = " \ - INDENT= \ - lib='${baselib}' \ - RAISE_SETFCAP=no \ - DYNAMIC=yes \ - BUILD_GPERF=yes \ -" - -EXTRA_OEMAKE_append_class-target = " SYSTEM_HEADERS=${STAGING_INCDIR}" - -# these are present in the libcap defaults, so include in our CFLAGS too -CFLAGS += "-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" - -do_compile() { - oe_runmake ${PACKAGECONFIG_CONFARGS} -} - -do_install() { - oe_runmake install \ - ${PACKAGECONFIG_CONFARGS} \ - DESTDIR="${D}" \ - prefix="${prefix}" \ - SBINDIR="${sbindir}" -} - -do_install_append() { - # Move the library to base_libdir - install -d ${D}${base_libdir} - if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then - mv ${D}${libdir}/libcap* ${D}${base_libdir} - if [ -d ${D}${libdir}/security ]; then - mv ${D}${libdir}/security ${D}${base_libdir} - fi - fi -} - -FILES_${PN}-dev += "${base_libdir}/*.so" - -# pam files -FILES_${PN} += "${base_libdir}/security/*.so" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-support/libcap/libcap_2.33.bb b/meta/recipes-support/libcap/libcap_2.33.bb new file mode 100644 index 0000000000..bec492ca5f --- /dev/null +++ b/meta/recipes-support/libcap/libcap_2.33.bb @@ -0,0 +1,78 @@ +SUMMARY = "Library for getting/setting POSIX.1e capabilities" +HOMEPAGE = "http://sites.google.com/site/fullycapable/" + +# no specific GPL version required +LICENSE = "BSD | GPLv2" +LIC_FILES_CHKSUM = "file://License;md5=3f84fd6f29d453a56514cb7e4ead25f1" + +DEPENDS = "hostperl-runtime-native gperf-native" + +SRC_URI = "${KERNELORG_MIRROR}/linux/libs/security/linux-privs/${BPN}2/${BPN}-${PV}.tar.xz \ + file://0001-ensure-the-XATTR_NAME_CAPS-is-defined-when-it-is-use.patch \ + file://0002-tests-do-not-run-target-executables.patch \ + file://0001-tests-do-not-statically-link-a-test.patch \ + file://0004-psx.c-replace-pthread_yield-with-standard-sched_yiel.patch \ + " +SRC_URI[md5sum] = "dcc6220b4a9bf260050b20c07edcddf4" +SRC_URI[sha256sum] = "08edeaba2757021aeec45c4eeec52566675e0e0f5d4f057284d729e04f2643d6" + +UPSTREAM_CHECK_URI = "https://www.kernel.org/pub/linux/libs/security/linux-privs/${BPN}2/" + +inherit lib_package + +# do NOT pass target cflags to host compilations +# +do_configure() { + # libcap uses := for compilers, fortunately, it gives us a hint + # on what should be replaced with ?= + sed -e 's,:=,?=,g' -i Make.Rules + sed -e 's,^BUILD_CFLAGS ?= $(.*CFLAGS),BUILD_CFLAGS := $(BUILD_CFLAGS),' -i Make.Rules +} + +PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" +PACKAGECONFIG_class-native ??= "" + +PACKAGECONFIG[pam] = "PAM_CAP=yes,PAM_CAP=no,libpam" + +EXTRA_OEMAKE = " \ + INDENT= \ + lib='${baselib}' \ + RAISE_SETFCAP=no \ + DYNAMIC=yes \ + BUILD_GPERF=yes \ +" + +EXTRA_OEMAKE_append_class-target = " SYSTEM_HEADERS=${STAGING_INCDIR}" + +# these are present in the libcap defaults, so include in our CFLAGS too +CFLAGS += "-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" + +do_compile() { + oe_runmake ${PACKAGECONFIG_CONFARGS} +} + +do_install() { + oe_runmake install \ + ${PACKAGECONFIG_CONFARGS} \ + DESTDIR="${D}" \ + prefix="${prefix}" \ + SBINDIR="${sbindir}" +} + +do_install_append() { + # Move the library to base_libdir + install -d ${D}${base_libdir} + if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then + mv ${D}${libdir}/libcap* ${D}${base_libdir} + if [ -d ${D}${libdir}/security ]; then + mv ${D}${libdir}/security ${D}${base_libdir} + fi + fi +} + +FILES_${PN}-dev += "${base_libdir}/*.so" + +# pam files +FILES_${PN} += "${base_libdir}/security/*.so" + +BBCLASSEXTEND = "native nativesdk" -- cgit 1.2.3-korg