summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/pseudo')
-rwxr-xr-xmeta/recipes-devtools/pseudo/files/build-oldlibc20
-rw-r--r--meta/recipes-devtools/pseudo/files/older-glibc-symbols.patch57
-rw-r--r--meta/recipes-devtools/pseudo/pseudo.inc14
-rw-r--r--meta/recipes-devtools/pseudo/pseudo_git.bb9
4 files changed, 99 insertions, 1 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 @@
1#!/bin/sh
2#
3# Script to re-generate pseudo-prebuilt-2.33.tar.xz
4#
5# Copyright (C) 2021 Richard Purdie
6#
7# SPDX-License-Identifier: GPL-2.0-only
8#
9
10for i in x86_64 aarch64 i686; do
11 if [ ! -e $i-nativesdk-libc.tar.xz ]; then
12 wget http://downloads.yoctoproject.org/releases/uninative/3.2/$i-nativesdk-libc.tar.xz
13 fi
14 tar -xf $i-nativesdk-libc.tar.xz --wildcards \*/lib/libpthread\* \*/lib/libdl\*
15 cd $i-linux/lib
16 ln -s libdl.so.2 libdl.so
17 ln -s libpthread.so.0 libpthread.so
18 cd ../..
19done
20tar -cJf pseudo-prebuilt-2.33.tar.xz *-linux \ No newline at end of file
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 @@
1If we link against a newer glibc 2.34 and then try and our LD_PRELOAD is run against a
2binary on a host with an older libc, we see symbol errors since in glibc 2.34, pthread
3and dl are merged into libc itself.
4
5We need to use the older form of linking so use glibc binaries from an older release
6to force this. We only use minimal symbols from these anyway.
7
8pthread_atfork is problematic, particularly on arm so use the internal glibc routine
9it maps too. This was always present in the main libc from 2.3.2 onwards.
10
11Yes this is horrible. Better solutions welcome.
12
13There is more info in the bug: [YOCTO #14521]
14
15Upstream-Status: Inappropriate [this patch is native and nativesdk]
16Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
17
18Tweak library search order, make prebuilt lib ahead of recipe lib
19Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
20---
21 Makefile.in | 2 +-
22 pseudo_wrappers.c | 5 ++++-
23 2 files changed, 5 insertions(+), 2 deletions(-)
24
25diff --git a/Makefile.in b/Makefile.in
26--- a/Makefile.in
27+++ b/Makefile.in
28@@ -120,7 +120,7 @@ $(PSEUDODB): pseudodb.o $(SHOBJS) $(DBOBJS) pseudo_ipc.o | $(BIN)
29 libpseudo: $(LIBPSEUDO)
30
31 $(LIBPSEUDO): $(WRAPOBJS) pseudo_client.o pseudo_ipc.o $(SHOBJS) | $(LIB)
32- $(CC) $(CFLAGS) $(CFLAGS_PSEUDO) -shared -o $(LIBPSEUDO) \
33+ $(CC) $(CFLAGS) -Lprebuilt/$(shell uname -m)-linux/lib/ $(CFLAGS_PSEUDO) -shared -o $(LIBPSEUDO) \
34 pseudo_client.o pseudo_ipc.o \
35 $(WRAPOBJS) $(SHOBJS) $(LDFLAGS) $(CLIENT_LDFLAGS)
36
37diff --git a/pseudo_wrappers.c b/pseudo_wrappers.c
38--- a/pseudo_wrappers.c
39+++ b/pseudo_wrappers.c
40@@ -100,10 +100,13 @@ static void libpseudo_atfork_child(void)
41 pseudo_mutex_holder = 0;
42 }
43
44+extern void *__dso_handle;
45+extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *);
46+
47 static void
48 _libpseudo_init(void) {
49 if (!_libpseudo_initted)
50- pthread_atfork(NULL, NULL, libpseudo_atfork_child);
51+ __register_atfork (NULL, NULL, libpseudo_atfork_child, &__dso_handle == NULL ? NULL : __dso_handle);
52
53 pseudo_getlock();
54 pseudo_antimagic();
55--
562.27.0
57
diff --git a/meta/recipes-devtools/pseudo/pseudo.inc b/meta/recipes-devtools/pseudo/pseudo.inc
index 50e30064bd..e6512bc6e6 100644
--- a/meta/recipes-devtools/pseudo/pseudo.inc
+++ b/meta/recipes-devtools/pseudo/pseudo.inc
@@ -4,6 +4,7 @@
4 4
5SUMMARY = "Pseudo gives fake root capabilities to a normal user" 5SUMMARY = "Pseudo gives fake root capabilities to a normal user"
6HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/pseudo" 6HOMEPAGE = "http://git.yoctoproject.org/cgit/cgit.cgi/pseudo"
7DESCRIPTION = "The pseudo utility offers a way to run commands in a virtualized root environment."
7LIC_FILES_CHKSUM = "file://COPYING;md5=a1d8023a6f953ac6ea4af765ff62d574" 8LIC_FILES_CHKSUM = "file://COPYING;md5=a1d8023a6f953ac6ea4af765ff62d574"
8SECTION = "base" 9SECTION = "base"
9LICENSE = "LGPL2.1" 10LICENSE = "LGPL2.1"
@@ -111,6 +112,19 @@ do_compile_prepend_class-nativesdk () {
111 fi 112 fi
112} 113}
113 114
115do_compile_append_class-native () {
116 if [ '${@bb.data.inherits_class('uninative', d)}' = 'True' ]; then
117 for i in PSEUDO_PORT_UNIX_SYNCFS PSEUDO_PORT_UIDS_GENERIC PSEUDO_PORT_LINUX_NEWCLONE PSEUDO_PORT_LINUX_XATTR PSEUDO_PORT_LINUX_STATVFS; do
118 grep $i.1 ${S}/pseudo_ports.h
119 if [ $? != 0 ]; then
120 echo "$i not enabled in pseudo which is incompatible with uninative"
121 exit 1
122 fi
123 done
124 fi
125}
126
127
114do_install () { 128do_install () {
115 oe_runmake 'DESTDIR=${D}' ${MAKEOPTS} 'LIB=lib/pseudo/lib$(MARK64)' install 129 oe_runmake 'DESTDIR=${D}' ${MAKEOPTS} 'LIB=lib/pseudo/lib$(MARK64)' install
116} 130}
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb
index 17bd02c27c..b5da3f0e29 100644
--- a/meta/recipes-devtools/pseudo/pseudo_git.bb
+++ b/meta/recipes-devtools/pseudo/pseudo_git.bb
@@ -5,8 +5,15 @@ SRC_URI = "git://git.yoctoproject.org/pseudo;branch=oe-core \
5 file://fallback-passwd \ 5 file://fallback-passwd \
6 file://fallback-group \ 6 file://fallback-group \
7 " 7 "
8SRC_URI:append:class-native = " \
9 http://downloads.yoctoproject.org/mirror/sources/pseudo-prebuilt-2.33.tar.xz;subdir=git/prebuilt;name=prebuilt \
10 file://older-glibc-symbols.patch"
11SRC_URI:append:class-nativesdk = " \
12 http://downloads.yoctoproject.org/mirror/sources/pseudo-prebuilt-2.33.tar.xz;subdir=git/prebuilt;name=prebuilt \
13 file://older-glibc-symbols.patch"
14SRC_URI[prebuilt.sha256sum] = "ed9f456856e9d86359f169f46a70ad7be4190d6040282b84c8d97b99072485aa"
8 15
9SRCREV = "60e25a36558f1f07dcce1a044fe976b475bec42b" 16SRCREV = "2b4b88eb513335b0ece55fe51854693d9b20de35"
10S = "${WORKDIR}/git" 17S = "${WORKDIR}/git"
11PV = "1.9.0+git${SRCPV}" 18PV = "1.9.0+git${SRCPV}"
12 19