diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-06-26 11:47:12 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-06-28 08:36:00 +0100 |
commit | 9f5f3905007c59730e32fa72fcdbe41485c306c0 (patch) | |
tree | dc91228966be5d473b241a187578d03565a127a9 /meta/recipes-devtools/pseudo | |
parent | c0a16eaae08edaa21c551947726b189a1afec1ae (diff) | |
download | poky-9f5f3905007c59730e32fa72fcdbe41485c306c0.tar.gz |
pseudo: Switch to oe-core branch in git repo
We have a significant number of outstanding patches to pseudo. Rather than
queue these up as patches, create a branch in the upstream repo and use that
until such times as we have someone with the time/skills to properly review
these for master in the pseudo repo.
(From OE-Core rev: f09088eaa803ce396726368626a35dee70168d91)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/pseudo')
11 files changed, 2 insertions, 618 deletions
diff --git a/meta/recipes-devtools/pseudo/files/0001-Add-statx.patch b/meta/recipes-devtools/pseudo/files/0001-Add-statx.patch deleted file mode 100644 index f01e699de7..0000000000 --- a/meta/recipes-devtools/pseudo/files/0001-Add-statx.patch +++ /dev/null | |||
@@ -1,106 +0,0 @@ | |||
1 | From 4e41a05de1f34ba00a68ca4f20fb49c4d1cbd2d0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
3 | Date: Wed, 6 Nov 2019 12:17:46 +0000 | ||
4 | Subject: [PATCH] Add statx glibc/syscall support | ||
5 | |||
6 | Modern distros (e.g. fedora30) are starting to use the new statx() syscall through | ||
7 | the newly exposed glibc wrapper function in software like coreutils (e.g. the ls | ||
8 | command). Add support to intercept this to pseudo. | ||
9 | |||
10 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
11 | Upstream-Status: Submitted [Emailed to seebs] | ||
12 | --- | ||
13 | ports/linux/guts/statx.c | 48 ++++++++++++++++++++++++++++++++++++++++ | ||
14 | ports/linux/portdefs.h | 1 + | ||
15 | ports/linux/wrapfuncs.in | 1 + | ||
16 | 3 files changed, 50 insertions(+) | ||
17 | create mode 100644 ports/linux/guts/statx.c | ||
18 | |||
19 | diff --git a/ports/linux/statx/guts/statx.c b/ports/linux/statx/guts/statx.c | ||
20 | new file mode 100644 | ||
21 | index 0000000..a3259c4 | ||
22 | --- /dev/null | ||
23 | +++ b/ports/linux/statx/guts/statx.c | ||
24 | @@ -0,0 +1,42 @@ | ||
25 | +/* | ||
26 | + * Copyright (c) 2019 Linux Foundation | ||
27 | + * Author: Richard Purdie | ||
28 | + * | ||
29 | + * SPDX-License-Identifier: LGPL-2.1-only | ||
30 | + * | ||
31 | + * int | ||
32 | + * statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf) { | ||
33 | + * int rc = -1; | ||
34 | + */ | ||
35 | + pseudo_msg_t *msg; | ||
36 | + PSEUDO_STATBUF buf; | ||
37 | + int save_errno; | ||
38 | + | ||
39 | + rc = real_statx(dirfd, pathname, flags, mask, statxbuf); | ||
40 | + save_errno = errno; | ||
41 | + if (rc == -1) { | ||
42 | + return rc; | ||
43 | + } | ||
44 | + | ||
45 | + buf.st_uid = statxbuf->stx_uid; | ||
46 | + buf.st_gid = statxbuf->stx_gid; | ||
47 | + buf.st_dev = makedev(statxbuf->stx_dev_major, statxbuf->stx_dev_minor); | ||
48 | + buf.st_ino = statxbuf->stx_ino; | ||
49 | + buf.st_mode = statxbuf->stx_mode; | ||
50 | + buf.st_rdev = makedev(statxbuf->stx_rdev_major, statxbuf->stx_rdev_minor); | ||
51 | + buf.st_nlink = statxbuf->stx_nlink; | ||
52 | + msg = pseudo_client_op(OP_STAT, 0, -1, dirfd, pathname, &buf); | ||
53 | + if (msg && msg->result == RESULT_SUCCEED) { | ||
54 | + pseudo_debug(PDBGF_FILE, "statx(path %s), flags %o, stat rc %d, stat uid %o\n", pathname, flags, rc, statxbuf->stx_uid); | ||
55 | + statxbuf->stx_uid = msg->uid; | ||
56 | + statxbuf->stx_gid = msg->gid; | ||
57 | + statxbuf->stx_mode = msg->mode; | ||
58 | + statxbuf->stx_rdev_major = major(msg->rdev); | ||
59 | + statxbuf->stx_rdev_minor = minor(msg->rdev); | ||
60 | + } else { | ||
61 | + pseudo_debug(PDBGF_FILE, "statx(path %s) failed, flags %o, stat rc %d, stat uid %o\n", pathname, flags, rc, statxbuf->stx_uid); | ||
62 | + } | ||
63 | + errno = save_errno; | ||
64 | +/* return rc; | ||
65 | + * } | ||
66 | + */ | ||
67 | diff --git a/ports/linux/statx/portdefs.h b/ports/linux/statx/portdefs.h | ||
68 | new file mode 100644 | ||
69 | index 0000000..bf934dc | ||
70 | --- /dev/null | ||
71 | +++ b/ports/linux/statx/portdefs.h | ||
72 | @@ -0,0 +1,6 @@ | ||
73 | +/* | ||
74 | + * SPDX-License-Identifier: LGPL-2.1-only | ||
75 | + * | ||
76 | + */ | ||
77 | +#include <sys/stat.h> | ||
78 | +#include <sys/sysmacros.h> | ||
79 | diff --git a/ports/linux/statx/wrapfuncs.in b/ports/linux/statx/wrapfuncs.in | ||
80 | new file mode 100644 | ||
81 | index 0000000..c9cd4c3 | ||
82 | --- /dev/null | ||
83 | +++ b/ports/linux/statx/wrapfuncs.in | ||
84 | @@ -0,0 +1 @@ | ||
85 | +int statx(int dirfd, const char *pathname, int flags, unsigned int mask, struct statx *statxbuf); | ||
86 | diff --git a/ports/linux/subports b/ports/linux/subports | ||
87 | index a29044a..49081bf 100755 | ||
88 | --- a/ports/linux/subports | ||
89 | +++ b/ports/linux/subports | ||
90 | @@ -54,3 +54,13 @@ else | ||
91 | fi | ||
92 | rm -f dummy.c dummy.o | ||
93 | |||
94 | +cat > dummy.c <<EOF | ||
95 | +#define _GNU_SOURCE | ||
96 | +#include <sys/stat.h> | ||
97 | +struct statx x; | ||
98 | +EOF | ||
99 | +if ${CC} -c -o dummy.o dummy.c >/dev/null 2>&1; then | ||
100 | + echo "linux/statx" | ||
101 | +fi | ||
102 | +rm -f dummy.c dummy.o | ||
103 | + | ||
104 | -- | ||
105 | 2.17.1 | ||
106 | |||
diff --git a/meta/recipes-devtools/pseudo/files/0001-maketables-wrappers-use-Python-3.patch b/meta/recipes-devtools/pseudo/files/0001-maketables-wrappers-use-Python-3.patch deleted file mode 100644 index b2dbdad278..0000000000 --- a/meta/recipes-devtools/pseudo/files/0001-maketables-wrappers-use-Python-3.patch +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | From dbd34b1b2af8fbf44a0d5c37abe3448405819823 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Wed, 28 Aug 2019 19:20:29 +0200 | ||
4 | Subject: [PATCH] maketables/wrappers: use Python 3 | ||
5 | |||
6 | Changelog indicates they should be compatible. | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
10 | --- | ||
11 | maketables | 2 +- | ||
12 | makewrappers | 2 +- | ||
13 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/maketables b/maketables | ||
16 | index a211772..52285e2 100755 | ||
17 | --- a/maketables | ||
18 | +++ b/maketables | ||
19 | @@ -1,4 +1,4 @@ | ||
20 | -#!/usr/bin/env python | ||
21 | +#!/usr/bin/env python3 | ||
22 | # | ||
23 | # Copyright (c) 2008-2010, 2013 Wind River Systems, Inc. | ||
24 | # | ||
25 | diff --git a/makewrappers b/makewrappers | ||
26 | index e84607d..b34f7eb 100755 | ||
27 | --- a/makewrappers | ||
28 | +++ b/makewrappers | ||
29 | @@ -1,4 +1,4 @@ | ||
30 | -#!/usr/bin/env python | ||
31 | +#!/usr/bin/env python3 | ||
32 | # | ||
33 | # Copyright (c) 2008-2011,2013 Wind River Systems, Inc. | ||
34 | # | ||
diff --git a/meta/recipes-devtools/pseudo/files/0001-pseudo-On-a-DB-fixup-remove-files-that-do-not-exist-.patch b/meta/recipes-devtools/pseudo/files/0001-pseudo-On-a-DB-fixup-remove-files-that-do-not-exist-.patch deleted file mode 100644 index 9c49e33b02..0000000000 --- a/meta/recipes-devtools/pseudo/files/0001-pseudo-On-a-DB-fixup-remove-files-that-do-not-exist-.patch +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | From b0902e36108b49e6bc88d6b251cc2f8cffcd5a13 Mon Sep 17 00:00:00 2001 | ||
2 | From: Ricardo Ribalda <ricardo@ribalda.com> | ||
3 | Date: Sun, 5 Apr 2020 11:40:30 +0000 | ||
4 | Subject: [PATCH] pseudo: On a DB fixup remove files that do not exist anymore | ||
5 | |||
6 | If the user decides to fix a database, remove the files that do not | ||
7 | exist anymore. | ||
8 | If only DB test is selected do not change the behaviour (return error). | ||
9 | |||
10 | Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com> | ||
11 | Upstream-Status: Submitted [https://lists.openembedded.org/g/openembedded-core/message/137045] | ||
12 | --- | ||
13 | pseudo.c | 13 ++++++++++--- | ||
14 | 1 file changed, 10 insertions(+), 3 deletions(-) | ||
15 | |||
16 | diff --git a/pseudo.c b/pseudo.c | ||
17 | index 0f5850e..98e5b0c 100644 | ||
18 | --- a/pseudo.c | ||
19 | +++ b/pseudo.c | ||
20 | @@ -1087,9 +1087,15 @@ pseudo_db_check(int fix) { | ||
21 | int fixup_needed = 0; | ||
22 | pseudo_debug(PDBGF_DB, "Checking <%s>\n", m->path); | ||
23 | if (lstat(m->path, &buf)) { | ||
24 | - errors = EXIT_FAILURE; | ||
25 | - pseudo_diag("can't stat <%s>\n", m->path); | ||
26 | - continue; | ||
27 | + if (!fix) { | ||
28 | + pseudo_diag("can't stat <%s>\n", m->path); | ||
29 | + errors = EXIT_FAILURE; | ||
30 | + continue; | ||
31 | + } else { | ||
32 | + pseudo_debug(PDBGF_DB, "can't stat <%s>\n", m->path); | ||
33 | + fixup_needed = 2; | ||
34 | + goto do_fixup; | ||
35 | + } | ||
36 | } | ||
37 | /* can't check for device type mismatches, uid/gid, or | ||
38 | * permissions, because those are the very things we | ||
39 | @@ -1125,6 +1131,7 @@ pseudo_db_check(int fix) { | ||
40 | S_ISDIR(m->mode)); | ||
41 | fixup_needed = 2; | ||
42 | } | ||
43 | + do_fixup: | ||
44 | if (fixup_needed) { | ||
45 | /* in fixup mode, either delete (mismatches) or | ||
46 | * correct (dev/ino). | ||
47 | -- | ||
48 | 2.21.1 | ||
49 | |||
diff --git a/meta/recipes-devtools/pseudo/files/0001-pseudo_ipc.h-Fix-enum-typedef.patch b/meta/recipes-devtools/pseudo/files/0001-pseudo_ipc.h-Fix-enum-typedef.patch deleted file mode 100644 index 33d4ef3b2f..0000000000 --- a/meta/recipes-devtools/pseudo/files/0001-pseudo_ipc.h-Fix-enum-typedef.patch +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | From a491aececfedf7313d29b80d626e0964fb533548 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jacob Kroon <jacob.kroon@gmail.com> | ||
3 | Date: Sun, 3 May 2020 06:24:03 +0200 | ||
4 | Subject: [PATCH] pseudo_ipc.h: Fix enum typedef | ||
5 | |||
6 | 'pseudo_access_t' is a type, so use typedef. | ||
7 | |||
8 | Fixes building pseudo with gcc 10 where -fno-common is the default. | ||
9 | |||
10 | Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com> | ||
11 | Upstream-Status: Submitted [https://lists.openembedded.org/g/openembedded-core/message/137758] | ||
12 | --- | ||
13 | pseudo_ipc.h | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/pseudo_ipc.h b/pseudo_ipc.h | ||
17 | index caeae5c..d945257 100644 | ||
18 | --- a/pseudo_ipc.h | ||
19 | +++ b/pseudo_ipc.h | ||
20 | @@ -29,7 +29,7 @@ typedef struct { | ||
21 | char path[]; | ||
22 | } pseudo_msg_t; | ||
23 | |||
24 | -enum { | ||
25 | +typedef enum { | ||
26 | PSA_EXEC = 1, | ||
27 | PSA_WRITE = (PSA_EXEC << 1), | ||
28 | PSA_READ = (PSA_WRITE << 1), | ||
29 | -- | ||
30 | 2.26.2 | ||
31 | |||
diff --git a/meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch b/meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch deleted file mode 100644 index 17829ef3ac..0000000000 --- a/meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | From 86c9a5610e3333ad6aaadb1ac1e8b5a2c948d119 Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
3 | Date: Mon, 25 Nov 2019 18:46:45 +0800 | ||
4 | Subject: [PATCH] realpath.c: Remove trailing slashes | ||
5 | |||
6 | Linux system's realpath() remove trailing slashes, but pseudo's doesn't, need | ||
7 | make them identical. | ||
8 | |||
9 | E.g., the following code (rel.c) prints '/tmp' with system's realpath, but | ||
10 | pseudo's realpath prints '/tmp/': | ||
11 | |||
12 | #include <stdio.h> | ||
13 | #include <limits.h> | ||
14 | #include <stdlib.h> | ||
15 | |||
16 | int main() { | ||
17 | char out[PATH_MAX]; | ||
18 | printf("%s\n", realpath("/tmp/", out)); | ||
19 | return 0; | ||
20 | } | ||
21 | |||
22 | $ bitbake base-passwd -cdevshell # For pseudo env | ||
23 | $ gcc rel.c | ||
24 | $ ./a.out | ||
25 | /tmp/ (but should be /tmp) | ||
26 | |||
27 | This patch fixes the problem. | ||
28 | |||
29 | Upstream-Status: Submitted [https://lists.yoctoproject.org/g/poky/message/11879] | ||
30 | |||
31 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
32 | --- | ||
33 | ports/unix/guts/realpath.c | 9 ++++++++- | ||
34 | 1 file changed, 8 insertions(+), 1 deletion(-) | ||
35 | |||
36 | diff --git a/ports/unix/guts/realpath.c b/ports/unix/guts/realpath.c | ||
37 | --- a/ports/unix/guts/realpath.c | ||
38 | +++ b/ports/unix/guts/realpath.c | ||
39 | @@ -14,7 +14,14 @@ | ||
40 | errno = ENAMETOOLONG; | ||
41 | return NULL; | ||
42 | } | ||
43 | - if ((len = strlen(rname)) >= pseudo_sys_path_max()) { | ||
44 | + len = strlen(rname); | ||
45 | + char *ep = rname + len - 1; | ||
46 | + while (ep > rname && *ep == '/') { | ||
47 | + --len; | ||
48 | + *(ep--) = '\0'; | ||
49 | + } | ||
50 | + | ||
51 | + if (len >= pseudo_sys_path_max()) { | ||
52 | errno = ENAMETOOLONG; | ||
53 | return NULL; | ||
54 | } | ||
55 | -- | ||
56 | 2.7.4 | ||
57 | |||
diff --git a/meta/recipes-devtools/pseudo/files/0006-xattr-adjust-for-attr-2.4.48-release.patch b/meta/recipes-devtools/pseudo/files/0006-xattr-adjust-for-attr-2.4.48-release.patch deleted file mode 100644 index 161357d553..0000000000 --- a/meta/recipes-devtools/pseudo/files/0006-xattr-adjust-for-attr-2.4.48-release.patch +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | From 93d95ed2eaedcca110c214e1fe3f8896b1f6f853 Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Tue, 17 Dec 2019 20:24:27 +0100 | ||
4 | Subject: [PATCH] xattr: adjust for attr 2.4.48 release | ||
5 | |||
6 | Latest versions of attr have removed the xattr.h header, | ||
7 | with the rationale that libc is providing the same wrappers. | ||
8 | |||
9 | attr/attributes.h is providing the ENOATTR definition. | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
13 | --- | ||
14 | ports/linux/subports | 5 +++-- | ||
15 | ports/linux/xattr/portdefs.h | 3 ++- | ||
16 | 2 files changed, 5 insertions(+), 3 deletions(-) | ||
17 | |||
18 | diff --git a/ports/linux/subports b/ports/linux/subports | ||
19 | index 2c43ac9..740ec83 100755 | ||
20 | --- a/ports/linux/subports | ||
21 | +++ b/ports/linux/subports | ||
22 | @@ -29,11 +29,12 @@ fi | ||
23 | if $port_xattr; then | ||
24 | cat > dummy.c <<EOF | ||
25 | #include <sys/types.h> | ||
26 | -#include <attr/xattr.h> | ||
27 | +#include <sys/xattr.h> | ||
28 | +#include <attr/attributes.h> | ||
29 | int i; | ||
30 | EOF | ||
31 | if ! ${CC} -c -o dummy.o dummy.c >/dev/null 2>&1; then | ||
32 | - echo >&2 "Warning: Can't compile trivial program using <attr/xattr.h>". | ||
33 | + echo >&2 "Warning: Can't compile trivial program using <attr/attributes.h>". | ||
34 | echo >&2 " xattr support will require that header." | ||
35 | fi | ||
36 | echo "linux/xattr" | ||
37 | diff --git a/ports/linux/xattr/portdefs.h b/ports/linux/xattr/portdefs.h | ||
38 | index 56cd3ca..068d39a 100644 | ||
39 | --- a/ports/linux/xattr/portdefs.h | ||
40 | +++ b/ports/linux/xattr/portdefs.h | ||
41 | @@ -2,5 +2,6 @@ | ||
42 | * SPDX-License-Identifier: LGPL-2.1-only | ||
43 | * | ||
44 | */ | ||
45 | -#include <attr/xattr.h> | ||
46 | +#include <sys/xattr.h> | ||
47 | +#include <attr/attributes.h> | ||
48 | #include <stdint.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 @@ | |||
1 | Increase the number of retries in pseudo due to occasional slow | ||
2 | server shutdowns. | ||
3 | |||
4 | Upstream-Status: Pending | ||
5 | RP 2016/2/28 | ||
6 | |||
7 | Index: git/pseudo_client.c | ||
8 | =================================================================== | ||
9 | --- git.orig/pseudo_client.c | ||
10 | +++ git/pseudo_client.c | ||
11 | @@ -1282,7 +1282,7 @@ pseudo_client_setup(void) { | ||
12 | } | ||
13 | } | ||
14 | |||
15 | -#define PSEUDO_RETRIES 20 | ||
16 | +#define PSEUDO_RETRIES 250 | ||
17 | static pseudo_msg_t * | ||
18 | pseudo_client_request(pseudo_msg_t *msg, size_t len, const char *path) { | ||
19 | pseudo_msg_t *response = 0; | ||
diff --git a/meta/recipes-devtools/pseudo/files/seccomp.patch b/meta/recipes-devtools/pseudo/files/seccomp.patch deleted file mode 100644 index 283f997941..0000000000 --- a/meta/recipes-devtools/pseudo/files/seccomp.patch +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | Pseudo changes the syscall access patterns which makes it incompatible with | ||
2 | seccomp. Therefore intercept the seccomp syscall and alter it, pretending that | ||
3 | seccomp was setup when in fact we do nothing. If we error as unsupported, | ||
4 | utilities like file will exit with errors so we can't just disable it. | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | RP 2020/4/3 | ||
8 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
9 | |||
10 | It fails to compile pseudo-native on centos 7: | ||
11 | |||
12 | | ports/linux/pseudo_wrappers.c: In function ‘prctl’: | ||
13 | | ports/linux/pseudo_wrappers.c:129:14: error: ‘SECCOMP_SET_MODE_FILTER’ undeclared (first use in this function) | ||
14 | | if (cmd == SECCOMP_SET_MODE_FILTER) { | ||
15 | | ^ | ||
16 | |||
17 | Add macro guard for seccomp to avoid the failure. | ||
18 | |||
19 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
20 | |||
21 | Index: git/ports/linux/pseudo_wrappers.c | ||
22 | =================================================================== | ||
23 | --- git.orig/ports/linux/pseudo_wrappers.c | ||
24 | +++ git/ports/linux/pseudo_wrappers.c | ||
25 | @@ -57,6 +57,7 @@ int pseudo_capset(cap_user_header_t hdrp | ||
26 | long | ||
27 | syscall(long number, ...) { | ||
28 | long rc = -1; | ||
29 | + va_list ap; | ||
30 | |||
31 | if (!pseudo_check_wrappers() || !real_syscall) { | ||
32 | /* rc was initialized to the "failure" value */ | ||
33 | @@ -77,6 +78,20 @@ syscall(long number, ...) { | ||
34 | (void) number; | ||
35 | #endif | ||
36 | |||
37 | +#ifdef SYS_seccomp | ||
38 | + /* pseudo and seccomp are incompatible as pseudo uses different syscalls | ||
39 | + * so pretend to enable seccomp but really do nothing */ | ||
40 | + if (number == SYS_seccomp) { | ||
41 | + unsigned long cmd; | ||
42 | + va_start(ap, number); | ||
43 | + cmd = va_arg(ap, unsigned long); | ||
44 | + va_end(ap); | ||
45 | + if (cmd == SECCOMP_SET_MODE_FILTER) { | ||
46 | + return 0; | ||
47 | + } | ||
48 | + } | ||
49 | +#endif | ||
50 | + | ||
51 | /* gcc magic to attempt to just pass these args to syscall. we have to | ||
52 | * guess about the number of args; the docs discuss calling conventions | ||
53 | * up to 7, so let's try that? | ||
54 | @@ -92,3 +108,44 @@ static long wrap_syscall(long nr, va_lis | ||
55 | (void) ap; | ||
56 | return -1; | ||
57 | } | ||
58 | + | ||
59 | +int | ||
60 | +prctl(int option, ...) { | ||
61 | + int rc = -1; | ||
62 | + va_list ap; | ||
63 | + | ||
64 | + if (!pseudo_check_wrappers() || !real_prctl) { | ||
65 | + /* rc was initialized to the "failure" value */ | ||
66 | + pseudo_enosys("prctl"); | ||
67 | + return rc; | ||
68 | + } | ||
69 | + | ||
70 | +#ifdef SECCOMP_SET_MODE_FILTER | ||
71 | + /* pseudo and seccomp are incompatible as pseudo uses different syscalls | ||
72 | + * so pretend to enable seccomp but really do nothing */ | ||
73 | + if (option == PR_SET_SECCOMP) { | ||
74 | + unsigned long cmd; | ||
75 | + va_start(ap, option); | ||
76 | + cmd = va_arg(ap, unsigned long); | ||
77 | + va_end(ap); | ||
78 | + if (cmd == SECCOMP_SET_MODE_FILTER) { | ||
79 | + return 0; | ||
80 | + } | ||
81 | + } | ||
82 | +#endif | ||
83 | + | ||
84 | + /* gcc magic to attempt to just pass these args to prctl. we have to | ||
85 | + * guess about the number of args; the docs discuss calling conventions | ||
86 | + * up to 5, so let's try that? | ||
87 | + */ | ||
88 | + void *res = __builtin_apply((void (*)()) real_prctl, __builtin_apply_args(), sizeof(long) * 5); | ||
89 | + __builtin_return(res); | ||
90 | +} | ||
91 | + | ||
92 | +/* unused. | ||
93 | + */ | ||
94 | +static int wrap_prctl(int option, va_list ap) { | ||
95 | + (void) option; | ||
96 | + (void) ap; | ||
97 | + return -1; | ||
98 | +} | ||
99 | Index: git/ports/linux/guts/prctl.c | ||
100 | =================================================================== | ||
101 | --- /dev/null | ||
102 | +++ git/ports/linux/guts/prctl.c | ||
103 | @@ -0,0 +1,15 @@ | ||
104 | +/* | ||
105 | + * Copyright (c) 2020 Richard Purdie | ||
106 | + * | ||
107 | + * SPDX-License-Identifier: LGPL-2.1-only | ||
108 | + * | ||
109 | + * int prctl(int option, ...) | ||
110 | + * int rc = -1; | ||
111 | + */ | ||
112 | + | ||
113 | + /* we should never get here, prctl is hand-wrapped */ | ||
114 | + rc = -1; | ||
115 | + | ||
116 | +/* return rc; | ||
117 | + * } | ||
118 | + */ | ||
119 | Index: git/ports/linux/portdefs.h | ||
120 | =================================================================== | ||
121 | --- git.orig/ports/linux/portdefs.h | ||
122 | +++ git/ports/linux/portdefs.h | ||
123 | @@ -32,3 +32,5 @@ GLIBC_COMPAT_SYMBOL(memcpy,2.0); | ||
124 | |||
125 | #include <linux/capability.h> | ||
126 | #include <sys/syscall.h> | ||
127 | +#include <sys/prctl.h> | ||
128 | +#include <linux/seccomp.h> | ||
129 | Index: git/ports/linux/wrapfuncs.in | ||
130 | =================================================================== | ||
131 | --- git.orig/ports/linux/wrapfuncs.in | ||
132 | +++ git/ports/linux/wrapfuncs.in | ||
133 | @@ -56,3 +56,4 @@ int getgrent_r(struct group *gbuf, char | ||
134 | int capset(cap_user_header_t hdrp, const cap_user_data_t datap); /* real_func=pseudo_capset */ | ||
135 | long syscall(long nr, ...); /* hand_wrapped=1 */ | ||
136 | int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, unsigned int flags); /* flags=AT_SYMLINK_NOFOLLOW */ | ||
137 | +int prctl(int option, ...); /* hand_wrapped=1 */ | ||
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 @@ | |||
1 | From b0b25fbc041a148d1de09f5a6503cd95973ec77c Mon Sep 17 00:00:00 2001 | ||
2 | From: Richard Purdie <richard.purdie@linuxfoundation.org> | ||
3 | Date: Tue, 25 Apr 2017 15:25:54 +0100 | ||
4 | Subject: [PATCH 3/3] pseudo: Handle too many files deadlock | ||
5 | |||
6 | Currently if we max out the maximum number of files, pseudo can deadlock, unable to | ||
7 | accept new connections yet unable to move forward and unblock the other processes | ||
8 | waiting either. | ||
9 | |||
10 | Rather than hang, when this happens, close out inactive connections, allowing us | ||
11 | to accept the new ones. The disconnected clients will simply reconnect. There is | ||
12 | a small risk of data loss here sadly but its better than hanging. | ||
13 | |||
14 | RP | ||
15 | 2017/4/25 | ||
16 | |||
17 | Upstream-Status: Submitted [Peter is aware of the issue] | ||
18 | |||
19 | --- | ||
20 | pseudo_server.c | 10 ++++++++++ | ||
21 | 1 file changed, 10 insertions(+) | ||
22 | |||
23 | diff --git a/pseudo_server.c b/pseudo_server.c | ||
24 | index dac3258..15a3e8f 100644 | ||
25 | --- a/pseudo_server.c | ||
26 | +++ b/pseudo_server.c | ||
27 | @@ -802,6 +802,7 @@ pseudo_server_loop(void) { | ||
28 | struct sigaction eat_usr2 = { | ||
29 | .sa_handler = set_do_list_clients | ||
30 | }; | ||
31 | + int hitmaxfiles; | ||
32 | |||
33 | clients = malloc(16 * sizeof(*clients)); | ||
34 | |||
35 | @@ -820,6 +821,7 @@ pseudo_server_loop(void) { | ||
36 | active_clients = 1; | ||
37 | max_clients = 16; | ||
38 | highest_client = 0; | ||
39 | + hitmaxfiles = 0; | ||
40 | |||
41 | pseudo_debug(PDBGF_SERVER, "server loop started.\n"); | ||
42 | if (listen_fd < 0) { | ||
43 | @@ -878,10 +880,15 @@ pseudo_server_loop(void) { | ||
44 | } else { | ||
45 | serve_client(i); | ||
46 | } | ||
47 | + } else if (hitmaxfiles) { | ||
48 | + /* Only close one per loop iteration in the interests of caution */ | ||
49 | + close_client(i); | ||
50 | + hitmaxfiles = 0; | ||
51 | } | ||
52 | if (die_forcefully) | ||
53 | break; | ||
54 | } | ||
55 | + hitmaxfiles = 0; | ||
56 | if (!die_forcefully && | ||
57 | (FD_ISSET(clients[0].fd, &events) || | ||
58 | FD_ISSET(clients[0].fd, &reads))) { | ||
59 | @@ -903,6 +910,9 @@ pseudo_server_loop(void) { | ||
60 | */ | ||
61 | pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT; | ||
62 | die_peacefully = 0; | ||
63 | + } else if (errno == EMFILE) { | ||
64 | + hitmaxfiles = 1; | ||
65 | + pseudo_debug(PDBGF_SERVER, "Hit max open files, dropping a client.\n"); | ||
66 | } | ||
67 | } | ||
68 | pseudo_debug(PDBGF_SERVER, "server loop complete [%d clients left]\n", active_clients); | ||
69 | -- | ||
70 | 2.15.1 | ||
71 | |||
diff --git a/meta/recipes-devtools/pseudo/files/xattr_version.patch b/meta/recipes-devtools/pseudo/files/xattr_version.patch deleted file mode 100644 index a8b14bdd69..0000000000 --- a/meta/recipes-devtools/pseudo/files/xattr_version.patch +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | On a tumbleweed system, "install X Y" was showing the error: | ||
2 | |||
3 | pseudo: ENOSYS for 'fsetxattr'. | ||
4 | |||
5 | which was being caused by dlsym() for that function returning NULL. This | ||
6 | appears to be due to it finding an unresolved symbol in libacl for this | ||
7 | symbol in libattr. It hasn't been resolved so its NULL. dlerror() returns | ||
8 | nothing since this is a valid symbol entry, its just not the one we want. | ||
9 | |||
10 | We can add the glibc version string for the symbol we actually want so we get | ||
11 | that version rather than the libattr/libacl one. | ||
12 | |||
13 | To quote libattr: | ||
14 | """ | ||
15 | These dumb wrappers are for backwards compatibility only. | ||
16 | Actual syscall wrappers are long gone to libc. | ||
17 | """ | ||
18 | and they are simply wrappers around the libc version so our attaching | ||
19 | to the libc versions should intercept any accesses via these too. | ||
20 | |||
21 | RP 2020/06/22 | ||
22 | Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org | ||
23 | Upstream-Status: Pending [discussed with seebs on irc and appears the correct fix] | ||
24 | |||
25 | |||
26 | Index: git/ports/linux/xattr/wrapfuncs.in | ||
27 | =================================================================== | ||
28 | --- git.orig/ports/linux/xattr/wrapfuncs.in | ||
29 | +++ git/ports/linux/xattr/wrapfuncs.in | ||
30 | @@ -1,12 +1,12 @@ | ||
31 | -ssize_t getxattr(const char *path, const char *name, void *value, size_t size); /* flags=0 */ | ||
32 | -ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size); /* flags=AT_SYMLINK_NOFOLLOW */ | ||
33 | -ssize_t fgetxattr(int filedes, const char *name, void *value, size_t size); | ||
34 | -int setxattr(const char *path, const char *name, const void *value, size_t size, int xflags); /* flags=0 */ | ||
35 | -int lsetxattr(const char *path, const char *name, const void *value, size_t size, int xflags); /* flags=AT_SYMLINK_NOFOLLOW */ | ||
36 | -int fsetxattr(int filedes, const char *name, const void *value, size_t size, int xflags); | ||
37 | -ssize_t listxattr(const char *path, char *list, size_t size); /* flags=0 */ | ||
38 | -ssize_t llistxattr(const char *path, char *list, size_t size); /* flags=AT_SYMLINK_NOFOLLOW */ | ||
39 | -ssize_t flistxattr(int filedes, char *list, size_t size); | ||
40 | -int removexattr(const char *path, const char *name); /* flags=0 */ | ||
41 | -int lremovexattr(const char *path, const char *name); /* flags=AT_SYMLINK_NOFOLLOW */ | ||
42 | -int fremovexattr(int filedes, const char *name); | ||
43 | +ssize_t getxattr(const char *path, const char *name, void *value, size_t size); /* flags=0, version="GLIBC_2.3" */ | ||
44 | +ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size); /* flags=AT_SYMLINK_NOFOLLOW, version="GLIBC_2.3" */ | ||
45 | +ssize_t fgetxattr(int filedes, const char *name, void *value, size_t size); /* version="GLIBC_2.3" */ | ||
46 | +int setxattr(const char *path, const char *name, const void *value, size_t size, int xflags); /* flags=0, version="GLIBC_2.3" */ | ||
47 | +int lsetxattr(const char *path, const char *name, const void *value, size_t size, int xflags); /* flags=AT_SYMLINK_NOFOLLOW, version="GLIBC_2.3" */ | ||
48 | +int fsetxattr(int filedes, const char *name, const void *value, size_t size, int xflags); /* version="GLIBC_2.3" */ | ||
49 | +ssize_t listxattr(const char *path, char *list, size_t size); /* flags=0, version="GLIBC_2.3" */ | ||
50 | +ssize_t llistxattr(const char *path, char *list, size_t size); /* flags=AT_SYMLINK_NOFOLLOW, version="GLIBC_2.3" */ | ||
51 | +ssize_t flistxattr(int filedes, char *list, size_t size); /* version="GLIBC_2.3" */ | ||
52 | +int removexattr(const char *path, const char *name); /* flags=0, version="GLIBC_2.3" */ | ||
53 | +int lremovexattr(const char *path, const char *name); /* flags=AT_SYMLINK_NOFOLLOW, version="GLIBC_2.3" */ | ||
54 | +int fremovexattr(int filedes, const char *name); /* version="GLIBC_2.3" */ | ||
diff --git a/meta/recipes-devtools/pseudo/pseudo_git.bb b/meta/recipes-devtools/pseudo/pseudo_git.bb index 419bac19fe..ead5dcfb14 100644 --- a/meta/recipes-devtools/pseudo/pseudo_git.bb +++ b/meta/recipes-devtools/pseudo/pseudo_git.bb | |||
@@ -1,22 +1,12 @@ | |||
1 | require pseudo.inc | 1 | require pseudo.inc |
2 | 2 | ||
3 | SRC_URI = "git://git.yoctoproject.org/pseudo \ | 3 | SRC_URI = "git://git.yoctoproject.org/pseudo;branch=oe-core \ |
4 | file://0001-configure-Prune-PIE-flags.patch \ | 4 | file://0001-configure-Prune-PIE-flags.patch \ |
5 | file://fallback-passwd \ | 5 | file://fallback-passwd \ |
6 | file://fallback-group \ | 6 | file://fallback-group \ |
7 | file://moreretries.patch \ | ||
8 | file://toomanyfiles.patch \ | ||
9 | file://0001-maketables-wrappers-use-Python-3.patch \ | ||
10 | file://0001-Add-statx.patch \ | ||
11 | file://0001-realpath.c-Remove-trailing-slashes.patch \ | ||
12 | file://0006-xattr-adjust-for-attr-2.4.48-release.patch \ | ||
13 | file://seccomp.patch \ | ||
14 | file://0001-pseudo-On-a-DB-fixup-remove-files-that-do-not-exist-.patch \ | ||
15 | file://0001-pseudo_ipc.h-Fix-enum-typedef.patch \ | ||
16 | file://xattr_version.patch \ | ||
17 | " | 7 | " |
18 | 8 | ||
19 | SRCREV = "060058bb29f70b244e685b3c704eb0641b736f73" | 9 | SRCREV = "b94fa2fc81cde25865ee223ca437d07377229a53" |
20 | S = "${WORKDIR}/git" | 10 | S = "${WORKDIR}/git" |
21 | PV = "1.9.0+git${SRCPV}" | 11 | PV = "1.9.0+git${SRCPV}" |
22 | 12 | ||