diff options
Diffstat (limited to 'meta/recipes-devtools/pseudo')
-rwxr-xr-x | meta/recipes-devtools/pseudo/files/build-oldlibc | 20 | ||||
-rw-r--r-- | meta/recipes-devtools/pseudo/files/glibc238.patch | 65 | ||||
-rw-r--r-- | meta/recipes-devtools/pseudo/files/moreretries.patch | 19 | ||||
-rw-r--r-- | meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch | 57 | ||||
-rw-r--r-- | meta/recipes-devtools/pseudo/files/toomanyfiles.patch | 71 | ||||
-rw-r--r-- | meta/recipes-devtools/pseudo/pseudo.inc | 46 | ||||
-rw-r--r-- | meta/recipes-devtools/pseudo/pseudo_git.bb | 25 |
7 files changed, 193 insertions, 110 deletions
diff --git a/meta/recipes-devtools/pseudo/files/build-oldlibc b/meta/recipes-devtools/pseudo/files/build-oldlibc new file mode 100755 index 0000000000..85c438de4e --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/build-oldlibc @@ -0,0 +1,20 @@ +#!/bin/sh +# +# Script to re-generate pseudo-prebuilt-2.33.tar.xz +# +# Copyright (C) 2021 Richard Purdie +# +# SPDX-License-Identifier: GPL-2.0-only +# + +for i in x86_64 aarch64 i686; do + if [ ! -e $i-nativesdk-libc.tar.xz ]; then + wget http://downloads.yoctoproject.org/releases/uninative/3.2/$i-nativesdk-libc.tar.xz + fi + tar -xf $i-nativesdk-libc.tar.xz --wildcards \*/lib/libpthread\* \*/lib/libdl\* + cd $i-linux/lib + ln -s libdl.so.2 libdl.so + ln -s libpthread.so.0 libpthread.so + cd ../.. +done +tar -cJf pseudo-prebuilt-2.33.tar.xz *-linux
\ No newline at end of file diff --git a/meta/recipes-devtools/pseudo/files/glibc238.patch b/meta/recipes-devtools/pseudo/files/glibc238.patch new file mode 100644 index 0000000000..dfb5c283f6 --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/glibc238.patch @@ -0,0 +1,65 @@ +glibc 2.38 would include __isoc23_strtol and similar symbols. This is trggerd by +_GNU_SOURCE but we have to set that for other definitions. Therefore play with defines +to turn this off within pseudo_wrappers.c. Elsewhere we can switch to _DEFAULT_SOURCE +rather than _GNU_SOURCE. + +Upstream-Status: Pending + +Index: git/pseudo_wrappers.c +=================================================================== +--- git.orig/pseudo_wrappers.c ++++ git/pseudo_wrappers.c +@@ -6,6 +6,18 @@ + * SPDX-License-Identifier: LGPL-2.1-only + * + */ ++/* glibc 2.38 would include __isoc23_strtol and similar symbols. This is trggerd by ++ * _GNU_SOURCE but we have to set that for other definitions. Therefore play with defines ++ * to turn this off. ++ */ ++#include <features.h> ++#undef __GLIBC_USE_ISOC2X ++#undef __GLIBC_USE_C2X_STRTOL ++#define __GLIBC_USE_C2X_STRTOL 0 ++#undef __GLIBC_USE_ISOC23 ++#undef __GLIBC_USE_C23_STRTOL ++#define __GLIBC_USE_C23_STRTOL 0 ++ + #include <assert.h> + #include <stdlib.h> + #include <limits.h> +Index: git/pseudo_util.c +=================================================================== +--- git.orig/pseudo_util.c ++++ git/pseudo_util.c +@@ -8,6 +8,17 @@ + */ + /* we need access to RTLD_NEXT for a horrible workaround */ + #define _GNU_SOURCE ++/* glibc 2.38 would include __isoc23_strtol and similar symbols. This is trggerd by ++ * _GNU_SOURCE but we have to set that for other definitions. Therefore play with defines ++ * to turn this off. ++ */ ++#include <features.h> ++#undef __GLIBC_USE_ISOC2X ++#undef __GLIBC_USE_C2X_STRTOL ++#define __GLIBC_USE_C2X_STRTOL 0 ++#undef __GLIBC_USE_ISOC23 ++#undef __GLIBC_USE_C23_STRTOL ++#define __GLIBC_USE_C23_STRTOL 0 + + #include <ctype.h> + #include <errno.h> +Index: git/pseudo_client.c +=================================================================== +--- git.orig/pseudo_client.c ++++ git/pseudo_client.c +@@ -6,7 +6,7 @@ + * SPDX-License-Identifier: LGPL-2.1-only + * + */ +-#define _GNU_SOURCE ++#define _DEFAULT_SOURCE + + #include <stdio.h> + #include <signal.h> diff --git a/meta/recipes-devtools/pseudo/files/moreretries.patch b/meta/recipes-devtools/pseudo/files/moreretries.patch deleted file mode 100644 index adea2665b0..0000000000 --- a/meta/recipes-devtools/pseudo/files/moreretries.patch +++ /dev/null @@ -1,19 +0,0 @@ -Increase the number of retries in pseudo due to occasional slow -server shutdowns. - -Upstream-Status: Pending -RP 2016/2/28 - -Index: git/pseudo_client.c -=================================================================== ---- git.orig/pseudo_client.c -+++ git/pseudo_client.c -@@ -1282,7 +1282,7 @@ pseudo_client_setup(void) { - } - } - --#define PSEUDO_RETRIES 20 -+#define PSEUDO_RETRIES 250 - static pseudo_msg_t * - pseudo_client_request(pseudo_msg_t *msg, size_t len, const char *path) { - pseudo_msg_t *response = 0; diff --git a/meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch b/meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch new file mode 100644 index 0000000000..c453b5f735 --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch @@ -0,0 +1,57 @@ +If we link against a newer glibc 2.34 and then try and our LD_PRELOAD is run against a +binary on a host with an older libc, we see symbol errors since in glibc 2.34, pthread +and dl are merged into libc itself. + +We need to use the older form of linking so use glibc binaries from an older release +to force this. We only use minimal symbols from these anyway. + +pthread_atfork is problematic, particularly on arm so use the internal glibc routine +it maps too. This was always present in the main libc from 2.3.2 onwards. + +Yes this is horrible. Better solutions welcome. + +There is more info in the bug: [YOCTO #14521] + +Upstream-Status: Inappropriate [this patch is native and nativesdk] +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> + +Tweak library search order, make prebuilt lib ahead of recipe lib +Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> +--- + Makefile.in | 2 +- + pseudo_wrappers.c | 5 ++++- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +--- a/Makefile.in ++++ b/Makefile.in +@@ -120,7 +120,7 @@ $(PSEUDODB): pseudodb.o $(SHOBJS) $(DBOBJS) pseudo_ipc.o | $(BIN) + libpseudo: $(LIBPSEUDO) + + $(LIBPSEUDO): $(WRAPOBJS) pseudo_client.o pseudo_ipc.o $(SHOBJS) | $(LIB) +- $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -shared -o $(LIBPSEUDO) \ ++ $(CC) $(CFLAGS) -Lprebuilt/$(shell uname -m)-linux/lib/ $(CFLAGS_PSEUDO) -shared -o $(LIBPSEUDO) \ + pseudo_client.o pseudo_ipc.o \ + $(WRAPOBJS) $(SHOBJS) $(LDFLAGS) $(CLIENT_LDFLAGS) + +diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c +--- a/pseudo_wrappers.c ++++ b/pseudo_wrappers.c +@@ -100,10 +100,13 @@ static void libpseudo_atfork_child(void) + pseudo_mutex_holder = 0; + } + ++extern void *__dso_handle; ++extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *); ++ + static void + _libpseudo_init(void) { + if (!_libpseudo_initted) +- pthread_atfork(NULL, NULL, libpseudo_atfork_child); ++ __register_atfork (NULL, NULL, libpseudo_atfork_child, &__dso_handle == NULL ? NULL : __dso_handle); + + pseudo_getlock(); + pseudo_antimagic(); +-- +2.27.0 + diff --git a/meta/recipes-devtools/pseudo/files/toomanyfiles.patch b/meta/recipes-devtools/pseudo/files/toomanyfiles.patch deleted file mode 100644 index bda7e4b202..0000000000 --- a/meta/recipes-devtools/pseudo/files/toomanyfiles.patch +++ /dev/null @@ -1,71 +0,0 @@ -From b0b25fbc041a148d1de09f5a6503cd95973ec77c Mon Sep 17 00:00:00 2001 -From: Richard Purdie <richard.purdie@linuxfoundation.org> -Date: Tue, 25 Apr 2017 15:25:54 +0100 -Subject: [PATCH 3/3] pseudo: Handle too many files deadlock - -Currently if we max out the maximum number of files, pseudo can deadlock, unable to -accept new connections yet unable to move forward and unblock the other processes -waiting either. - -Rather than hang, when this happens, close out inactive connections, allowing us -to accept the new ones. The disconnected clients will simply reconnect. There is -a small risk of data loss here sadly but its better than hanging. - -RP -2017/4/25 - -Upstream-Status: Submitted [Peter is aware of the issue] - ---- - pseudo_server.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/pseudo_server.c b/pseudo_server.c -index dac3258..15a3e8f 100644 ---- a/pseudo_server.c -+++ b/pseudo_server.c -@@ -802,6 +802,7 @@ pseudo_server_loop(void) { - struct sigaction eat_usr2 = { - .sa_handler = set_do_list_clients - }; -+ int hitmaxfiles; - - clients = malloc(16 * sizeof(*clients)); - -@@ -820,6 +821,7 @@ pseudo_server_loop(void) { - active_clients = 1; - max_clients = 16; - highest_client = 0; -+ hitmaxfiles = 0; - - pseudo_debug(PDBGF_SERVER, "server loop started.\n"); - if (listen_fd < 0) { -@@ -878,10 +880,15 @@ pseudo_server_loop(void) { - } else { - serve_client(i); - } -+ } else if (hitmaxfiles) { -+ /* Only close one per loop iteration in the interests of caution */ -+ close_client(i); -+ hitmaxfiles = 0; - } - if (die_forcefully) - break; - } -+ hitmaxfiles = 0; - if (!die_forcefully && - (FD_ISSET(clients[0].fd, &events) || - FD_ISSET(clients[0].fd, &reads))) { -@@ -903,6 +910,9 @@ pseudo_server_loop(void) { - */ - pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT; - die_peacefully = 0; -+ } else if (errno == EMFILE) { -+ hitmaxfiles = 1; -+ pseudo_debug(PDBGF_SERVER, "Hit max open files, dropping a client.\n"); - } - } - pseudo_debug(PDBGF_SERVER, "server loop complete [%d clients left]\n", active_clients); --- -2.15.1 - diff --git a/meta/recipes-devtools/pseudo/pseudo.inc b/meta/recipes-devtools/pseudo/pseudo.inc index cdc2a5823f..36283ffa74 100644 --- a/meta/recipes-devtools/pseudo/pseudo.inc +++ b/meta/recipes-devtools/pseudo/pseudo.inc @@ -4,36 +4,38 @@ SUMMARY = "Pseudo gives fake root capabilities to a normal user" HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/pseudo" -LIC_FILES_CHKSUM = "file://COPYING;md5=243b725d71bb5df4a1e5920b344b86ad" +DESCRIPTION = "The pseudo utility offers a way to run commands in a virtualized root environment." +LIC_FILES_CHKSUM = "file://COPYING;md5=a1d8023a6f953ac6ea4af765ff62d574" SECTION = "base" -LICENSE = "LGPL2.1" +LICENSE = "LGPL-2.1-only" DEPENDS = "sqlite3 attr" -FILES_${PN} = "${prefix}/lib/pseudo/lib*/libpseudo.so ${bindir}/* ${localstatedir}/pseudo ${prefix}/var/pseudo" -INSANE_SKIP_${PN} += "libdir" -INSANE_SKIP_${PN}-dbg += "libdir" +FILES:${PN} = "${prefix}/lib/pseudo/lib*/libpseudo.so ${bindir}/* ${localstatedir}/pseudo ${prefix}/var/pseudo" +INSANE_SKIP:${PN} += "libdir" +INSANE_SKIP:${PN}-dbg += "libdir" PROVIDES += "virtual/fakeroot" MAKEOPTS = "" +MAKEOPTS:class-native = "'RPATH=-Wl,--rpath=XORIGIN/../../../sqlite3-native/usr/lib/'" -inherit siteinfo +inherit siteinfo pkgconfig do_configure () { : } NO32LIBS ??= "1" -NO32LIBS_class-nativesdk = "1" +NO32LIBS:class-nativesdk = "1" PSEUDO_EXTRA_OPTS ?= "--enable-force-async --without-passwd-fallback --enable-epoll --enable-xattr" # Compile for the local machine arch... do_compile () { if [ "${SITEINFO_BITS}" = "64" ]; then - ${S}/configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib${SITEINFO_BITS} --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --cflags="${CFLAGS}" --bits=${SITEINFO_BITS} --enable-static-sqlite --without-rpath + ${S}/configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib${SITEINFO_BITS} --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --cflags="${CFLAGS}" --bits=${SITEINFO_BITS} --without-rpath else - ${S}/configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --cflags="${CFLAGS}" --bits=${SITEINFO_BITS} --enable-static-sqlite --without-rpath + ${S}/configure ${PSEUDO_EXTRA_OPTS} --prefix=${prefix} --libdir=${prefix}/lib/pseudo/lib --with-sqlite-lib=${baselib} --with-sqlite=${STAGING_DIR_TARGET}${exec_prefix} --cflags="${CFLAGS}" --bits=${SITEINFO_BITS} --without-rpath fi oe_runmake ${MAKEOPTS} } @@ -77,7 +79,7 @@ warn_32bit_missing() { # Two below are the same # If necessary compile for the alternative machine arch. This is only # necessary in a native build. -do_compile_prepend_class-native () { +do_compile:prepend:class-native () { maybe_make32 if $make32; then # We need the 32-bit libpseudo on a 64-bit machine... @@ -98,7 +100,7 @@ do_compile_prepend_class-native () { fi } -do_compile_prepend_class-nativesdk () { +do_compile:prepend:class-nativesdk () { maybe_make32 if $make32; then # We need the 32-bit libpseudo on a 64-bit machine. @@ -110,15 +112,29 @@ do_compile_prepend_class-nativesdk () { fi } +do_compile:append:class-native () { + if [ '${@bb.data.inherits_class('uninative', d)}' = 'True' ]; then + for i in PSEUDO_PORT_UNIX_SYNCFS PSEUDO_PORT_UIDS_GENERIC PSEUDO_PORT_LINUX_NEWCLONE PSEUDO_PORT_LINUX_XATTR PSEUDO_PORT_LINUX_STATVFS; do + grep $i.1 ${S}/pseudo_ports.h + if [ $? != 0 ]; then + echo "$i not enabled in pseudo which is incompatible with uninative" + exit 1 + fi + done + fi +} + + do_install () { oe_runmake 'DESTDIR=${D}' ${MAKEOPTS} 'LIB=lib/pseudo/lib$(MARK64)' install } -do_install_append_class-native () { +do_install:append:class-native () { + chrpath ${D}${bindir}/pseudo -r `chrpath ${D}${bindir}/pseudo | cut -d = -f 2 | sed s/XORIGIN/\\$ORIGIN/` install -d ${D}${sysconfdir} # The fallback files should never be modified - install -m 444 ${WORKDIR}/fallback-passwd ${D}${sysconfdir}/passwd - install -m 444 ${WORKDIR}/fallback-group ${D}${sysconfdir}/group + install -m 444 ${UNPACKDIR}/fallback-passwd ${D}${sysconfdir}/passwd + install -m 444 ${UNPACKDIR}/fallback-group ${D}${sysconfdir}/group # Two native/nativesdk entries below are the same # If necessary install for the alternative machine arch. This is only @@ -130,7 +146,7 @@ do_install_append_class-native () { fi } -do_install_append_class-nativesdk () { +do_install:append:class-nativesdk () { maybe_make32 if $make32; then mkdir -p ${D}${prefix}/lib/pseudo/lib diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb index 79e0b6bd21..7d8f71f65d 100644 --- a/meta/recipes-devtools/pseudo/pseudo_git.bb +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb @@ -1,14 +1,29 @@ require pseudo.inc -SRC_URI = "git://git.yoctoproject.org/pseudo \ +SRC_URI = "git://git.yoctoproject.org/pseudo;branch=master;protocol=https \ file://0001-configure-Prune-PIE-flags.patch \ + file://glibc238.patch \ file://fallback-passwd \ file://fallback-group \ - file://moreretries.patch \ - file://toomanyfiles.patch \ " +SRC_URI:append:class-native = " \ + http://downloads.yoctoproject.org/mirror/sources/pseudo-prebuilt-2.33.tar.xz;subdir=git/prebuilt;name=prebuilt \ + file://older-glibc-symbols.patch" +SRC_URI:append:class-nativesdk = " \ + http://downloads.yoctoproject.org/mirror/sources/pseudo-prebuilt-2.33.tar.xz;subdir=git/prebuilt;name=prebuilt \ + file://older-glibc-symbols.patch" +SRC_URI[prebuilt.sha256sum] = "ed9f456856e9d86359f169f46a70ad7be4190d6040282b84c8d97b99072485aa" -SRCREV = "6294b344e5140f5467e6860f45a174440015304e" +SRCREV = "374089f2ed83da4d0d4e58df067142ff99c7eb12" S = "${WORKDIR}/git" -PV = "1.9.0+git${SRCPV}" +PV = "1.9.0+git" +# largefile and 64bit time_t support adds these macros via compiler flags globally +# remove them for pseudo since pseudo intercepts some of the functions which will be +# aliased due to this e.g. open/open64 and it will complain about duplicate definitions +# pseudo on 32bit systems is not much of use anyway and these features are not of much +# use for it. +TARGET_CC_ARCH:remove = "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64" + +# error: use of undeclared identifier '_STAT_VER' +COMPATIBLE_HOST:libc-musl = 'null' |