summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorPetr Vorel <petr.vorel@gmail.com>2018-11-01 18:47:18 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-11-19 17:03:24 +0000
commitb98f45363349b16e8532be383a9fd4134a8458ca (patch)
tree27a6bb15e2abe985cb961d4b06ddf21dc7ce319e /meta
parent944d24eb0b82450050b333ecdef48295a018f167 (diff)
downloadpoky-b98f45363349b16e8532be383a9fd4134a8458ca.tar.gz
ltp: Update to 20180926
New patches * 0001-statx-fix-compile-errors.patch Rebased patches * 0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch Removed removed (accepted in upstream) * 0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch * 0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch * 0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch Removed patches (different fix accepted in upstream) * 0001-mmap15-mips64-return-EINVAL.patch (From OE-Core rev: 439cb0421570e1edea6994775ed782b9b264f4a1) Signed-off-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch41
-rw-r--r--meta/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch34
-rw-r--r--meta/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch42
-rw-r--r--meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch97
-rw-r--r--meta/recipes-extended/ltp/ltp/0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch34
-rw-r--r--meta/recipes-extended/ltp/ltp/0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch81
-rw-r--r--meta/recipes-extended/ltp/ltp_20180926.bb (renamed from meta/recipes-extended/ltp/ltp_20180515.bb)8
7 files changed, 58 insertions, 279 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch b/meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch
deleted file mode 100644
index 18eba27c2d..0000000000
--- a/meta/recipes-extended/ltp/ltp/0001-mmap15-mips64-return-EINVAL.patch
+++ /dev/null
@@ -1,41 +0,0 @@
1From b909805b4fc1b72e0ce299afb4abc02720ee81da Mon Sep 17 00:00:00 2001
2From: Dengke Du <dengke.du@windriver.com>
3Date: Wed, 12 Sep 2018 14:24:35 +0800
4Subject: [PATCH] mmap15: mips64 return EINVAL
5
6In mips64 kernel, system check the addr that passed to mmap:
7
8 if (TASK_SIZE - len < addr)
9 return -EINVAL;
10
11Link: https://github.com/torvalds/linux/blob/master/arch/mips/mm/mmap.c#L71
12
13Upstream-Status: Submitted [https://github.com/linux-test-project/ltp/pull/394]
14
15Signed-off-by: Dengke Du <dengke.du@windriver.com>
16---
17 testcases/kernel/syscalls/mmap/mmap15.c | 5 +++++
18 1 file changed, 5 insertions(+)
19
20diff --git a/testcases/kernel/syscalls/mmap/mmap15.c b/testcases/kernel/syscalls/mmap/mmap15.c
21index eff27d6..a10b5c7 100644
22--- a/testcases/kernel/syscalls/mmap/mmap15.c
23+++ b/testcases/kernel/syscalls/mmap/mmap15.c
24@@ -81,9 +81,14 @@ int main(int ac, char **av)
25 }
26
27 if (errno != ENOMEM) {
28+#ifdef __mips__
29+ tst_resm(TPASS | TERRNO, "mmap into high region "
30+ "failed as expected");
31+#else
32 tst_resm(TFAIL | TERRNO, "mmap into high region "
33 "failed unexpectedly - expect "
34 "errno=ENOMEM, got");
35+#endif
36 } else {
37 tst_resm(TPASS | TERRNO, "mmap into high region "
38 "failed as expected");
39--
402.7.4
41
diff --git a/meta/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch b/meta/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch
new file mode 100644
index 0000000000..c4fd8d0223
--- /dev/null
+++ b/meta/recipes-extended/ltp/ltp/0001-statx-fix-compile-errors.patch
@@ -0,0 +1,34 @@
1From a945304b6a2286d0665c70250cc5475eb07fd21e Mon Sep 17 00:00:00 2001
2From: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
3Date: Wed, 26 Sep 2018 11:15:45 -0300
4Subject: [PATCH] statx: fix compile errors
5
6struct statx is only defined in sys/stat.h when _GNU_SOURCE is defined.
7The testcases do define _GNU_SOURCE, but not the m4 struct check.
8
9Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
10Acked-by: Cyril Hrubis <chrubis@suse.cz>
11---
12 m4/ltp-statx.m4 | 9 +++++++--
13 1 file changed, 7 insertions(+), 2 deletions(-)
14
15diff --git a/m4/ltp-statx.m4 b/m4/ltp-statx.m4
16index 44303d30c..5f79a94cd 100644
17--- a/m4/ltp-statx.m4
18+++ b/m4/ltp-statx.m4
19@@ -23,6 +23,11 @@ dnl
20 AC_DEFUN([LTP_CHECK_STATX],[
21 AC_CHECK_FUNCS(statx,,,[[#include <sys/stat.h>]])
22 AC_CHECK_HEADER(linux/fs.h,,,)
23-AC_CHECK_TYPES([struct statx],,,[[#include <sys/stat.h>]])
24-AC_CHECK_TYPES([struct statx_timestamp],,,[[#include <sys/stat.h>]])
25+AC_CHECK_TYPES([struct statx],,,[[
26+ #define _GNU_SOURCE
27+ #include <sys/stat.h>
28+]])
29+AC_CHECK_TYPES([struct statx_timestamp],,,[[
30+ #define _GNU_SOURCE
31+ #include <sys/stat.h>]])
32 ])
33--
342.19.1
diff --git a/meta/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch b/meta/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch
index e7c927e116..9244a06b44 100644
--- a/meta/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch
+++ b/meta/recipes-extended/ltp/ltp/0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch
@@ -21,16 +21,18 @@ Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
21 1 file changed, 52 insertions(+), 40 deletions(-) 21 1 file changed, 52 insertions(+), 40 deletions(-)
22 22
23diff --git a/testcases/commands/ar/ar01 b/testcases/commands/ar/ar01 23diff --git a/testcases/commands/ar/ar01 b/testcases/commands/ar/ar01
24index ddab2e0..d688f76 100644 24index be105f6da..813a51d9c 100644
25--- a/testcases/commands/ar/ar01 25--- a/testcases/commands/ar/ar01
26+++ b/testcases/commands/ar/ar01 26+++ b/testcases/commands/ar/ar01
27@@ -23,14 +23,26 @@ 27@@ -24,16 +24,28 @@
28 # This is a basic ar command test.
29 # 28 #
29 AR="${AR:=ar}"
30 TST_CNT=17 30 TST_CNT=17
31+TST_SETUP=setup 31+TST_SETUP=setup
32 TST_TESTFUNC=test 32 TST_TESTFUNC=test
33 TST_NEEDS_TMPDIR=1 33 TST_NEEDS_TMPDIR=1
34 TST_NEEDS_CMDS="$AR"
35
34 . tst_test.sh 36 . tst_test.sh
35 37
36+setup() 38+setup()
@@ -53,7 +55,7 @@ index ddab2e0..d688f76 100644
53 ROD ar -t lib.a \> ar.out 55 ROD ar -t lib.a \> ar.out
54 56
55 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp 57 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp
56@@ -47,9 +59,9 @@ test1() 58@@ -50,9 +62,9 @@ test1()
57 59
58 test2() 60 test2()
59 { 61 {
@@ -66,7 +68,7 @@ index ddab2e0..d688f76 100644
66 ROD ar -t lib.a \> ar.out 68 ROD ar -t lib.a \> ar.out
67 69
68 printf "file1.in\nfile4.in\nfile2.in\nfile3.in\n" > ar.exp 70 printf "file1.in\nfile4.in\nfile2.in\nfile3.in\n" > ar.exp
69@@ -66,8 +78,8 @@ test2() 71@@ -69,8 +81,8 @@ test2()
70 72
71 test3() 73 test3()
72 { 74 {
@@ -77,7 +79,7 @@ index ddab2e0..d688f76 100644
77 ROD ar -t lib.a \> ar.out 79 ROD ar -t lib.a \> ar.out
78 80
79 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp 81 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp
80@@ -84,9 +96,9 @@ test3() 82@@ -87,9 +99,9 @@ test3()
81 83
82 test4() 84 test4()
83 { 85 {
@@ -90,7 +92,7 @@ index ddab2e0..d688f76 100644
90 ROD ar -t lib.a \> ar.out 92 ROD ar -t lib.a \> ar.out
91 93
92 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp 94 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp
93@@ -103,7 +115,7 @@ test4() 95@@ -106,7 +118,7 @@ test4()
94 96
95 test5() 97 test5()
96 { 98 {
@@ -99,7 +101,7 @@ index ddab2e0..d688f76 100644
99 101
100 if [ -s ar.out ]; then 102 if [ -s ar.out ]; then
101 tst_res TFAIL "ar produced output unexpectedly (-c)" 103 tst_res TFAIL "ar produced output unexpectedly (-c)"
102@@ -117,7 +129,7 @@ test5() 104@@ -120,7 +132,7 @@ test5()
103 105
104 test6() 106 test6()
105 { 107 {
@@ -108,7 +110,7 @@ index ddab2e0..d688f76 100644
108 110
109 if [ -s ar.out ]; then 111 if [ -s ar.out ]; then
110 tst_res TFAIL "ar produced output unexpectedly (-qc)" 112 tst_res TFAIL "ar produced output unexpectedly (-qc)"
111@@ -131,9 +143,9 @@ test6() 113@@ -134,9 +146,9 @@ test6()
112 114
113 test7() 115 test7()
114 { 116 {
@@ -121,7 +123,7 @@ index ddab2e0..d688f76 100644
121 ROD ar -t lib.a \> ar.out 123 ROD ar -t lib.a \> ar.out
122 124
123 printf "file3.in\n" > ar.exp 125 printf "file3.in\n" > ar.exp
124@@ -150,9 +162,9 @@ test7() 126@@ -153,9 +165,9 @@ test7()
125 127
126 test8() 128 test8()
127 { 129 {
@@ -134,7 +136,7 @@ index ddab2e0..d688f76 100644
134 ROD ar -t lib.a \> ar.out 136 ROD ar -t lib.a \> ar.out
135 137
136 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp 138 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp
137@@ -169,8 +181,8 @@ test8() 139@@ -172,8 +184,8 @@ test8()
138 140
139 test9() 141 test9()
140 { 142 {
@@ -145,7 +147,7 @@ index ddab2e0..d688f76 100644
145 ROD ar -t lib.a \> ar.out 147 ROD ar -t lib.a \> ar.out
146 148
147 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp 149 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp
148@@ -187,9 +199,9 @@ test9() 150@@ -190,9 +202,9 @@ test9()
149 151
150 test10() 152 test10()
151 { 153 {
@@ -158,7 +160,7 @@ index ddab2e0..d688f76 100644
158 ROD ar -t lib.a \> ar.out 160 ROD ar -t lib.a \> ar.out
159 161
160 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp 162 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp
161@@ -206,9 +218,9 @@ test10() 163@@ -209,9 +221,9 @@ test10()
162 164
163 test11() 165 test11()
164 { 166 {
@@ -171,7 +173,7 @@ index ddab2e0..d688f76 100644
171 ROD ar -t lib.a \> ar.out 173 ROD ar -t lib.a \> ar.out
172 174
173 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp 175 printf "file1.in\nfile2.in\nfile3.in\n" > ar.exp
174@@ -225,9 +237,9 @@ test11() 176@@ -228,9 +240,9 @@ test11()
175 177
176 test12() 178 test12()
177 { 179 {
@@ -184,7 +186,7 @@ index ddab2e0..d688f76 100644
184 186
185 printf "This is file one\nThis is file two\nThis is file three\n" > ar.exp 187 printf "This is file one\nThis is file two\nThis is file three\n" > ar.exp
186 188
187@@ -244,9 +256,9 @@ test12() 189@@ -247,9 +259,9 @@ test12()
188 test13() 190 test13()
189 { 191 {
190 192
@@ -197,7 +199,7 @@ index ddab2e0..d688f76 100644
197 ROD ar -t lib.a \> ar.out 199 ROD ar -t lib.a \> ar.out
198 200
199 printf "file1.in\nfile2.in\nfile3.in\nfile4.in\n" > ar.exp 201 printf "file1.in\nfile2.in\nfile3.in\nfile4.in\n" > ar.exp
200@@ -264,14 +276,14 @@ test13() 202@@ -267,14 +279,14 @@ test13()
201 test14() 203 test14()
202 { 204 {
203 ROD touch file0.in 205 ROD touch file0.in
@@ -214,7 +216,7 @@ index ddab2e0..d688f76 100644
214 216
215 file0_mtime2=$(ar -tv lib.a | grep file0.in) 217 file0_mtime2=$(ar -tv lib.a | grep file0.in)
216 file1_mtime2=$(ar -tv lib.a | grep file1.in) 218 file1_mtime2=$(ar -tv lib.a | grep file1.in)
217@@ -293,7 +305,7 @@ test14() 219@@ -296,7 +308,7 @@ test14()
218 220
219 test15() 221 test15()
220 { 222 {
@@ -223,7 +225,7 @@ index ddab2e0..d688f76 100644
223 ROD ar -tv lib.a \> ar.out 225 ROD ar -tv lib.a \> ar.out
224 226
225 if grep -q '[rwx-]\{9\} [0-9].*/[0-9].*\s*[0-9].*.*file1.in' ar.out; then 227 if grep -q '[rwx-]\{9\} [0-9].*/[0-9].*\s*[0-9].*.*file1.in' ar.out; then
226@@ -308,9 +320,9 @@ test15() 228@@ -311,9 +323,9 @@ test15()
227 229
228 test16() 230 test16()
229 { 231 {
@@ -236,7 +238,7 @@ index ddab2e0..d688f76 100644
236 238
237 printf "x - file1.in\nx - file2.in\nx - file3.in\n" > ar.exp 239 printf "x - file1.in\nx - file2.in\nx - file3.in\n" > ar.exp
238 240
239@@ -332,8 +344,8 @@ test16() 241@@ -335,8 +347,8 @@ test16()
240 242
241 test17() 243 test17()
242 { 244 {
@@ -248,5 +250,5 @@ index ddab2e0..d688f76 100644
248 printf "x - file2.in\n" > ar.exp 250 printf "x - file2.in\n" > ar.exp
249 251
250-- 252--
2512.7.4 2532.19.0.rc2
252 254
diff --git a/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch b/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch
deleted file mode 100644
index 0d2d2cbce4..0000000000
--- a/meta/recipes-extended/ltp/ltp/0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch
+++ /dev/null
@@ -1,97 +0,0 @@
1From b767b73ef027ba8d35f297c7d3659265ac80425b Mon Sep 17 00:00:00 2001
2From: Rafael David Tinoco <rafael.tinoco@canonical.com>
3Date: Wed, 30 May 2018 09:14:34 -0300
4Subject: [PATCH] cve-2017-5669: shmat() for 0 (or <PAGESIZE with RND flag) has
5 to fail with REMAPs
6
7Fixes: https://github.com/linux-test-project/ltp/issues/319
8
9According to upstream thread (https://lkml.org/lkml/2018/5/28/2056),
10cve-2017-5669 needs to address the "new" way of handling nil addresses
11for shmat() when used with MAP_FIXED or SHM_REMAP flags.
12
13- mapping nil-page is OK on lower addresses with MAP_FIXED (or else X11 is broken)
14- mapping nil-page is NOT OK with SHM_REMAP on lower addresses
15
16Addresses Davidlohr Bueso's comments/changes:
17
18commit 8f89c007b6de
19Author: Davidlohr Bueso <dave@stgolabs.net>
20Date: Fri May 25 14:47:30 2018 -0700
21
22 ipc/shm: fix shmat() nil address after round-down when remapping
23
24commit a73ab244f0da
25Author: Davidlohr Bueso <dave@stgolabs.net>
26Date: Fri May 25 14:47:27 2018 -0700
27
28 Revert "ipc/shm: Fix shmat mmap nil-page protection"
29
30For previously test, and now broken, made based on:
31
32commit 95e91b831f87
33Author: Davidlohr Bueso <dave@stgolabs.net>
34Date: Mon Feb 27 14:28:24 2017 -0800
35
36 ipc/shm: Fix shmat mmap nil-page protection
37
38Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
39Tested-by: Naresh Kamboju <naresh.kamboju@linaro.org>
40Reviewed-by: Jan Stancek <jstancek@redhat.com>
41
42Upstream-Status: Accepted [https://github.com/linux-test-project/ltp/pull/324]
43CVE: CVE-2017-5669
44Signed-off-by: Rafael David Tinoco <rafael.tinoco@linaro.org>
45---
46 testcases/cve/cve-2017-5669.c | 20 +++++++++++++++++++-
47 1 file changed, 19 insertions(+), 1 deletion(-)
48
49diff --git a/testcases/cve/cve-2017-5669.c b/testcases/cve/cve-2017-5669.c
50index 1ca5983..0834626 100644
51--- a/testcases/cve/cve-2017-5669.c
52+++ b/testcases/cve/cve-2017-5669.c
53@@ -28,7 +28,20 @@
54 * is just to see if we get an access error or some other unexpected behaviour.
55 *
56 * See commit 95e91b831f (ipc/shm: Fix shmat mmap nil-page protection)
57+ *
58+ * The commit above disallowed SHM_RND maps to zero (and rounded) entirely and
59+ * that broke userland for cases like Xorg. New behavior disallows REMAPs to
60+ * lower addresses (0<=PAGESIZE).
61+ *
62+ * See commit a73ab244f0da (Revert "ipc/shm: Fix shmat mmap nil-page protect...)
63+ * See commit 8f89c007b6de (ipc/shm: fix shmat() nil address after round-dow...)
64+ * See https://github.com/linux-test-project/ltp/issues/319
65+ *
66+ * This test needs root permissions or else security_mmap_addr(), from
67+ * get_unmapped_area(), will cause permission errors when trying to mmap lower
68+ * addresses.
69 */
70+
71 #include <sys/types.h>
72 #include <sys/ipc.h>
73 #include <sys/shm.h>
74@@ -60,7 +73,11 @@ static void cleanup(void)
75 static void run(void)
76 {
77 tst_res(TINFO, "Attempting to attach shared memory to null page");
78- shm_addr = shmat(shm_id, ((void *)1), SHM_RND);
79+ /*
80+ * shmat() for 0 (or < PAGESIZE with RND flag) has to fail with REMAPs
81+ * https://github.com/linux-test-project/ltp/issues/319
82+ */
83+ shm_addr = shmat(shm_id, ((void *)1), SHM_RND | SHM_REMAP);
84 if (shm_addr == (void *)-1) {
85 shm_addr = NULL;
86 if (errno == EINVAL) {
87@@ -89,6 +106,7 @@ static void run(void)
88 }
89
90 static struct tst_test test = {
91+ .needs_root = 1,
92 .setup = setup,
93 .cleanup = cleanup,
94 .test_all = run,
95--
962.7.4
97
diff --git a/meta/recipes-extended/ltp/ltp/0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch b/meta/recipes-extended/ltp/ltp/0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch
deleted file mode 100644
index 407d98eff0..0000000000
--- a/meta/recipes-extended/ltp/ltp/0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch
+++ /dev/null
@@ -1,34 +0,0 @@
1From baeef026f80e19a634a4096e97286419aca1cf68 Mon Sep 17 00:00:00 2001
2From: He Zhe <zhe.he@windriver.com>
3Date: Thu, 23 Aug 2018 00:22:04 +0800
4Subject: [PATCH] fs/ftest/ftest06.c: Fix too small name string and related
5 failure
6
7The name string is too small to contain normal full path names and causes
8the following failure.
9
10"ftest06 2 TFAIL : ftest06.c:223: Can't chdir(): errno=ENOENT(2): No such file or directory"
11
12Upstream-Status: Submitted [ltp-list@lists.sourceforge.net]
13
14Signed-off-by: He Zhe <zhe.he@windriver.com>
15---
16 testcases/kernel/fs/ftest/ftest06.c | 2 +-
17 1 file changed, 1 insertion(+), 1 deletion(-)
18
19diff --git a/testcases/kernel/fs/ftest/ftest06.c b/testcases/kernel/fs/ftest/ftest06.c
20index 2ca7c88..b434067 100644
21--- a/testcases/kernel/fs/ftest/ftest06.c
22+++ b/testcases/kernel/fs/ftest/ftest06.c
23@@ -100,7 +100,7 @@ static char *fstyp;
24 int main(int ac, char *av[])
25 {
26 int pid, child, status, count, k, j;
27- char name[3];
28+ char name[MAXPATHLEN];
29
30 int lc;
31
32--
332.7.4
34
diff --git a/meta/recipes-extended/ltp/ltp/0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch b/meta/recipes-extended/ltp/ltp/0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch
deleted file mode 100644
index dc61fcc039..0000000000
--- a/meta/recipes-extended/ltp/ltp/0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch
+++ /dev/null
@@ -1,81 +0,0 @@
1From 3c87ef2961dedb10d1f674c6a530e00dbab8ec1b Mon Sep 17 00:00:00 2001
2From: Jan Stancek <jstancek@redhat.com>
3Date: Tue, 17 Jul 2018 10:26:39 +0200
4Subject: [PATCH] open|creat: skip S_ISGID check on files created by non-group
5 members
6
70fa3ecd87848 ("Fix up non-directory creation in SGID directories")
8fixes problem described in CVE-2018-13405. This commit is getting
9backported to older streams as well.
10
11This patch removes S_ISGID check for files created by non-group members
12in LTP tests creat08 and open10.
13
14Once 0fa3ecd87848 will be in non-rc kernel, we could add a new test
15for this CVE that would be limited to 4.18+ kernels.
16
17Signed-off-by: Jan Stancek <jstancek@redhat.com>
18Acked-by: Cyril Hrubis <chrubis@suse.cz>
19Reviewed-by: Naresh Kamboju <naresh.kamboju@linaro.org>
20
21Upstream-Status: Backport
22[ git://github.com/linux-test-project/ltp.git
23 3c87ef2961dedb10d1f674c6a530e00dbab8ec1b
24 "open|creat: skip S_ISGID check on files created by non-group members" ]
25
26Signed-off-by: He Zhe <zhe.he@windriver.com>
27---
28 testcases/kernel/syscalls/creat/creat08.c | 13 ++++++-------
29 testcases/kernel/syscalls/open/open10.c | 12 +++++-------
30 2 files changed, 11 insertions(+), 14 deletions(-)
31
32diff --git a/testcases/kernel/syscalls/creat/creat08.c b/testcases/kernel/syscalls/creat/creat08.c
33index 50f2b3993..d22558ac3 100644
34--- a/testcases/kernel/syscalls/creat/creat08.c
35+++ b/testcases/kernel/syscalls/creat/creat08.c
36@@ -361,13 +361,12 @@ int main(int ac, char **av)
37 local_flag = FAILED;
38 }
39
40- /* Verify modes */
41- if (!(buf.st_mode & S_ISGID)) {
42- tst_resm(TFAIL,
43- "%s: Incorrect modes, setgid bit should be set",
44- setgid_B);
45- local_flag = FAILED;
46- }
47+ /*
48+ * Skip S_ISGID check
49+ * 0fa3ecd87848 ("Fix up non-directory creation in SGID directories")
50+ * clears S_ISGID for files created by non-group members
51+ */
52+
53 close(fd);
54
55 if (local_flag == PASSED) {
56diff --git a/testcases/kernel/syscalls/open/open10.c b/testcases/kernel/syscalls/open/open10.c
57index 613f2288f..14feec9e1 100644
58--- a/testcases/kernel/syscalls/open/open10.c
59+++ b/testcases/kernel/syscalls/open/open10.c
60@@ -345,13 +345,11 @@ int main(int ac, char *av[])
61 local_flag = FAILED;
62 }
63
64- /* Verify modes */
65- if (!(buf.st_mode & S_ISGID)) {
66- tst_resm(TFAIL,
67- "%s: Incorrect modes, setgid bit not set",
68- setgid_B);
69- local_flag = FAILED;
70- }
71+ /*
72+ * Skip S_ISGID check
73+ * 0fa3ecd87848 ("Fix up non-directory creation in SGID directories")
74+ * clears S_ISGID for files created by non-group members
75+ */
76
77 if (local_flag == PASSED) {
78 tst_resm(TPASS, "Test passed in block2.");
79--
802.11.0
81
diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180926.bb
index ff85be723f..622c1f42f7 100644
--- a/meta/recipes-extended/ltp/ltp_20180515.bb
+++ b/meta/recipes-extended/ltp/ltp_20180926.bb
@@ -11,7 +11,6 @@ LIC_FILES_CHKSUM = "\
11 file://testcases/kernel/hotplug/cpu_hotplug/COPYING;md5=e04a2e542b2b8629bf9cd2ba29b0fe41 \ 11 file://testcases/kernel/hotplug/cpu_hotplug/COPYING;md5=e04a2e542b2b8629bf9cd2ba29b0fe41 \
12 file://testcases/open_posix_testsuite/COPYING;md5=48b1c5ec633e3e30ec2cf884ae699947 \ 12 file://testcases/open_posix_testsuite/COPYING;md5=48b1c5ec633e3e30ec2cf884ae699947 \
13 file://testcases/realtime/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \ 13 file://testcases/realtime/COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e \
14 file://tools/pounder21/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
15 file://utils/benchmark/kernbench-0.42/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ 14 file://utils/benchmark/kernbench-0.42/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \
16 file://utils/ffsb-6.0-rc2/COPYING;md5=c46082167a314d785d012a244748d803 \ 15 file://utils/ffsb-6.0-rc2/COPYING;md5=c46082167a314d785d012a244748d803 \
17" 16"
@@ -28,10 +27,9 @@ CFLAGS_append_x86-64 = " -fomit-frame-pointer"
28 27
29CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__" 28CFLAGS_append_powerpc64 = " -D__SANE_USERSPACE_TYPES__"
30CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__" 29CFLAGS_append_mipsarchn64 = " -D__SANE_USERSPACE_TYPES__"
31SRCREV = "96cbf48313afa65ef4d693d3441cbfd60a8d9b27" 30SRCREV = "f424769b1ad9fca477118763f88a6cec98ea2c0a"
32 31
33SRC_URI = "git://github.com/linux-test-project/ltp.git \ 32SRC_URI = "git://github.com/linux-test-project/ltp.git \
34 file://0001-mmap15-mips64-return-EINVAL.patch \
35 file://0004-build-Add-option-to-select-libc-implementation.patch \ 33 file://0004-build-Add-option-to-select-libc-implementation.patch \
36 file://0005-kernel-controllers-Link-with-libfts-explicitly-on-mu.patch \ 34 file://0005-kernel-controllers-Link-with-libfts-explicitly-on-mu.patch \
37 file://0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch \ 35 file://0007-fix-__WORDSIZE-undeclared-when-building-with-musl.patch \
@@ -49,13 +47,11 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
49 file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \ 47 file://0036-testcases-network-nfsv4-acl-acl1.c-Security-fix-on-s.patch \
50 file://0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch \ 48 file://0039-commands-ar01-Fix-for-test-in-deterministic-mode.patch \
51 file://0040-read_all-Define-FNM_EXTMATCH-if-not-already-like-und.patch \ 49 file://0040-read_all-Define-FNM_EXTMATCH-if-not-already-like-und.patch \
52 file://0041-cve-2017-5669-shmat-for-0-or-PAGESIZE-with-RND-flag-.patch \
53 file://0042-fs-ftest-ftest06.c-Fix-too-small-name-string-and-rel.patch \
54 file://0043-open-creat-skip-S_ISGID-check-on-files-created-by-no.patch \
55 file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \ 50 file://0001-syscalls-fcntl-make-OFD-command-use-fcntl64-syscall-.patch \
56 file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \ 51 file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \
57 file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \ 52 file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \
58 file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \ 53 file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
54 file://0001-statx-fix-compile-errors.patch \
59 " 55 "
60 56
61S = "${WORKDIR}/git" 57S = "${WORKDIR}/git"