Skip to contentSkip to conversation

memcg_test_2.c: clear all fields of sigaction structure

PATCH In review Jan Stancek 2 participants 2 messages Aug 22, 2011 – Aug 24, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 memcg_test_2.c: clear all fields of sigaction structure

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.

---
 .../controllers/memcg/regression/memcg_test_2.c    |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
testcases/kernel/controllers/memcg/regression/memcg_test_2.c +2 -2
index e147e27..1643408 100644
@@ -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
+}

------------------------------------------------------------------------------
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

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

Hi!
Commited, thanks.

Signature · 12 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list