Skip to content

Commit

Permalink
kernel/syscall/setrlimit05.c: use a legal bad address for mips
Browse files Browse the repository at this point in the history
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@windriver.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
  • Loading branch information
Hongzhi.Song authored and metan-ucw committed Nov 7, 2018
1 parent 79734e0 commit 80bed46
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion testcases/kernel/syscalls/setrlimit/setrlimit05.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,16 @@

#include "tst_test.h"

static void *bad_addr;

static void verify_setrlimit(void)
{
int status;
pid_t pid;

pid = SAFE_FORK();
if (!pid) {
TEST(setrlimit(RLIMIT_NOFILE, (void *) -1));
TEST(setrlimit(RLIMIT_NOFILE, bad_addr));
if (TST_RET != -1) {
tst_res(TFAIL, "setrlimit() succeeded unexpectedly");
exit(0);
Expand Down Expand Up @@ -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,
};

0 comments on commit 80bed46

Please sign in to comment.