[OE-core] [PATCH] ltp: kernel/syscall/setrlimit05.c: use a legal bad address for mips

Hongzhi, Song hongzhi.song at windriver.com
Tue Nov 13 01:06:24 UTC 2018


ping

--Hongzhi


On 11/08/2018 03:31 PM, Hongzhi.Song wrote:
> 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.
>
> Signed-off-by: Hongzhi.Song <hongzhi.song at windriver.com>
> ---
>   ...t05-Use-another-method-to-get-bad-address.patch | 61 ++++++++++++++++++++++
>   meta/recipes-extended/ltp/ltp_20180515.bb          |  1 +
>   2 files changed, 62 insertions(+)
>   create mode 100644 meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
>
> 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 0000000..dd688e4
> --- /dev/null
> +++ b/meta/recipes-extended/ltp/ltp/0001-setrlimit05-Use-another-method-to-get-bad-address.patch
> @@ -0,0 +1,61 @@
> +From ff1678f02fdf08e8b7cfca4d0d5aa7815b30957c Mon Sep 17 00:00:00 2001
> +From: "Hongzhi.Song" <hongzhi.song at windriver.com>
> +Date: Thu, 8 Nov 2018 01:30:53 -0500
> +Subject: [PATCH] setrlimit05: Use another method to get bad address
> +
> +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.
> +
> +Upstream-Status: Accepted [80bed467bc6ab48a6cd88a8ab74ca15d08830cb0]
> +
> +Signed-off-by: Hongzhi.Song <hongzhi.song at windriver.com>
> +---
> + testcases/kernel/syscalls/setrlimit/setrlimit05.c | 10 +++++++++-
> + 1 file changed, 9 insertions(+), 1 deletion(-)
> +
> +diff --git a/testcases/kernel/syscalls/setrlimit/setrlimit05.c b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
> +index 7ea7d62..61ac7c6 100644
> +--- a/testcases/kernel/syscalls/setrlimit/setrlimit05.c
> ++++ b/testcases/kernel/syscalls/setrlimit/setrlimit05.c
> +@@ -26,6 +26,8 @@
> +
> + #include "tst_test.h"
> +
> ++static void *bad_addr;
> ++
> + static void verify_setrlimit(void)
> + {
> + 	int status;
> +@@ -33,7 +35,7 @@ static void verify_setrlimit(void)
> +
> + 	pid = SAFE_FORK();
> + 	if (!pid) {
> +-		TEST(setrlimit(RLIMIT_NOFILE, (void *) -1));
> ++		TEST(setrlimit(RLIMIT_NOFILE, bad_addr));
> + 		if (TEST_RETURN != -1) {
> + 			tst_res(TFAIL, "setrlimit()  succeeded unexpectedly");
> + 			exit(0);
> +@@ -67,7 +69,13 @@ static void verify_setrlimit(void)
> + 	tst_res(TBROK, "child %s", tst_strstatus(status));
> + }
> +
> ++static void setup(void)
> ++{
> ++	bad_addr = tst_get_bad_addr(NULL);
> ++}
> ++
> + static struct tst_test test = {
> + 	.test_all = verify_setrlimit,
> + 	.forks_child = 1,
> ++	.setup = setup,
> + };
> +--
> +2.8.1
> +
> diff --git a/meta/recipes-extended/ltp/ltp_20180515.bb b/meta/recipes-extended/ltp/ltp_20180515.bb
> index ff85be7..240222e 100644
> --- a/meta/recipes-extended/ltp/ltp_20180515.bb
> +++ b/meta/recipes-extended/ltp/ltp_20180515.bb
> @@ -56,6 +56,7 @@ SRC_URI = "git://github.com/linux-test-project/ltp.git \
>              file://0001-sigwaitinfo01-recent-glibc-calls-syscall-directly.patch \
>              file://0001-netns_helper.sh-use-ping-6-when-ping6-is-not-avaliab.patch \
>              file://0001-open_posix_testsuite-mmap24-2-Relax-condition-a-bit.patch \
> +		   file://0001-setrlimit05-Use-another-method-to-get-bad-address.patch \
>              "
>   
>   S = "${WORKDIR}/git"



More information about the Openembedded-core mailing list