* [LTP] crashme:fork12 test may kill other process that is not forked child
@ 2012-06-27 9:52 羅秉鈞
2012-06-29 7:45 ` Wanlong Gao
2012-06-29 16:22 ` [LTP] crashme:fork12 test may kill other process that is not forked child chrubis
0 siblings, 2 replies; 8+ messages in thread
From: 羅秉鈞 @ 2012-06-27 9:52 UTC (permalink / raw)
To: ltp-list
Dear All,
fork12 test forks as many child process as possible until
the system out of memory. And kernel OOM killer is
triggered to select candidate process to be killed.
fork12 expected one of its forked child process to be chosen,
but what if any other process is chosen. Even the worst,
shell script("/bin/sh") or parent process was chosen to be killed.
No way return and the system really crashed. But this is not
what fork12 wants.
I proposed the solution for this is disable the OOM killer of parent
process and adjust child process's oom_score_adj to 500(or any
other number larger than 0), this purpose just to make child process
can be easily chosen.
Do you have better idea? Thank you.
--------------------------------------------------------------------------------------------
From: Luo,BingJiun <bjluo@faraday-tech.com>
---
.../testcases/kernel/syscalls/fork/fork12.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/ltp-full-20120401/testcases/kernel/syscalls/fork/fork12.c
b/ltp-full-20120401/testcases/kernel/syscalls/fork/fork12.c
index d052fba..c3d7cb5 100644
--- a/ltp-full-20120401/testcases/kernel/syscalls/fork/fork12.c
+++ b/ltp-full-20120401/testcases/kernel/syscalls/fork/fork12.c
@@ -63,6 +63,7 @@ int main(int ac, char **av)
int ret, status;
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
+ char cmd[40];
/*
* parse standard options
@@ -76,6 +77,11 @@ int main(int ac, char **av)
*/
setup();
+ /* adjust parent process so not be killed when out of memory */
+ sprintf(cmd,"echo -1000 > /proc/%d/oom_score_adj", getppid());
+ printf("%s\n", cmd);
+ system(cmd);
+
/*
* check looping state if -i option is given
*/
@@ -92,6 +98,9 @@ int main(int ac, char **av)
pause();
exit(0);
}
+ /* adjust child process so it is killed first
when out of memory */
+ sprintf(cmd,"echo 500 > /proc/%d/oom_score_adj", pid1);
+ system(cmd);
forks++;
ret = waitpid(-1, &status, WNOHANG);
if (ret < 0)
--
1.7.0.4
Best Regards,
Bing-Jiun
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [LTP] crashme:fork12 test may kill other process that is not forked child 2012-06-27 9:52 [LTP] crashme:fork12 test may kill other process that is not forked child 羅秉鈞 @ 2012-06-29 7:45 ` Wanlong Gao 2012-10-09 6:08 ` [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL Nitin Yadav 2012-06-29 16:22 ` [LTP] crashme:fork12 test may kill other process that is not forked child chrubis 1 sibling, 1 reply; 8+ messages in thread From: Wanlong Gao @ 2012-06-29 7:45 UTC (permalink / raw) To: 羅秉鈞; +Cc: ltp-list On 06/27/2012 05:52 PM, 羅秉鈞 wrote: > Dear All, > > fork12 test forks as many child process as possible until > the system out of memory. And kernel OOM killer is > triggered to select candidate process to be killed. > > fork12 expected one of its forked child process to be chosen, > but what if any other process is chosen. Even the worst, > shell script("/bin/sh") or parent process was chosen to be killed. > No way return and the system really crashed. But this is not > what fork12 wants. > > I proposed the solution for this is disable the OOM killer of parent > process and adjust child process's oom_score_adj to 500(or any > other number larger than 0), this purpose just to make child process > can be easily chosen. > > Do you have better idea? Thank you. I have no objection about this idea. some comments below, > > -------------------------------------------------------------------------------------------- > > From: Luo,BingJiun <bjluo@faraday-tech.com> > --- > .../testcases/kernel/syscalls/fork/fork12.c | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/ltp-full-20120401/testcases/kernel/syscalls/fork/fork12.c > b/ltp-full-20120401/testcases/kernel/syscalls/fork/fork12.c > index d052fba..c3d7cb5 100644 > --- a/ltp-full-20120401/testcases/kernel/syscalls/fork/fork12.c > +++ b/ltp-full-20120401/testcases/kernel/syscalls/fork/fork12.c > @@ -63,6 +63,7 @@ int main(int ac, char **av) > int ret, status; > int lc; /* loop counter */ > char *msg; /* message returned from parse_opts */ > + char cmd[40]; > > /* > * parse standard options > @@ -76,6 +77,11 @@ int main(int ac, char **av) > */ > setup(); > > + /* adjust parent process so not be killed when out of memory */ > + sprintf(cmd,"echo -1000 > /proc/%d/oom_score_adj", getppid()); > + printf("%s\n", cmd); > + system(cmd); Why not write()? And "echo" always use the absolute path "/bin/echo" . Thanks, Wanlong Gao > + > /* > * check looping state if -i option is given > */ > @@ -92,6 +98,9 @@ int main(int ac, char **av) > pause(); > exit(0); > } > + /* adjust child process so it is killed first > when out of memory */ > + sprintf(cmd,"echo 500 > /proc/%d/oom_score_adj", pid1); > + system(cmd); > forks++; > ret = waitpid(-1, &status, WNOHANG); > if (ret < 0) > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL 2012-06-29 7:45 ` Wanlong Gao @ 2012-10-09 6:08 ` Nitin Yadav 2012-10-16 2:31 ` Wanlong Gao 0 siblings, 1 reply; 8+ messages in thread From: Nitin Yadav @ 2012-10-09 6:08 UTC (permalink / raw) To: gaowanlong, Caspar Zhang; +Cc: ltp-list Hi Wanlong, Below are the output where I am getting - EPERM (returned value = 1) as a return value from io_submit. io_submit01 1 TPASS : expected failure - returned value = -22 : Invalid argument io_submit01 2 TPASS : expected failure - returned value = -22 : Invalid argument io_submit01 3 TFAIL : unexpected failure - returned value = 1 : Unknown error 18446744073709551615, expected one of -EINVAL, -EBADF, -EFAULT io_submit01 4 TPASS : expected failure - returned value = -14 : Bad address io_submit01 5 TPASS : expected failure - returned value = -22 : Invalid argument io_submit01 6 TPASS : expected failure - returned value = -9 : Bad file descriptor io_submit01 7 TPASS : expected success - returned value = 0 io_submit01 8 TPASS : expected success - returned value = 1 Could you please let me know can we consider - EPERM case as a return value for io_submit. Thanks, Nitin Yadav Hi Jan, >>> --- a/testcases/kernel/syscalls/io_submit/io_submit01.c >>> +++ b/testcases/kernel/syscalls/io_submit/io_submit01.c >>> @@ -126,7 +126,21 @@ int main(int argc, char *argv[]) >>> /* 1.3 - EINVAL: uninitialized iocb */ >>> iocbs[0] = &iocb; >>> TEST(io_submit(ctx, 1, iocbs)); >>> - check_result(-EINVAL, TEST_RETURN); >>> + switch(TEST_RETURN) { >>> + case -EINVAL: >>> + case -EBADF: >>> + case -EFAULT: >>> + case -EPERM: >> >> >> I don't think io_submit(2) can return -EPERM. >> >> Do you think so? > > I was trying all sorts of random data and I remember seeing once "-1". > I'm failing to reproduce it today, so I could be wrong. If I fail to find > data that gives -EPERM, I'll remove it in v2. I looked into the io_submit(2) code in kernel and didn't see any path can return -EPERM, so I think you should confirm on it again. Thanks, Wanlong Gao > > Regards, > Jan > >> >> Thanks, >> Wanlong Gao >> > > Information transmitted by this e-mail is proprietary to MphasiS, its associated companies and/ or its customers and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at mailmaster@mphasis.com and delete this mail from your records. ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL 2012-10-09 6:08 ` [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL Nitin Yadav @ 2012-10-16 2:31 ` Wanlong Gao 2012-10-16 6:53 ` Jan Stancek 0 siblings, 1 reply; 8+ messages in thread From: Wanlong Gao @ 2012-10-16 2:31 UTC (permalink / raw) To: Nitin Yadav; +Cc: ltp-list On 10/09/2012 02:08 PM, Nitin Yadav wrote: > Hi Wanlong, > > Below are the output where I am getting - EPERM (returned value = 1) as a return value from io_submit. > > io_submit01 1 TPASS : expected failure - returned value = -22 : Invalid argument > io_submit01 2 TPASS : expected failure - returned value = -22 : Invalid argument > io_submit01 3 TFAIL : unexpected failure - returned value = 1 : Unknown error 18446744073709551615, expected one of -EINVAL, -EBADF, -EFAULT > io_submit01 4 TPASS : expected failure - returned value = -14 : Bad address > io_submit01 5 TPASS : expected failure - returned value = -22 : Invalid argument > io_submit01 6 TPASS : expected failure - returned value = -9 : Bad file descriptor > io_submit01 7 TPASS : expected success - returned value = 0 > io_submit01 8 TPASS : expected success - returned value = 1 > > Could you please let me know can we consider - EPERM case as a return value for io_submit. OK, maybe I missed something, so, can you show us how did you produce this in detail? Thanks, Wanlong Gao > > Thanks, > Nitin Yadav > > > > Hi Jan, > >>>> --- a/testcases/kernel/syscalls/io_submit/io_submit01.c >>>> +++ b/testcases/kernel/syscalls/io_submit/io_submit01.c >>>> @@ -126,7 +126,21 @@ int main(int argc, char *argv[]) >>>> /* 1.3 - EINVAL: uninitialized iocb */ >>>> iocbs[0] = &iocb; >>>> TEST(io_submit(ctx, 1, iocbs)); >>>> - check_result(-EINVAL, TEST_RETURN); >>>> + switch(TEST_RETURN) { >>>> + case -EINVAL: >>>> + case -EBADF: >>>> + case -EFAULT: >>>> + case -EPERM: >>> >>> >>> I don't think io_submit(2) can return -EPERM. >>> >>> Do you think so? >> >> I was trying all sorts of random data and I remember seeing once "-1". >> I'm failing to reproduce it today, so I could be wrong. If I fail to find >> data that gives -EPERM, I'll remove it in v2. > > > I looked into the io_submit(2) code in kernel and didn't see any path can > return -EPERM, so I think you should confirm on it again. > > Thanks, > Wanlong Gao > >> >> Regards, >> Jan >> >>> >>> Thanks, >>> Wanlong Gao >>> >> >> > > > Information transmitted by this e-mail is proprietary to MphasiS, its associated companies and/ or its customers and is intended > for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or > exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded > to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly > prohibited. In such cases, please notify us immediately at mailmaster@mphasis.com and delete this mail from your records. > ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL 2012-10-16 2:31 ` Wanlong Gao @ 2012-10-16 6:53 ` Jan Stancek 2012-10-16 10:11 ` chrubis 0 siblings, 1 reply; 8+ messages in thread From: Jan Stancek @ 2012-10-16 6:53 UTC (permalink / raw) To: gaowanlong, Nitin Yadav; +Cc: ltp-list ----- Original Message ----- > From: "Wanlong Gao" <gaowanlong@cn.fujitsu.com> > To: "Nitin Yadav" <Nitin.Yadav@mphasis.com> > Cc: ltp-list@lists.sourceforge.net > Sent: Tuesday, 16 October, 2012 4:31:17 AM > Subject: Re: [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL > > On 10/09/2012 02:08 PM, Nitin Yadav wrote: > > Hi Wanlong, > > > > Below are the output where I am getting - EPERM (returned value = > > 1) as a return value from io_submit. > > > > io_submit01 1 TPASS : expected failure - returned value = -22 > > : Invalid argument > > io_submit01 2 TPASS : expected failure - returned value = -22 > > : Invalid argument > > io_submit01 3 TFAIL : unexpected failure - returned value = > > 1 : Unknown error 18446744073709551615, expected one of -EINVAL, > > -EBADF, -EFAULT > > io_submit01 4 TPASS : expected failure - returned value = -14 > > : Bad address > > io_submit01 5 TPASS : expected failure - returned value = -22 > > : Invalid argument > > io_submit01 6 TPASS : expected failure - returned value = -9 > > : Bad file descriptor > > io_submit01 7 TPASS : expected success - returned value = 0 > > io_submit01 8 TPASS : expected success - returned value = 1 Notice that return value is positive (1). So it could be that some random data succeeded and one iocb was actually submitted. Regards, Jan > > > > Could you please let me know can we consider - EPERM case as a > > return value for io_submit. > > OK, maybe I missed something, so, can you show us how did you produce > this in detail? > > Thanks, > Wanlong Gao > > > > > Thanks, > > Nitin Yadav > > > > > > > > Hi Jan, > > > >>>> --- a/testcases/kernel/syscalls/io_submit/io_submit01.c > >>>> +++ b/testcases/kernel/syscalls/io_submit/io_submit01.c > >>>> @@ -126,7 +126,21 @@ int main(int argc, char *argv[]) > >>>> /* 1.3 - EINVAL: uninitialized iocb */ > >>>> iocbs[0] = &iocb; > >>>> TEST(io_submit(ctx, 1, iocbs)); > >>>> - check_result(-EINVAL, TEST_RETURN); > >>>> + switch(TEST_RETURN) { > >>>> + case -EINVAL: > >>>> + case -EBADF: > >>>> + case -EFAULT: > >>>> + case -EPERM: > >>> > >>> > >>> I don't think io_submit(2) can return -EPERM. > >>> > >>> Do you think so? > >> > >> I was trying all sorts of random data and I remember seeing once > >> "-1". > >> I'm failing to reproduce it today, so I could be wrong. If I fail > >> to find > >> data that gives -EPERM, I'll remove it in v2. > > > > > > I looked into the io_submit(2) code in kernel and didn't see any > > path can > > return -EPERM, so I think you should confirm on it again. > > > > Thanks, > > Wanlong Gao > > > >> > >> Regards, > >> Jan > >> > >>> > >>> Thanks, > >>> Wanlong Gao > >>> > >> > >> > > > > > > Information transmitted by this e-mail is proprietary to MphasiS, > > its associated companies and/ or its customers and is intended > > for use only by the individual or entity to which it is addressed, > > and may contain information that is privileged, confidential or > > exempt from disclosure under applicable law. If you are not the > > intended recipient or it appears that this mail has been forwarded > > to you without proper authority, you are notified that any use or > > dissemination of this information in any manner is strictly > > prohibited. In such cases, please notify us immediately at > > mailmaster@mphasis.com and delete this mail from your records. > > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic > APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > Ltp-list mailing list > Ltp-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ltp-list > ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL 2012-10-16 6:53 ` Jan Stancek @ 2012-10-16 10:11 ` chrubis [not found] ` <E351E450E8B9F54684A699D42DC5ADF2263AF477@MPBAGVEX02.corp.mphasis.com> 0 siblings, 1 reply; 8+ messages in thread From: chrubis @ 2012-10-16 10:11 UTC (permalink / raw) To: Jan Stancek; +Cc: ltp-list, Nitin Yadav Hi! > Notice that return value is positive (1). So it could be that some random data > succeeded and one iocb was actually submitted. Well I think that if you pass random data to the kernel the only assumption that may hold is that this action should not bring the system down (unless of course you happen to initiate shutdown). From this point of view calling libcalls/syscalls with random values and asserting certain results makes a little sense. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <E351E450E8B9F54684A699D42DC5ADF2263AF477@MPBAGVEX02.corp.mphasis.com>]
[parent not found: <E351E450E8B9F54684A699D42DC5ADF22640E162@MPBAGVEX02.corp.mphasis.com>]
* Re: [LTP] [PATCH] io_submit: uninitialized iocb may notreturn-EINVAL [not found] ` <E351E450E8B9F54684A699D42DC5ADF22640E162@MPBAGVEX02.corp.mphasis.com> @ 2012-10-17 12:44 ` chrubis 0 siblings, 0 replies; 8+ messages in thread From: chrubis @ 2012-10-17 12:44 UTC (permalink / raw) To: Nitin Yadav; +Cc: ltp-list Hi! > When the test fails, the return value from io_submit() is 1. This means > that io_submit successfully submitted one I/O request block for > processing. > Could you please let me know is it correct behavior to > successfully submit io request for uninitialized iocb with return value > 1 (-EPERM). As far as I understand io_submit() return value 1 is success i.e. 1 io request queued. So I think that in your case the uninitialized structure contains data valid enough for the operation to be actually queued. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [LTP] crashme:fork12 test may kill other process that is not forked child 2012-06-27 9:52 [LTP] crashme:fork12 test may kill other process that is not forked child 羅秉鈞 2012-06-29 7:45 ` Wanlong Gao @ 2012-06-29 16:22 ` chrubis 1 sibling, 0 replies; 8+ messages in thread From: chrubis @ 2012-06-29 16:22 UTC (permalink / raw) To: ?????????; +Cc: ltp-list Hi! > I proposed the solution for this is disable the OOM killer of parent > process and adjust child process's oom_score_adj to 500(or any > other number larger than 0), this purpose just to make child process > can be easily chosen. I wouldn't do the increase in oom_score for the parent that doesn't help much, because the test runs under pan which is started from a script etc... So if any of the processes in the chain gets killed the testing is done anyway. Adjusting the child oom_score on the other hand is good idea is this enough for the test to work okay? And for the implementation, simple write would be far better solution and please run you patch through checkpatch.pl before submitting next time. -- Cyril Hrubis chrubis@suse.cz ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-10-17 12:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-27 9:52 [LTP] crashme:fork12 test may kill other process that is not forked child 羅秉鈞
2012-06-29 7:45 ` Wanlong Gao
2012-10-09 6:08 ` [LTP] [PATCH] io_submit: uninitialized iocb may not return -EINVAL Nitin Yadav
2012-10-16 2:31 ` Wanlong Gao
2012-10-16 6:53 ` Jan Stancek
2012-10-16 10:11 ` chrubis
[not found] ` <E351E450E8B9F54684A699D42DC5ADF2263AF477@MPBAGVEX02.corp.mphasis.com>
[not found] ` <E351E450E8B9F54684A699D42DC5ADF22640E162@MPBAGVEX02.corp.mphasis.com>
2012-10-17 12:44 ` [LTP] [PATCH] io_submit: uninitialized iocb may notreturn-EINVAL chrubis
2012-06-29 16:22 ` [LTP] crashme:fork12 test may kill other process that is not forked child chrubis
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox