diff options
Diffstat (limited to 'meta')
3 files changed, 149 insertions, 0 deletions
diff --git a/meta/recipes-devtools/pseudo/files/b6b68db896f9963558334aff7fca61adde4ec10f.patch b/meta/recipes-devtools/pseudo/files/b6b68db896f9963558334aff7fca61adde4ec10f.patch new file mode 100644 index 0000000000..3045a3b736 --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/b6b68db896f9963558334aff7fca61adde4ec10f.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From b6b68db896f9963558334aff7fca61adde4ec10f Mon Sep 17 00:00:00 2001 | ||
2 | From: Seebs <seebs@seebs.net> | ||
3 | Date: Thu, 13 Apr 2017 18:12:01 -0500 | ||
4 | Subject: Prevent bash from segfaulting when unloading pseudo | ||
5 | |||
6 | bash's extremely fancy internal awareness of how the environment looks | ||
7 | means that, if you directly call the underlying libc "unsetenv" on | ||
8 | a variable, bash can end up trying to access a null pointer. Fixing | ||
9 | this generically is actually rather hard; you can't really avoid | ||
10 | writing to environ on fork() or popen(), even if you change all | ||
11 | execv*() functions to use the execv*e() variants. So for now, instead | ||
12 | of unsetting the variable, set it to an empty string. | ||
13 | |||
14 | Thanks to Saur in IRC for spotting this and helping debug it. | ||
15 | |||
16 | Signed-off-by: Seebs <seebs@seebs.net> | ||
17 | |||
18 | Upstream-Status: Backport | ||
19 | |||
20 | diff --git a/ChangeLog.txt b/ChangeLog.txt | ||
21 | index a2d30e9..8ba1ffa 100644 | ||
22 | --- a/ChangeLog.txt | ||
23 | +++ b/ChangeLog.txt | ||
24 | @@ -1,3 +1,8 @@ | ||
25 | +2017-04-13: | ||
26 | + * (seebs) don't unset LD_PRELOAD or the like, because if you | ||
27 | + do that, bash can segfault because it "knows" how many | ||
28 | + fields are in environ. | ||
29 | + | ||
30 | 2017-02-24: | ||
31 | * (seebs) import posix_acl_default fix from Anton Gerasimov | ||
32 | <anton@advancedtelematic.com> | ||
33 | diff --git a/pseudo_util.c b/pseudo_util.c | ||
34 | index 172990b..6a1fac2 100644 | ||
35 | --- a/pseudo_util.c | ||
36 | +++ b/pseudo_util.c | ||
37 | @@ -844,7 +844,7 @@ void pseudo_dropenv() { | ||
38 | if (ld_preload && strlen(ld_preload)) { | ||
39 | SETENV(PRELINK_LIBRARIES, ld_preload, 1); | ||
40 | } else { | ||
41 | - UNSETENV(PRELINK_LIBRARIES); | ||
42 | + SETENV(PRELINK_LIBRARIES, "", 1); | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | -- | ||
47 | cgit v0.10.2 | ||
48 | |||
diff --git a/meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch b/meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch new file mode 100644 index 0000000000..64fc58c4fe --- /dev/null +++ b/meta/recipes-devtools/pseudo/files/efe0be279901006f939cd357ccee47b651c786da.patch | |||
@@ -0,0 +1,99 @@ | |||
1 | From efe0be279901006f939cd357ccee47b651c786da Mon Sep 17 00:00:00 2001 | ||
2 | From: Seebs <seebs@seebs.net> | ||
3 | Date: Fri, 24 Feb 2017 12:47:38 -0600 | ||
4 | Subject: Don't try to record 0-length posix_acl_default xattrs | ||
5 | |||
6 | Based on a submission from Anton Gerasimov <anton@advancedtelematic.com> | ||
7 | |||
8 | On some systems, with some kernel configs, "cp -a" apparently tries to | ||
9 | set an empty ACL list, with a valid header but no contents, which causes | ||
10 | strange and mysterious behavior later if we actually create such an entry. | ||
11 | So filter that out, also sanity-check a couple of other things. | ||
12 | |||
13 | Signed-off-by: Seebs <seebs@seebs.net> | ||
14 | |||
15 | Upstream-Status: Backport | ||
16 | |||
17 | diff --git a/ChangeLog.txt b/ChangeLog.txt | ||
18 | index ae2a6e9..a2d30e9 100644 | ||
19 | --- a/ChangeLog.txt | ||
20 | +++ b/ChangeLog.txt | ||
21 | @@ -1,3 +1,6 @@ | ||
22 | +2017-02-24: | ||
23 | + * (seebs) import posix_acl_default fix from Anton Gerasimov | ||
24 | + <anton@advancedtelematic.com> | ||
25 | 2017-02-01: | ||
26 | * (seebs) handle xattr deletion slightly more carefully. | ||
27 | * (seebs) tag this as 1.8.2 | ||
28 | diff --git a/ports/linux/xattr/pseudo_wrappers.c b/ports/linux/xattr/pseudo_wrappers.c | ||
29 | index 46bc053..d69d53e 100644 | ||
30 | --- a/ports/linux/xattr/pseudo_wrappers.c | ||
31 | +++ b/ports/linux/xattr/pseudo_wrappers.c | ||
32 | @@ -62,9 +62,9 @@ static int | ||
33 | posix_permissions(const acl_header *header, int entries, int *extra, int *mode) { | ||
34 | int acl_seen = 0; | ||
35 | if (le32(header->version) != 2) { | ||
36 | - pseudo_diag("Fatal: ACL support no available for header version %d.\n", | ||
37 | + pseudo_diag("Fatal: ACL support not available for header version %d.\n", | ||
38 | le32(header->version)); | ||
39 | - return 1; | ||
40 | + return -1; | ||
41 | } | ||
42 | *mode = 0; | ||
43 | *extra = 0; | ||
44 | @@ -140,12 +140,38 @@ static int shared_setxattr(const char *path, int fd, const char *name, const voi | ||
45 | pseudo_debug(PDBGF_XATTR, "setxattr(%s [fd %d], %s => '%.*s')\n", | ||
46 | path ? path : "<no path>", fd, name, (int) size, (char *) value); | ||
47 | |||
48 | + /* Filter out erroneous sizes for POSIX ACL | ||
49 | + * see posix_acl_xattr_count in include/linux/posix_acl_xattr.h of Linux source code */ | ||
50 | + /* I don't think there's any posix_acl_* values that aren't in this format */ | ||
51 | + if (!strncmp(name, "system.posix_acl_", 17)) { | ||
52 | + // ACL is corrupt, issue an error | ||
53 | + if(size < sizeof(acl_header) || (size - sizeof(acl_header)) % sizeof(acl_entry) != 0) { | ||
54 | + pseudo_debug(PDBGF_XATTR, "invalid data size for %s: %d\n", | ||
55 | + name, (int) size); | ||
56 | + errno = EINVAL; | ||
57 | + return -1; | ||
58 | + } | ||
59 | + | ||
60 | + // ACL is empty, do nothing | ||
61 | + if((size - sizeof(acl_header)) / sizeof(acl_entry) == 0) { | ||
62 | + /* on some systems, "cp -a" will attempt to clone the | ||
63 | + * posix_acl_default entry for a directory (which would specify | ||
64 | + * default ACLs for new files in that directory), but if the | ||
65 | + * original was empty, we get a header but no entries. With | ||
66 | + * real xattr, that ends up being silently discarded, apparently, | ||
67 | + * so we discard it too. | ||
68 | + */ | ||
69 | + pseudo_debug(PDBGF_XATTR, "0-length ACL entry %s.\n", name); | ||
70 | + return 0; | ||
71 | + } | ||
72 | + } | ||
73 | /* this may be a plain chmod */ | ||
74 | if (!strcmp(name, "system.posix_acl_access")) { | ||
75 | int extra; | ||
76 | int mode; | ||
77 | int entries = (size - sizeof(acl_header)) / sizeof(acl_entry); | ||
78 | - if (!posix_permissions(value, entries, &extra, &mode)) { | ||
79 | + int res = posix_permissions(value, entries, &extra, &mode); | ||
80 | + if (res == 0) { | ||
81 | pseudo_debug(PDBGF_XATTR, "posix_acl_access translated to mode %04o. Remaining attribute(s): %d.\n", | ||
82 | mode, extra); | ||
83 | buf.st_mode = mode; | ||
84 | @@ -164,8 +190,12 @@ static int shared_setxattr(const char *path, int fd, const char *name, const voi | ||
85 | if (!extra) { | ||
86 | return 0; | ||
87 | } | ||
88 | + } else if (res == -1) { | ||
89 | + errno = EOPNOTSUPP; | ||
90 | + return -1; | ||
91 | } | ||
92 | } | ||
93 | + | ||
94 | if (!strcmp(name, "user.pseudo_data")) { | ||
95 | pseudo_debug(PDBGF_XATTR | PDBGF_XATTRDB, "user.pseudo_data xattribute does not get to go in database.\n"); | ||
96 | return -1; | ||
97 | -- | ||
98 | cgit v0.10.2 | ||
99 | |||
diff --git a/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb b/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb index 9e0213a9e0..b427b9ac3c 100644 --- a/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb +++ b/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb | |||
@@ -5,6 +5,8 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/pseudo/${BPN}-${PV}.tar.bz | |||
5 | file://fallback-passwd \ | 5 | file://fallback-passwd \ |
6 | file://fallback-group \ | 6 | file://fallback-group \ |
7 | file://moreretries.patch \ | 7 | file://moreretries.patch \ |
8 | file://efe0be279901006f939cd357ccee47b651c786da.patch \ | ||
9 | file://b6b68db896f9963558334aff7fca61adde4ec10f.patch \ | ||
8 | " | 10 | " |
9 | 11 | ||
10 | SRC_URI[md5sum] = "7d41e72188fbea1f696c399c1a435675" | 12 | SRC_URI[md5sum] = "7d41e72188fbea1f696c399c1a435675" |