syscalls/kill11: add a check between hard limit and MIN_RLIMIT_CORE
PATCH 1/1 syscalls/kill11: add a check between hard limit and MIN_RLIMIT_CORE
Currently, running this case will report EINVAL error if I run "ulimit -c 1023" command firstly. From setrlimit(2)manpage, it got EINVAL error because rlim->rlim_cur was greater than rlim->rlim_max. So add a check for it before setrlimit.
--- testcases/kernel/syscalls/kill/kill11.c | 3 +++ 1 file changed, 3 insertions(+)
testcases/kernel/syscalls/kill/kill11.c +3 -0
@@ -201,6 +201,9 @@ void setup(void)SAFE_GETRLIMIT (NULL ,RLIMIT_CORE , &rlim); +if (rlim.rlim_max <MIN_RLIMIT_CORE ) +tst_brkm (TCONF ,NULL ,"hard limit(%lu)less than MIN_RLIMT_CORE(%i)" , + rlim.rlim_max,MIN_RLIMIT_CORE );if (rlim.rlim_cur <MIN_RLIMIT_CORE ) {tst_resm (TINFO ,"Adjusting RLIMIT_CORE to %i" ,MIN_RLIMIT_CORE ); rlim.rlim_cur =MIN_RLIMIT_CORE ;
Signature · 1 line
2.18.0
PATCH 1/1 syscalls/kill11: add a check between hard limit and MIN_RLIMIT_CORE
Quoted 4 lines · Yang Xu
Currently, running this case will report EINVAL error if I run "ulimit -c 1023" command firstly. From setrlimit(2)manpage, it got EINVAL error because
rlim->rlim_curwas greater thanrlim->rlim_max. So add a check for it before setrlimit.
Hi Xu,
It seems better to fix the issue by setting both rlim_cur and rlimit_max to the MIN_RLIMIT_CORE.
Thanks,
Xiao Yang
Quoted 20 lines
Reported-by Pankaj Vinadrao Joshi<[email protected]>Signed-off-by Yang Xu<[email protected]>--- testcases/kernel/syscalls/kill/kill11.c | 3 +++ 1 file changed, 3 insertions(+)testcases/kernel/syscalls/kill/kill11.c +3
-0@@ -201,6 +201,9 @@ void setup(void)SAFE_GETRLIMIT (NULL ,RLIMIT_CORE ,&rlim); +if (rlim.rlim_max<MIN_RLIMIT_CORE ) +tst_brkm (TCONF ,NULL ,"hard limit(%lu)less than MIN_RLIMT_CORE(%i)" , + rlim.rlim_max,MIN_RLIMIT_CORE );if (rlim.rlim_cur<MIN_RLIMIT_CORE ) {tst_resm (TINFO ,"Adjusting RLIMIT_CORE to %i" ,MIN_RLIMIT_CORE ); rlim.rlim_cur =MIN_RLIMIT_CORE ;
PATCH 1/1 syscalls/kill11: add a check between hard limit and MIN_RLIMIT_CORE
Quoted 7 lines · Xiao Yang
Quoted 6 lines · Yang Xu
Currently, running this case will report EINVAL error if I run "ulimit -c 1023" command firstly. From setrlimit(2)manpage, it got EINVAL error because
rlim->rlim_curwas greater thanrlim->rlim_max. So add a check for it before
setrlimit.
Quoted 5 lines
Hi Xu,
It seems better to fix the issue by setting both
rlim_curandrlimit_maxto theMIN_RLIMIT_CORE.
We can not raiserlim_maxvalue under unprivileged user. Or, should I
cleanup this case and use needs_root=1 ?
Best Regards
Yang Xu
Quoted 26 lines
Thanks,
Xiao YangQuoted 23 lines
Reported-by Pankaj Vinadrao Joshi<[email protected]>Signed-off-by Yang Xu<[email protected]>---
?testcases/kernel/syscalls/kill/kill11.c| 3 +++
? 1 file changed, 3 insertions(+)testcases/kernel/syscalls/kill/kill11.c +3
-0@@ -201,6 +201,9 @@ void setup(void) ????? SAFE_GETRLIMIT(NULL, RLIMIT_CORE,&rlim); +??? if (rlim.rlim_max<? MIN_RLIMIT_CORE) +??????? tst_brkm(TCONF, NULL, "hard limit(%lu)less than MIN_RLIMT_CORE(%i)", +??????????????? rlim.rlim_max, MIN_RLIMIT_CORE); ????? if (rlim.rlim_cur<? MIN_RLIMIT_CORE) { ????????? tst_resm(TINFO, "Adjusting RLIMIT_CORE to %i",
MIN_RLIMIT_CORE);
????????? rlim.rlim_cur =MIN_RLIMIT_CORE;
PATCH 1/1 syscalls/kill11: add a check between hard limit and MIN_RLIMIT_CORE
In reply to Yang Xu----- Original Message -----
Quoted 17 lines
Currently, running this case will report EINVAL error if I run "ulimit -c 1023" command firstly. From setrlimit(2)manpage, it got EINVAL error because
rlim->rlim_curwas greater thanrlim->rlim_max. So add a check for it before setrlimit.Reported-by Pankaj Vinadrao Joshi <[email protected]>Signed-off-by Yang Xu <[email protected]>--- testcases/kernel/syscalls/kill/kill11.c | 3 +++ 1 file changed, 3 insertions(+)testcases/kernel/syscalls/kill/kill11.c +0
-0
testcases/kernel/syscalls/kill/kill11.c void setup(void) · line 206
Quoted 6 lines
testcases/kernel/syscalls/kill/kill11.c +3
-0@@ -201,6 +201,9 @@ void setup(void)SAFE_GETRLIMIT (NULL ,RLIMIT_CORE , &rlim); +if (rlim.rlim_max <MIN_RLIMIT_CORE ) +tst_brkm (TCONF ,NULL ,"hard limit(%lu)less than MIN_RLIMT_CORE(%i)" , + rlim.rlim_max,MIN_RLIMIT_CORE );
This looks OK, but could we also raise the limit when possible?
+ if (rlim.rlim_max < MIN_RLIMIT_CORE) {
+ if (geteuid() != 0) {
+ tst_brkm(TCONF, NULL, "hard limit(%lu)less than MIN_RLIMT_CORE(%i)",
+ rlim.rlim_max, MIN_RLIMIT_CORE);
+ } + tst_resm(TINFO, "Raising rlim_max to %i", MIN_RLIMIT_CORE); + rlim.rlim_max = MIN_RLIMIT_CORE;
+ }
PATCH 1/1 syscalls/kill11: add a check between hard limit and MIN_RLIMIT_CORE
Quoted 21 lines · Jan Stancek
----- Original Message -----
Quoted 18 lines
Currently, running this case will report EINVAL error if I run "ulimit -c 1023" command firstly. From setrlimit(2)manpage, it got EINVAL error because
rlim->rlim_curwas greater thanrlim->rlim_max. So add a check for it before setrlimit.Reported-by Pankaj Vinadrao Joshi <[email protected]>Signed-off-by Yang Xu <[email protected]>--- testcases/kernel/syscalls/kill/kill11.c | 3 +++ 1 file changed, 3 insertions(+)testcases/kernel/syscalls/kill/kill11.c +0
-0@@ -201,6 +201,9 @@ void setup(void)
Quoted 8 lines
testcases/kernel/syscalls/kill/kill11.c void setup(void) · line 206
Quoted 5 lines
testcases/kernel/syscalls/kill/kill11.c +3
-0SAFE_GETRLIMIT (NULL ,RLIMIT_CORE , &rlim); +if (rlim.rlim_max <MIN_RLIMIT_CORE ) +tst_brkm (TCONF ,NULL ,"hard limit(%lu)less than MIN_RLIMT_CORE(%i)" , + rlim.rlim_max,MIN_RLIMIT_CORE );This looks OK, but could we also raise the limit when possible?
Of course. Your way is more wise.
But I also want to change this size of MIN_RLIMIT_CORE.
From ulimit manpage, I know in posix mode "-c" used 512-byte block. I
doubt whether we can change MIN_RLIMIT_CORE(512 *1024), so this case can also pass in unbuntu(default environment).
What do you think about this?
ps: I tested it on el7,el8, they all pass.
Quoted 12 lines
(quoted diff) +8
-0+ if (rlim.rlim_max < MIN_RLIMIT_CORE) { + if (geteuid() != 0) { + tst_brkm(TCONF, NULL, "hard limit(%lu)less than MIN_RLIMT_CORE(%i)", + rlim.rlim_max, MIN_RLIMIT_CORE); + } + tst_resm(TINFO, "Raising rlim_max to %i", MIN_RLIMIT_CORE); + rlim.rlim_max = MIN_RLIMIT_CORE; + }
PATCH 1/1 syscalls/kill11: add a check between hard limit and MIN_RLIMIT_CORE
----- Original Message -----
Quoted 8 lines
Quoted 2 lines
This looks OK, but could we also raise the limit when possible?
Of course. Your way is more wise.
But I also want to change this size ofMIN_RLIMIT_CORE.
From ulimit manpage, I know in posix mode "-c" used 512-byte block. I
doubt whether we can changeMIN_RLIMIT_CORE(512 *1024), so this case can also pass in unbuntu(default environment).
What do you think about this?
I don't see problem with that, we only check for correct signal. Though it probably should be separate patch. Can you re-post both as 2 patch series?
PATCH 1/1 syscalls/kill11: add a check between hard limit and MIN_RLIMIT_CORE
Quoted 12 lines · Jan Stancek
----- Original Message -----
Quoted 8 lines
Quoted 2 lines
This looks OK, but could we also raise the limit when possible?
Of course. Your way is more wise.
But I also want to change this size ofMIN_RLIMIT_CORE.
From ulimit manpage, I know in posix mode "-c" used 512-byte block. I
doubt whether we can changeMIN_RLIMIT_CORE(512 *1024), so this case can also pass in unbuntu(default environment).
What do you think about this?
Quoted 3 lines
I don't see problem with that, we only check for correct signal. Though it probably should be separate patch. Can you re-post both as 2 patch series?
Hi Jan
I perfer to cleanup this case to use new API and also include this two
points.
Best Regard
Yang Xu
Quoted 3 lines
PATCH 1/1 syscalls/kill11: add a check between hard limit and MIN_RLIMIT_CORE
Quoted 15 lines · Yang Xu
Quoted 12 lines · Jan Stancek
----- Original Message -----
Quoted 8 lines
Quoted 2 lines
This looks OK, but could we also raise the limit when possible?
Of course. Your way is more wise.
But I also want to change this size ofMIN_RLIMIT_CORE.
? From ulimit manpage, I know in posix mode "-c" used 512-byte block. I doubt whether we can changeMIN_RLIMIT_CORE(512 *1024), so this case can also pass in unbuntu(default environment).
What do you think about this?
Quoted 3 lines
Quoted 3 lines
I don't see problem with that, we only check for correct signal. Though it probably should be separate patch. Can you re-post both as 2 patch series?
Hi Jan
Since abort01 has the same issue, I will send a patch series as you advise, and then cleanup kill11 when I have free time.
Best Regargd
Yang Xu
Quoted 12 lines
Hi Jan
?I perfer to cleanup this case to use new API and also include this two
points.Best Regard
Yang XuQuoted 3 lines