diff options
author | Hongzhi.Song <hongzhi.song@windriver.com> | 2018-11-20 01:42:51 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-11-21 11:54:14 +0000 |
commit | f5c2e03a211424b177b9f4e465abb9c7f580c2a2 (patch) | |
tree | 59374b916d1c894508e160ba56a49eafddf6bf81 | |
parent | 707512e90a719d674c04cff06fd39b2d5e91d397 (diff) | |
download | poky-f5c2e03a211424b177b9f4e465abb9c7f580c2a2.tar.gz |
ltp: Use a legal bad address for mips in setrlimit05.c
This testcase fails on mips32. The process is killed by SIGBUS which
is not as expect.
This is because:
((void *)-1) is not a legal bad address which causes the process
killed by SIGBUG on mips.
'tst_get_bad_addr()' returns an address that should works on mips
and other arches.
(From OE-Core rev: e45948d4be14c14eff0a5c8c8597a7523f2edff1)
Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch | 61 | ||||
-rw-r--r-- | meta/recipes-extended/ltp/ltp_20180926.bb | 1 |
2 files changed, 62 insertions, 0 deletions
diff --git a/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch b/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch new file mode 100644 index 0000000000..4bfe2767d8 --- /dev/null +++ b/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch | |||
@@ -0,0 +1,61 @@ | |||
1 | From c4d02b23d12b7136b5739b3075e817fc037e41d4 Mon Sep 17 00:00:00 2001 | ||
2 | From: "Hongzhi.Song" <hongzhi.song@windriver.com> | ||
3 | Date: Mon, 19 Nov 2018 23:07:01 -0800 | ||
4 | Subject: [PATCH] setrlimit05: Use another method to get bad address | ||
5 | |||
6 | This testcase fails on mips32. The process is killed by SIGBUS which | ||
7 | is not as expect. | ||
8 | |||
9 | This is because: | ||
10 | ((void *)-1) is not a legal bad address which causes the process | ||
11 | killed by SIGBUG on mips. | ||
12 | |||
13 | 'tst_get_bad_addr()' returns an address that should works on mips | ||
14 | and other arches. | ||
15 | |||
16 | Upstream-Status: Accepted [80bed467bc6ab48a6cd88a8ab74ca15d08830cb0] | ||
17 | |||
18 | Signed-off-by: Hongzhi.Song <hongzhi.song@windriver.com> | ||
19 | --- | ||
20 | testcases/kernel/syscalls/setrlimit/setrlimit05.c | 10 +++++++++- | ||
21 | 1 file changed, 9 insertions(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit05.c b/testcases/kernel/syscalls/setrlimit/setrlimit05.c | ||
24 | index e7167229b4..004a149a65 100644 | ||
25 | --- a/testcases/kernel/syscalls/setrlimit/setrlimit05.c | ||
26 | +++ b/testcases/kernel/syscalls/setrlimit/setrlimit05.c | ||
27 | @@ -26,6 +26,8 @@ | ||
28 | |||
29 | #include "tst_test.h" | ||
30 | |||
31 | +static void *bad_addr; | ||
32 | + | ||
33 | static void verify_setrlimit(void) | ||
34 | { | ||
35 | int status; | ||
36 | @@ -33,7 +35,7 @@ static void verify_setrlimit(void) | ||
37 | |||
38 | pid = SAFE_FORK(); | ||
39 | if (!pid) { | ||
40 | - TEST(setrlimit(RLIMIT_NOFILE, (void *) -1)); | ||
41 | + TEST(setrlimit(RLIMIT_NOFILE, bad_addr)); | ||
42 | if (TST_RET != -1) { | ||
43 | tst_res(TFAIL, "setrlimit() succeeded unexpectedly"); | ||
44 | exit(0); | ||
45 | @@ -67,7 +69,13 @@ static void verify_setrlimit(void) | ||
46 | tst_res(TBROK, "child %s", tst_strstatus(status)); | ||
47 | } | ||
48 | |||
49 | +static void setup(void) | ||
50 | +{ | ||
51 | + bad_addr = tst_get_bad_addr(NULL); | ||
52 | +} | ||
53 | + | ||
54 | static struct tst_test test = { | ||
55 | .test_all = verify_setrlimit, | ||
56 | .forks_child = 1, | ||
57 | + .setup = setup, | ||
58 | }; | ||
59 | -- | ||
60 | 2.11.0 | ||
61 | |||
diff --git a/meta/recipes-extended/ltp/ltp_20180926.bb b/meta/recipes-extended/ltp/ltp_20180926.bb index 500ca0063d..e471904d8e 100644 --- a/meta/recipes-extended/ltp/ltp_20180926.bb +++ b/meta/recipes-extended/ltp/ltp_20180926.bb | |||
@@ -51,6 +51,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \ | |||
51 | file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \ | 51 | file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \ |
52 | file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \ | 52 | file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \ |
53 | file://0001-statx-fix-compile-errors.patch \ | 53 | file://0001-statx-fix-compile-errors.patch \ |
54 | file://0001-setrlimit05-Use-another-method-to-get-bad-address.patch \ | ||
54 | " | 55 | " |
55 | 56 | ||
56 | S = "${WORKDIR}/git" | 57 | S = "${WORKDIR}/git" |