Skip to contentSkip to conversation

dio_sparse: prevent race between kill and signal

PATCH In review Jan Stancek 2 participants 2 messages Jun 6, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 dio_sparse: prevent race between kill and signal

This is same change as in:
commit d8f1292181b486b2073cc6fe1ec226f5cedea342
Author: Cyril Hrubis <[email protected]>
Date: Fri Mar 2 13:37:47 2012 +0100
ltp-aiodio: aiodio_sparse fix race condition

but for dio_sparse.c, which is also prone to race
between kill() and signal().

---
 testcases/kernel/io/ltp-aiodio/dio_sparse.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
testcases/kernel/io/ltp-aiodio/dio_sparse.c +2 -1
index e93dcd9..97dbef8 100644
@@ -149,10 +149,10 @@ int main(int argc, char **argv)
 	dirty_freeblocks(filesize);
 
 	tst_resm(TINFO, "Starting I/O tests");
+	signal(SIGTERM, SIG_DFL);
 	for (i = 0; i < num_children; i++) {
 		switch (pid[i] = fork()) {
 		case 0:
-			signal(SIGTERM, SIG_DFL);
 			read_sparse(filename, filesize);
 		break;
 		case -1:
@@ -164,6 +164,7 @@ int main(int argc, char **argv)
 			continue;
 		}
 	}
+	tst_sig(FORK, DEF_HANDLER, cleanup);
 	
 	ret = dio_sparse(filename, alignment, writesize, filesize);
 

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

Hi!

Quoted 8 lines

This is same change as in:
commit d8f1292181b486b2073cc6fe1ec226f5cedea342
Author: Cyril Hrubis <[email protected]>
Date: Fri Mar 2 13:37:47 2012 +0100
ltp-aiodio: aiodio_sparse fix race condition

but for dio_sparse.c, which is also prone to race
between kill() and signal().

Commited, thanks.

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list