kernel/syscall/setrlimit05.c: use a legal bad address for mips
PATCH 1/1 kernel/syscall/setrlimit05.c: use a legal bad address for mips
This testcase fails on mips32. The process is killed by SIGBUS which doesn't return EFAULT 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 work on mips and other arches.
--- testcases/kernel/syscalls/setrlimit/setrlimit05.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/setrlimit/setrlimit05.c +5 -1
@@ -31,9 +31,13 @@ static void verify_setrlimit(void)int status;pid_t pid; +void *bad_addr; + + bad_addr =tst_get_bad_addr (NULL ); + pid =SAFE_FORK ();if (!pid) { -TEST (setrlimit (RLIMIT_NOFILE , (void *)-1 )); +TEST (setrlimit (RLIMIT_NOFILE ,(struct rlimit *)bad_addr));if (TST_RET !=-1 ) {tst_res (TFAIL ,"setrlimit() succeeded unexpectedly" );exit (0 );
Signature · 1 line
2.8.1
PATCH 1/1 kernel/syscall/setrlimit05.c: use a legal bad address for mips
Quoted 20 lines · Hongzhi.Song
This testcase fails on mips32. The process is killed by SIGBUS which doesn't return EFAULT 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 work on mips and other arches.Signed-off-by Hongzhi.Song<[email protected]>--- testcases/kernel/syscalls/setrlimit/setrlimit05.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)testcases/kernel/syscalls/setrlimit/setrlimit05.c +0
-0
testcases/kernel/syscalls/setrlimit/setrlimit05.c static void verify_setrlimit(void) · line 37
Quoted 7 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c +4
-0@@ -31,9 +31,13 @@ static void verify_setrlimit(void)int status;pid_t pid; +void *bad_addr; + + bad_addr =tst_get_bad_addr (NULL ); +
Hi Hongzhi,
Please use tab to do indention instead.
Other than that, it looks good to me.
Best Regards,
Xiao Yang
Quoted 7 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c +1
-1pid =SAFE_FORK ();if (!pid) { -TEST (setrlimit (RLIMIT_NOFILE , (void *)-1 )); +TEST (setrlimit (RLIMIT_NOFILE ,(struct rlimit *)bad_addr));if (TST_RET !=-1 ) {tst_res (TFAIL ,"setrlimit() succeeded unexpectedly" );exit (0 );
Hongzhi
PATCH 1/1 kernel/syscall/setrlimit05.c: use a legal bad address for mips
Quoted 25 lines · Xiao Yang
Quoted 24 lines · Hongzhi.Song
This testcase fails on mips32. The process is killed by SIGBUS which doesn't return EFAULT 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 work on mips and other arches.Signed-off-by Hongzhi.Song<[email protected]>---
testcases/kernel/syscalls/setrlimit/setrlimit05.c| 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)testcases/kernel/syscalls/setrlimit/setrlimit05.c +0
-0@@ -31,9 +31,13 @@ static void verify_setrlimit(void) int status; pid_t pid;
Quoted 8 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c static void verify_setrlimit(void) · line 37
Quoted 4 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c +4
-0+ void *bad_addr; + + bad_addr = tst_get_bad_addr(NULL); +Hi Hongzhi,
Please use tab to do indention instead.
Other than that, it looks good to me.
Hi Yang,
My tab is set to 4 spaces in vim config. So if you open the file, it will be present as tab.
--Hongzhi
Quoted 14 lines
Best Regards,
Xiao YangQuoted 7 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c +1
-1pid = SAFE_FORK(); if (!pid) { - TEST(setrlimit(RLIMIT_NOFILE, (void *) -1)); + TEST(setrlimit(RLIMIT_NOFILE,(struct rlimit *)bad_addr)); if (TST_RET != -1) { tst_res(TFAIL, "setrlimit() succeeded unexpectedly"); exit(0);
PATCH 1/1 kernel/syscall/setrlimit05.c: use a legal bad address for mips
In reply to Hongzhi.SongHi!
testcases/kernel/syscalls/setrlimit/setrlimit05.c static void verify_setrlimit(void) · line 36
Quoted 11 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c +3
-0@@ -31,9 +31,13 @@ static void verify_setrlimit(void)int status;pid_t pid; +void *bad_addr; + + bad_addr =tst_get_bad_addr (NULL );
It would be better if we called this only once in the test setup() function as the function actually maps a page of memory, the test may fail if we pass large enough -i parameter.
Quoted 13 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c +1
-1pid =SAFE_FORK ();if (!pid) { -TEST (setrlimit (RLIMIT_NOFILE , (void *)-1 )); +TEST (setrlimit (RLIMIT_NOFILE ,(struct rlimit *)bad_addr));if (TST_RET !=-1 ) {tst_res (TFAIL ,"setrlimit() succeeded unexpectedly" );exit (0 );Signature · 5 lines
2.8.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Cyril Hrubis [email protected]
Hongzhi
PATCH 1/1 kernel/syscall/setrlimit05.c: use a legal bad address for mips
Quoted 9 lines · Cyril Hrubis
Hi!
Quoted 8 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c +0
-0@@ -31,9 +31,13 @@ static void verify_setrlimit(void)int status;pid_t pid;
Quoted 6 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c static void verify_setrlimit(void) · line 36
Quoted 3 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c +3
-0+void *bad_addr; + + bad_addr =tst_get_bad_addr (NULL );It would be better if we called this only once in the test
setup()function as the function actually maps a page of memory, the test may fail if we pass large enough -i parameter.
This case just runs one time. But I still send V2 with using setup() to apply memory.
--Hongzhi
Quoted 14 lines
Quoted 14 lines
testcases/kernel/syscalls/setrlimit/setrlimit05.c +1
-1pid =SAFE_FORK ();if (!pid) { -TEST (setrlimit (RLIMIT_NOFILE , (void *)-1 )); +TEST (setrlimit (RLIMIT_NOFILE ,(struct rlimit *)bad_addr));if (TST_RET !=-1 ) {tst_res (TFAIL ,"setrlimit() succeeded unexpectedly" );exit (0 );Signature · 5 lines
2.8.1 -- Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH 1/1 kernel/syscall/setrlimit05.c: use a legal bad address for mips
Hi!
Quoted 6 lines
Quoted 3 lines
It would be better if we called this only once in the test
setup()function as the function actually maps a page of memory, the test may fail if we pass large enough -i parameter.This case just runs one time. But I still send V2 with using
setup()to apply memory.
All tests have command line parameters and one of them is -i which can be used to execute the test in a loop.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 kernel/syscall/setrlimit05.c: use a legal bad address for mips
In reply to Hongzhi.SongHi Hongzhi,
Do you try to build CONFIG_SYSCTL_SYSCALL and run sysctl04 on mips32? It seems that (void *) -1 is used in sysctl04.c as well. Perhaps, you can fix
the issue together if sysctl04 gets the same error on mips32. :-)
Best Regards,
Xiao Yang
Quoted 34 lines · Hongzhi.Song
This testcase fails on mips32. The process is killed by SIGBUS which doesn't return EFAULT 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 work on mips and other arches.Signed-off-by Hongzhi.Song<[email protected]>--- testcases/kernel/syscalls/setrlimit/setrlimit05.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)testcases/kernel/syscalls/setrlimit/setrlimit05.c +5
-1@@ -31,9 +31,13 @@ static void verify_setrlimit(void)int status;pid_t pid; +void *bad_addr; + + bad_addr =tst_get_bad_addr (NULL ); + pid =SAFE_FORK ();if (!pid) { -TEST (setrlimit (RLIMIT_NOFILE , (void *)-1 )); +TEST (setrlimit (RLIMIT_NOFILE ,(struct rlimit *)bad_addr));if (TST_RET !=-1 ) {tst_res (TFAIL ,"setrlimit() succeeded unexpectedly" );exit (0 );
Hongzhi
PATCH 1/1 kernel/syscall/setrlimit05.c: use a legal bad address for mips
Quoted 6 lines · Xiao Yang
Hi Hongzhi,
Do you try to build
CONFIG_SYSCTL_SYSCALLand run sysctl04 on mips32? It seems that (void *) -1 is used insysctl04.cas well. Perhaps, you can fix
the issue together if sysctl04 gets the same error on mips32. :-)
Thank you for your help.
I find that there is no glibc wrapper for syscall() but other syscall APIs do.
Sometimes, glibc converts struct32 to struct64, this behavior maybe has an effect on result.
--Hongzhi
Quoted 43 lines
Best Regards,
Xiao YangQuoted 35 lines · Hongzhi.Song
This testcase fails on mips32. The process is killed by SIGBUS which doesn't return EFAULT 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 work on mips and other arches.Signed-off-by Hongzhi.Song<[email protected]>---
testcases/kernel/syscalls/setrlimit/setrlimit05.c| 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)testcases/kernel/syscalls/setrlimit/setrlimit05.c +5
-1@@ -31,9 +31,13 @@ static void verify_setrlimit(void) int status; pid_t pid; + void *bad_addr; + + bad_addr = tst_get_bad_addr(NULL); + pid = SAFE_FORK(); if (!pid) { - TEST(setrlimit(RLIMIT_NOFILE, (void *) -1)); + TEST(setrlimit(RLIMIT_NOFILE,(struct rlimit *)bad_addr)); if (TST_RET != -1) { tst_res(TFAIL, "setrlimit() succeeded unexpectedly"); exit(0);