From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: 羅秉鈞 <luobingjiun@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] crashme:fork12 test may kill other process that is not forked child
Date: Fri, 29 Jun 2012 15:45:01 +0800 [thread overview]
Message-ID: <4FED5CFD.7040406@cn.fujitsu.com> (raw)
In-Reply-To: <CANysfL_ya=ZMyZyyE__=3T-QTqFniRrj+nHMrNzeaVHMrnmA5A@mail.gmail.com>
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
next prev parent reply other threads:[~2012-06-29 7:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FED5CFD.7040406@cn.fujitsu.com \
--to=gaowanlong@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=luobingjiun@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox