All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp-list@lists.sourceforge.net
Cc: jburke@redhat.com
Subject: [LTP] [PATCH] memcg_test_2.c: clear all fields of sigaction structure
Date: Mon, 22 Aug 2011 15:40:56 +0200	[thread overview]
Message-ID: <4E525C68.4040903@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 733 bytes --]


This test didn't set all fields of sigaction structure before
using it, which caused some of them to be left in random state.
Namely sa_flags could end up with SA_RESTORER, which after
receiving signal would call invalid pointer in sa_restorer.

Something, we apparently hit here:
Bug 731954 - segfault on s390x when setting memory.limit_in_bytes
https://bugzilla.redhat.com/show_bug.cgi?id=731954

Fix this by zero-ing whole structure before usage.
Clearing just sa_flags should be enough, but let's match the style
of other test in this group: memcg_test_4.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
  .../controllers/memcg/regression/memcg_test_2.c    |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)



[-- Attachment #2: 0001-memcg_test_2.c-clear-all-fields-of-sigaction-structu.patch --]
[-- Type: text/x-patch, Size: 651 bytes --]

diff --git a/testcases/kernel/controllers/memcg/regression/memcg_test_2.c b/testcases/kernel/controllers/memcg/regression/memcg_test_2.c
index e147e27..1643408 100644
--- a/testcases/kernel/controllers/memcg/regression/memcg_test_2.c
+++ b/testcases/kernel/controllers/memcg/regression/memcg_test_2.c
@@ -41,7 +41,7 @@ int main(void)
 {
 	struct sigaction sigusr_action;
 
-	sigemptyset(&sigusr_action.sa_mask);
+	memset(&sigusr_action, 0, sizeof(sigusr_action));
 	sigusr_action.sa_handler = &sigusr_handler;
 	sigaction(SIGUSR1, &sigusr_action, NULL);
 
@@ -49,4 +49,4 @@ int main(void)
 		sleep(1);
 
 	return 0;
-}
\ No newline at end of file
+}


[-- Attachment #3: Type: text/plain, Size: 351 bytes --]

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev

[-- Attachment #4: Type: text/plain, Size: 155 bytes --]

_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

             reply	other threads:[~2011-08-22 13:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 13:40 Jan Stancek [this message]
2011-08-24 11:36 ` [LTP] [PATCH] memcg_test_2.c: clear all fields of sigaction structure Cyril Hrubis

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=4E525C68.4040903@redhat.com \
    --to=jstancek@redhat.com \
    --cc=jburke@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    /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.