From: Peng Haitao <penght@cn.fujitsu.com>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] mprotect02: fix error of the case need sighandler()
Date: Fri, 21 Jan 2011 11:55:24 +0800 [thread overview]
Message-ID: <4D3903AC.2070901@cn.fujitsu.com> (raw)
In-Reply-To: <AANLkTin4N+xuTwQP2w7WtGvO20qdsa2mEjeiMi5fFK2d@mail.gmail.com>
Hi Garrett,
Garrett Cooper said the following on 2011-1-20 17:28:
>> The case expect the signal "SIGSEGV", so should add sighandler().
>
> For the first portion of the testcase, yes. For the second part of the
> testcase, no.
This is OK, but the default signal handler is invoked when an unexpected signal
is caught. so I think we should add sighandler(). Furthermore, the default
signal handler make the child process exit 2, but the case expect the child
process exit 1, this will cause the case fail.
The following patch will reinitialize signal handler.
Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
testcases/kernel/syscalls/mprotect/mprotect02.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/testcases/kernel/syscalls/mprotect/mprotect02.c b/testcases/kernel/syscalls/mprotect/mprotect02.c
index ebc4bcc..c0a5d8b 100644
--- a/testcases/kernel/syscalls/mprotect/mprotect02.c
+++ b/testcases/kernel/syscalls/mprotect/mprotect02.c
@@ -129,6 +129,9 @@ int main(int ac, char **av)
tst_brkm(TBROK, cleanup, "child failed");
}
+ /* Re-Initialization signal handler */
+ tst_sig(FORK, DEF_HANDLER, NULL);
+
/*
* Change the protection to WRITE.
*/
@@ -198,12 +201,21 @@ int main()
#endif /* UCLINUX */
+void sighandler(int sig)
+{
+ tst_resm(TINFO, "received signal: %d", sig);
+ if (sig == SIGSEGV)
+ exit(1);
+ else
+ tst_brkm(TBROK, 0, "Unexpected signal %d received.", sig);
+}
+
/*
* setup() - performs all ONE TIME setup for this test
*/
void setup()
{
- tst_sig(FORK, DEF_HANDLER, NULL);
+ tst_sig(FORK, sighandler, NULL);
TEST_PAUSE;
--
1.7.3.1
--
Best Regards,
Peng Haitao
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2011-01-21 3:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-20 8:00 [LTP] [PATCH] mprotect02: fix error of the case need sighandler() Peng Haitao
2011-01-20 9:28 ` Garrett Cooper
2011-01-21 3:55 ` Peng Haitao [this message]
2011-01-21 4:00 ` Garrett Cooper
2011-01-21 5:38 ` Peng Haitao
2011-01-21 8:29 ` Garrett Cooper
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=4D3903AC.2070901@cn.fujitsu.com \
--to=penght@cn.fujitsu.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=yanegomi@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.