diff options
Diffstat (limited to 'poky/meta/recipes-devtools/pseudo/files')
5 files changed, 322 insertions, 0 deletions
diff --git a/poky/meta/recipes-devtools/pseudo/files/0001-pseudo-On-a-DB-fixup-remove-files-that-do-not-exist-.patch b/poky/meta/recipes-devtools/pseudo/files/0001-pseudo-On-a-DB-fixup-remove-files-that-do-not-exist-.patch new file mode 100644 index 000000000..9c49e33b0 --- /dev/null +++ b/poky/meta/recipes-devtools/pseudo/files/0001-pseudo-On-a-DB-fixup-remove-files-that-do-not-exist-.patch @@ -0,0 +1,49 @@ +From b0902e36108b49e6bc88d6b251cc2f8cffcd5a13 Mon Sep 17 00:00:00 2001 +From: Ricardo Ribalda <ricardo@ribalda.com> +Date: Sun, 5 Apr 2020 11:40:30 +0000 +Subject: [PATCH] pseudo: On a DB fixup remove files that do not exist anymore + +If the user decides to fix a database, remove the files that do not +exist anymore. +If only DB test is selected do not change the behaviour (return error). + +Signed-off-by: Ricardo Ribalda <ricardo@ribalda.com> +Upstream-Status: Submitted [https://lists.openembedded.org/g/openembedded-core/message/137045] +--- + pseudo.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/pseudo.c b/pseudo.c +index 0f5850e..98e5b0c 100644 +--- a/pseudo.c ++++ b/pseudo.c +@@ -1087,9 +1087,15 @@ pseudo_db_check(int fix) { + int fixup_needed = 0; + pseudo_debug(PDBGF_DB, "Checking <%s>\n", m->path); + if (lstat(m->path, &buf)) { +- errors = EXIT_FAILURE; +- pseudo_diag("can't stat <%s>\n", m->path); +- continue; ++ if (!fix) { ++ pseudo_diag("can't stat <%s>\n", m->path); ++ errors = EXIT_FAILURE; ++ continue; ++ } else { ++ pseudo_debug(PDBGF_DB, "can't stat <%s>\n", m->path); ++ fixup_needed = 2; ++ goto do_fixup; ++ } + } + /* can't check for device type mismatches, uid/gid, or + * permissions, because those are the very things we +@@ -1125,6 +1131,7 @@ pseudo_db_check(int fix) { + S_ISDIR(m->mode)); + fixup_needed = 2; + } ++ do_fixup: + if (fixup_needed) { + /* in fixup mode, either delete (mismatches) or + * correct (dev/ino). +-- +2.21.1 + diff --git a/poky/meta/recipes-devtools/pseudo/files/0001-pseudo_ipc.h-Fix-enum-typedef.patch b/poky/meta/recipes-devtools/pseudo/files/0001-pseudo_ipc.h-Fix-enum-typedef.patch new file mode 100644 index 000000000..33d4ef3b2 --- /dev/null +++ b/poky/meta/recipes-devtools/pseudo/files/0001-pseudo_ipc.h-Fix-enum-typedef.patch @@ -0,0 +1,31 @@ +From a491aececfedf7313d29b80d626e0964fb533548 Mon Sep 17 00:00:00 2001 +From: Jacob Kroon <jacob.kroon@gmail.com> +Date: Sun, 3 May 2020 06:24:03 +0200 +Subject: [PATCH] pseudo_ipc.h: Fix enum typedef + +'pseudo_access_t' is a type, so use typedef. + +Fixes building pseudo with gcc 10 where -fno-common is the default. + +Signed-off-by: Jacob Kroon <jacob.kroon@gmail.com> +Upstream-Status: Submitted [https://lists.openembedded.org/g/openembedded-core/message/137758] +--- + pseudo_ipc.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/pseudo_ipc.h b/pseudo_ipc.h +index caeae5c..d945257 100644 +--- a/pseudo_ipc.h ++++ b/pseudo_ipc.h +@@ -29,7 +29,7 @@ typedef struct { + char path[]; + } pseudo_msg_t; + +-enum { ++typedef enum { + PSA_EXEC = 1, + PSA_WRITE = (PSA_EXEC << 1), + PSA_READ = (PSA_WRITE << 1), +-- +2.26.2 + diff --git a/poky/meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch b/poky/meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch new file mode 100644 index 000000000..17829ef3a --- /dev/null +++ b/poky/meta/recipes-devtools/pseudo/files/0001-realpath.c-Remove-trailing-slashes.patch @@ -0,0 +1,57 @@ +From 86c9a5610e3333ad6aaadb1ac1e8b5a2c948d119 Mon Sep 17 00:00:00 2001 +From: Robert Yang <liezhi.yang@windriver.com> +Date: Mon, 25 Nov 2019 18:46:45 +0800 +Subject: [PATCH] realpath.c: Remove trailing slashes + +Linux system's realpath() remove trailing slashes, but pseudo's doesn't, need +make them identical. + +E.g., the following code (rel.c) prints '/tmp' with system's realpath, but +pseudo's realpath prints '/tmp/': + + #include <stdio.h> + #include <limits.h> + #include <stdlib.h> + + int main() { + char out[PATH_MAX]; + printf("%s\n", realpath("/tmp/", out)); + return 0; + } + +$ bitbake base-passwd -cdevshell # For pseudo env +$ gcc rel.c +$ ./a.out +/tmp/ (but should be /tmp) + +This patch fixes the problem. + +Upstream-Status: Submitted [https://lists.yoctoproject.org/g/poky/message/11879] + +Signed-off-by: Robert Yang <liezhi.yang@windriver.com> +--- + ports/unix/guts/realpath.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/ports/unix/guts/realpath.c b/ports/unix/guts/realpath.c +--- a/ports/unix/guts/realpath.c ++++ b/ports/unix/guts/realpath.c +@@ -14,7 +14,14 @@ + errno = ENAMETOOLONG; + return NULL; + } +- if ((len = strlen(rname)) >= pseudo_sys_path_max()) { ++ len = strlen(rname); ++ char *ep = rname + len - 1; ++ while (ep > rname && *ep == '/') { ++ --len; ++ *(ep--) = '\0'; ++ } ++ ++ if (len >= pseudo_sys_path_max()) { + errno = ENAMETOOLONG; + return NULL; + } +-- +2.7.4 + diff --git a/poky/meta/recipes-devtools/pseudo/files/0006-xattr-adjust-for-attr-2.4.48-release.patch b/poky/meta/recipes-devtools/pseudo/files/0006-xattr-adjust-for-attr-2.4.48-release.patch new file mode 100644 index 000000000..161357d55 --- /dev/null +++ b/poky/meta/recipes-devtools/pseudo/files/0006-xattr-adjust-for-attr-2.4.48-release.patch @@ -0,0 +1,48 @@ +From 93d95ed2eaedcca110c214e1fe3f8896b1f6f853 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin <alex.kanavin@gmail.com> +Date: Tue, 17 Dec 2019 20:24:27 +0100 +Subject: [PATCH] xattr: adjust for attr 2.4.48 release + +Latest versions of attr have removed the xattr.h header, +with the rationale that libc is providing the same wrappers. + +attr/attributes.h is providing the ENOATTR definition. + +Upstream-Status: Pending +Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> +--- + ports/linux/subports | 5 +++-- + ports/linux/xattr/portdefs.h | 3 ++- + 2 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/ports/linux/subports b/ports/linux/subports +index 2c43ac9..740ec83 100755 +--- a/ports/linux/subports ++++ b/ports/linux/subports +@@ -29,11 +29,12 @@ fi + if $port_xattr; then + cat > dummy.c <<EOF + #include <sys/types.h> +-#include <attr/xattr.h> ++#include <sys/xattr.h> ++#include <attr/attributes.h> + int i; + EOF + if ! ${CC} -c -o dummy.o dummy.c >/dev/null 2>&1; then +- echo >&2 "Warning: Can't compile trivial program using <attr/xattr.h>". ++ echo >&2 "Warning: Can't compile trivial program using <attr/attributes.h>". + echo >&2 " xattr support will require that header." + fi + echo "linux/xattr" +diff --git a/ports/linux/xattr/portdefs.h b/ports/linux/xattr/portdefs.h +index 56cd3ca..068d39a 100644 +--- a/ports/linux/xattr/portdefs.h ++++ b/ports/linux/xattr/portdefs.h +@@ -2,5 +2,6 @@ + * SPDX-License-Identifier: LGPL-2.1-only + * + */ +-#include <attr/xattr.h> ++#include <sys/xattr.h> ++#include <attr/attributes.h> + #include <stdint.h> diff --git a/poky/meta/recipes-devtools/pseudo/files/seccomp.patch b/poky/meta/recipes-devtools/pseudo/files/seccomp.patch new file mode 100644 index 000000000..283f99794 --- /dev/null +++ b/poky/meta/recipes-devtools/pseudo/files/seccomp.patch @@ -0,0 +1,137 @@ +Pseudo changes the syscall access patterns which makes it incompatible with +seccomp. Therefore intercept the seccomp syscall and alter it, pretending that +seccomp was setup when in fact we do nothing. If we error as unsupported, +utilities like file will exit with errors so we can't just disable it. + +Upstream-Status: Pending +RP 2020/4/3 +Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> + +It fails to compile pseudo-native on centos 7: + +| ports/linux/pseudo_wrappers.c: In function ‘prctl’: +| ports/linux/pseudo_wrappers.c:129:14: error: ‘SECCOMP_SET_MODE_FILTER’ undeclared (first use in this function) +| if (cmd == SECCOMP_SET_MODE_FILTER) { +| ^ + +Add macro guard for seccomp to avoid the failure. + +Signed-off-by: Kai Kang <kai.kang@windriver.com> + +Index: git/ports/linux/pseudo_wrappers.c +=================================================================== +--- git.orig/ports/linux/pseudo_wrappers.c ++++ git/ports/linux/pseudo_wrappers.c +@@ -57,6 +57,7 @@ int pseudo_capset(cap_user_header_t hdrp + long + syscall(long number, ...) { + long rc = -1; ++ va_list ap; + + if (!pseudo_check_wrappers() || !real_syscall) { + /* rc was initialized to the "failure" value */ +@@ -77,6 +78,20 @@ syscall(long number, ...) { + (void) number; + #endif + ++#ifdef SYS_seccomp ++ /* pseudo and seccomp are incompatible as pseudo uses different syscalls ++ * so pretend to enable seccomp but really do nothing */ ++ if (number == SYS_seccomp) { ++ unsigned long cmd; ++ va_start(ap, number); ++ cmd = va_arg(ap, unsigned long); ++ va_end(ap); ++ if (cmd == SECCOMP_SET_MODE_FILTER) { ++ return 0; ++ } ++ } ++#endif ++ + /* gcc magic to attempt to just pass these args to syscall. we have to + * guess about the number of args; the docs discuss calling conventions + * up to 7, so let's try that? +@@ -92,3 +108,44 @@ static long wrap_syscall(long nr, va_lis + (void) ap; + return -1; + } ++ ++int ++prctl(int option, ...) { ++ int rc = -1; ++ va_list ap; ++ ++ if (!pseudo_check_wrappers() || !real_prctl) { ++ /* rc was initialized to the "failure" value */ ++ pseudo_enosys("prctl"); ++ return rc; ++ } ++ ++#ifdef SECCOMP_SET_MODE_FILTER ++ /* pseudo and seccomp are incompatible as pseudo uses different syscalls ++ * so pretend to enable seccomp but really do nothing */ ++ if (option == PR_SET_SECCOMP) { ++ unsigned long cmd; ++ va_start(ap, option); ++ cmd = va_arg(ap, unsigned long); ++ va_end(ap); ++ if (cmd == SECCOMP_SET_MODE_FILTER) { ++ return 0; ++ } ++ } ++#endif ++ ++ /* gcc magic to attempt to just pass these args to prctl. we have to ++ * guess about the number of args; the docs discuss calling conventions ++ * up to 5, so let's try that? ++ */ ++ void *res = __builtin_apply((void (*)()) real_prctl, __builtin_apply_args(), sizeof(long) * 5); ++ __builtin_return(res); ++} ++ ++/* unused. ++ */ ++static int wrap_prctl(int option, va_list ap) { ++ (void) option; ++ (void) ap; ++ return -1; ++} +Index: git/ports/linux/guts/prctl.c +=================================================================== +--- /dev/null ++++ git/ports/linux/guts/prctl.c +@@ -0,0 +1,15 @@ ++/* ++ * Copyright (c) 2020 Richard Purdie ++ * ++ * SPDX-License-Identifier: LGPL-2.1-only ++ * ++ * int prctl(int option, ...) ++ * int rc = -1; ++ */ ++ ++ /* we should never get here, prctl is hand-wrapped */ ++ rc = -1; ++ ++/* return rc; ++ * } ++ */ +Index: git/ports/linux/portdefs.h +=================================================================== +--- git.orig/ports/linux/portdefs.h ++++ git/ports/linux/portdefs.h +@@ -32,3 +32,5 @@ GLIBC_COMPAT_SYMBOL(memcpy,2.0); + + #include <linux/capability.h> + #include <sys/syscall.h> ++#include <sys/prctl.h> ++#include <linux/seccomp.h> +Index: git/ports/linux/wrapfuncs.in +=================================================================== +--- git.orig/ports/linux/wrapfuncs.in ++++ git/ports/linux/wrapfuncs.in +@@ -56,3 +56,4 @@ int getgrent_r(struct group *gbuf, char + int capset(cap_user_header_t hdrp, const cap_user_data_t datap); /* real_func=pseudo_capset */ + long syscall(long nr, ...); /* hand_wrapped=1 */ + int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, unsigned int flags); /* flags=AT_SYMLINK_NOFOLLOW */ ++int prctl(int option, ...); /* hand_wrapped=1 */ |