diff options
author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2015-12-09 18:09:58 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-16 12:12:17 +0000 |
commit | d3014511cb403f1b6348570d8150fc93100b8c28 (patch) | |
tree | 26223fb7cc2f5fa8038868fbbf3c9e81f5abc2b8 /meta/recipes-extended/cpio/cpio-2.12 | |
parent | 2bea0066b00a4b53d92ca85b540a44c24feb233f (diff) | |
download | poky-d3014511cb403f1b6348570d8150fc93100b8c28.tar.gz |
cpio: update to 2.12
Drop backported patches:
Fix-symlink-bad-length-test-for-64-bit-architectures.patch
fix-memory-overrun.patch
fix-testcase-symlink-bad-lengths.patch
0001-fix-testcase-of-symlink-bad-length.patch
statdef.patch is fixing code that doesn't exist anymore.
The problem handled by remove-gets.patch has been fixed differently.
The CVE-2015-1197 has been ignored by upstream and had to be rebased:
http://lists.gnu.org/archive/html/bug-cpio/2015-09/msg00007.html
(From OE-Core rev: feeaa86eb8b1071d56eb6d7ad7120aa389c736a0)
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-extended/cpio/cpio-2.12')
-rw-r--r-- | meta/recipes-extended/cpio/cpio-2.12/0001-Fix-CVE-2015-1197.patch | 177 | ||||
-rw-r--r-- | meta/recipes-extended/cpio/cpio-2.12/0001-Unset-need_charset_alias-when-building-for-musl.patch | 30 |
2 files changed, 207 insertions, 0 deletions
diff --git a/meta/recipes-extended/cpio/cpio-2.12/0001-Fix-CVE-2015-1197.patch b/meta/recipes-extended/cpio/cpio-2.12/0001-Fix-CVE-2015-1197.patch new file mode 100644 index 0000000000..8f719ad8d6 --- /dev/null +++ b/meta/recipes-extended/cpio/cpio-2.12/0001-Fix-CVE-2015-1197.patch | |||
@@ -0,0 +1,177 @@ | |||
1 | From dcee489f821c1260a0136fcdfdb6ff4dd11086ac Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | ||
3 | Date: Wed, 9 Dec 2015 17:58:03 +0200 | ||
4 | Subject: [PATCH] Fix CVE-2015-1197 | ||
5 | |||
6 | Apply patch by Vitezslav Cizek of SuSE to fix CVE-2015-1197. | ||
7 | Upstream is dormant or no longer existing. To restore the old | ||
8 | behaviour use --extract-over-symlinks (Closes: #774669) | ||
9 | This issue has been discovered by Alexander Cherepanov. | ||
10 | Author: Vitezslav Cizek <vcizek@suse.cz> | ||
11 | Bug-Debian: https://bugs.debian.org/774669 | ||
12 | |||
13 | Upstream-Status: Pending | ||
14 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
15 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
16 | |||
17 | --- | ||
18 | doc/cpio.1 | 1 + | ||
19 | src/copyin.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
20 | src/extern.h | 1 + | ||
21 | src/global.c | 3 +++ | ||
22 | src/main.c | 7 +++++++ | ||
23 | 5 files changed, 74 insertions(+) | ||
24 | |||
25 | diff --git a/doc/cpio.1 b/doc/cpio.1 | ||
26 | index 2a68241..dc4676c 100644 | ||
27 | --- a/doc/cpio.1 | ||
28 | +++ b/doc/cpio.1 | ||
29 | @@ -49,6 +49,7 @@ cpio \- copy files to and from archives | ||
30 | [\fB\-\-no\-preserve\-owner\fR] [\fB\-\-message=\fIMESSAGE\fR] | ||
31 | [\fB\-\-force\-local\fR] [\fB\-\-no\-absolute\-filenames\fR] [\fB\-\-sparse\fR] | ||
32 | [\fB\-\-only\-verify\-crc\fR] [\fB\-\-to\-stdout\fR] [\fB\-\-quiet\fR] | ||
33 | +[\fB\-\-extract\-over\-symlinks\fR] | ||
34 | [\fB\-\-rsh\-command=\fICOMMAND\fR] | ||
35 | [\fIpattern\fR...] [\fB<\fR \fIarchive\fR] | ||
36 | |||
37 | diff --git a/src/copyin.c b/src/copyin.c | ||
38 | index cde911e..053afe7 100644 | ||
39 | --- a/src/copyin.c | ||
40 | +++ b/src/copyin.c | ||
41 | @@ -695,6 +695,51 @@ copyin_link (struct cpio_file_stat *file_hdr, int in_file_des) | ||
42 | free (link_name); | ||
43 | } | ||
44 | |||
45 | + | ||
46 | +static int | ||
47 | +path_contains_symlink(char *path) | ||
48 | +{ | ||
49 | + struct stat st; | ||
50 | + char *slash; | ||
51 | + char *nextslash; | ||
52 | + | ||
53 | + /* we got NULL pointer or empty string */ | ||
54 | + if (!path || !*path) { | ||
55 | + return false; | ||
56 | + } | ||
57 | + | ||
58 | + slash = path; | ||
59 | + | ||
60 | + while ((nextslash = strchr(slash + 1, '/')) != NULL) { | ||
61 | + slash = nextslash; | ||
62 | + *slash = '\0'; | ||
63 | + | ||
64 | + if (lstat(path, &st) != 0) { | ||
65 | + if (errno == ELOOP) { | ||
66 | + /* ELOOP - too many symlinks */ | ||
67 | + *slash = '/'; | ||
68 | + return true; | ||
69 | + } else if (errno == ENOMEM) { | ||
70 | + /* No memory for lstat - terminate */ | ||
71 | + xalloc_die(); | ||
72 | + } else { | ||
73 | + /* cannot lstat path - give up */ | ||
74 | + *slash = '/'; | ||
75 | + return false; | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
79 | + if (S_ISLNK(st.st_mode)) { | ||
80 | + *slash = '/'; | ||
81 | + return true; | ||
82 | + } | ||
83 | + | ||
84 | + *slash = '/'; | ||
85 | + } | ||
86 | + | ||
87 | + return false; | ||
88 | +} | ||
89 | + | ||
90 | static void | ||
91 | copyin_file (struct cpio_file_stat *file_hdr, int in_file_des) | ||
92 | { | ||
93 | @@ -1468,6 +1513,23 @@ process_copy_in () | ||
94 | { | ||
95 | /* Copy the input file into the directory structure. */ | ||
96 | |||
97 | + /* Can we write files over symlinks? */ | ||
98 | + if (!extract_over_symlinks) | ||
99 | + { | ||
100 | + if (path_contains_symlink(file_hdr.c_name)) | ||
101 | + { | ||
102 | + /* skip the file */ | ||
103 | + /* | ||
104 | + fprintf(stderr, "Can't write over symlinks. Skipping %s\n", file_hdr.c_name); | ||
105 | + tape_toss_input (in_file_des, file_hdr.c_filesize); | ||
106 | + tape_skip_padding (in_file_des, file_hdr.c_filesize); | ||
107 | + continue; | ||
108 | + */ | ||
109 | + /* terminate */ | ||
110 | + error (1, 0, _("Can't write over symlinks: %s\n"), file_hdr.c_name); | ||
111 | + } | ||
112 | + } | ||
113 | + | ||
114 | /* Do we need to rename the file? */ | ||
115 | if (rename_flag || rename_batch_file) | ||
116 | { | ||
117 | diff --git a/src/extern.h b/src/extern.h | ||
118 | index e27d662..d864bde 100644 | ||
119 | --- a/src/extern.h | ||
120 | +++ b/src/extern.h | ||
121 | @@ -96,6 +96,7 @@ extern char input_is_special; | ||
122 | extern char output_is_special; | ||
123 | extern char input_is_seekable; | ||
124 | extern char output_is_seekable; | ||
125 | +extern bool extract_over_symlinks; | ||
126 | extern int (*xstat) (); | ||
127 | extern void (*copy_function) (); | ||
128 | extern char *change_directory_option; | ||
129 | diff --git a/src/global.c b/src/global.c | ||
130 | index 57e505a..336fce4 100644 | ||
131 | --- a/src/global.c | ||
132 | +++ b/src/global.c | ||
133 | @@ -187,6 +187,9 @@ bool to_stdout_option = false; | ||
134 | /* The name this program was run with. */ | ||
135 | char *program_name; | ||
136 | |||
137 | +/* Extract files over symbolic links */ | ||
138 | +bool extract_over_symlinks; | ||
139 | + | ||
140 | /* A pointer to either lstat or stat, depending on whether | ||
141 | dereferencing of symlinks is done for input files. */ | ||
142 | int (*xstat) (); | ||
143 | diff --git a/src/main.c b/src/main.c | ||
144 | index a13861f..87cb309 100644 | ||
145 | --- a/src/main.c | ||
146 | +++ b/src/main.c | ||
147 | @@ -59,6 +59,7 @@ enum cpio_options { | ||
148 | DEBUG_OPTION, | ||
149 | BLOCK_SIZE_OPTION, | ||
150 | TO_STDOUT_OPTION, | ||
151 | + EXTRACT_OVER_SYMLINKS, | ||
152 | RENUMBER_INODES_OPTION, | ||
153 | IGNORE_DEVNO_OPTION, | ||
154 | DEVICE_INDEPENDENT_OPTION | ||
155 | @@ -243,6 +244,8 @@ static struct argp_option options[] = { | ||
156 | N_("Create leading directories where needed"), GRID+1 }, | ||
157 | {"no-preserve-owner", NO_PRESERVE_OWNER_OPTION, 0, 0, | ||
158 | N_("Do not change the ownership of the files"), GRID+1 }, | ||
159 | + {"extract-over-symlinks", EXTRACT_OVER_SYMLINKS, 0, 0, | ||
160 | + N_("Force writing over symbolic links"), GRID+1 }, | ||
161 | {"unconditional", 'u', NULL, 0, | ||
162 | N_("Replace all files unconditionally"), GRID+1 }, | ||
163 | {"sparse", SPARSE_OPTION, NULL, 0, | ||
164 | @@ -432,6 +435,10 @@ crc newc odc bin ustar tar (all-caps also recognized)"), arg)); | ||
165 | no_chown_flag = true; | ||
166 | break; | ||
167 | |||
168 | + case EXTRACT_OVER_SYMLINKS: /* --extract-over-symlinks */ | ||
169 | + extract_over_symlinks = true; | ||
170 | + break; | ||
171 | + | ||
172 | case 'o': /* Copy-out mode. */ | ||
173 | if (copy_function != 0) | ||
174 | USAGE_ERROR ((0, 0, _("Mode already defined"))); | ||
175 | -- | ||
176 | 2.6.2 | ||
177 | |||
diff --git a/meta/recipes-extended/cpio/cpio-2.12/0001-Unset-need_charset_alias-when-building-for-musl.patch b/meta/recipes-extended/cpio/cpio-2.12/0001-Unset-need_charset_alias-when-building-for-musl.patch new file mode 100644 index 0000000000..6ae213942c --- /dev/null +++ b/meta/recipes-extended/cpio/cpio-2.12/0001-Unset-need_charset_alias-when-building-for-musl.patch | |||
@@ -0,0 +1,30 @@ | |||
1 | From b9565dc2fe0c4f7daaec91b7e83bc7313dee2f4a Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Mon, 13 Apr 2015 17:02:13 -0700 | ||
4 | Subject: [PATCH] Unset need_charset_alias when building for musl | ||
5 | |||
6 | localcharset uses ac_cv_gnu_library_2_1 from glibc21.m4 | ||
7 | which actually shoudl be fixed in gnulib and then all downstream | ||
8 | projects will get it eventually. For now we apply the fix to | ||
9 | coreutils | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | |||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | --- | ||
15 | lib/gnulib.mk | 2 +- | ||
16 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
17 | |||
18 | Index: cpio-2.11/gnu/Makefile.am | ||
19 | =================================================================== | ||
20 | --- cpio-2.11.orig/gnu/Makefile.am | ||
21 | +++ cpio-2.11/gnu/Makefile.am | ||
22 | @@ -734,7 +734,7 @@ install-exec-localcharset: all-local | ||
23 | case '$(host_os)' in \ | ||
24 | darwin[56]*) \ | ||
25 | need_charset_alias=true ;; \ | ||
26 | - darwin* | cygwin* | mingw* | pw32* | cegcc*) \ | ||
27 | + darwin* | cygwin* | mingw* | pw32* | cegcc* | linux-musl*) \ | ||
28 | need_charset_alias=false ;; \ | ||
29 | *) \ | ||
30 | need_charset_alias=true ;; \ | ||