Hi ! This patch fixes a concurrency issue in shmctl02. Same issue as in shmat02 :
R. -- Renaud Lottiaux Kerlabs Bâtiment Germanium 80, avenue des buttes de Coësmes 35700 Rennes - France Phone : (+33|0)6 80 89 19 34 Fax : (+33|0)2 99 84 71 71 Email : [EMAIL PROTECTED] Web : http://www.kerlabs.com/
Index: cvs/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c
===================================================================
--- cvs.orig/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c 2008-03-06 17:54:54.000000000 +0100
+++ cvs/testcases/kernel/syscalls/ipc/shmctl/shmctl02.c 2008-03-06 18:00:52.000000000 +0100
@@ -47,6 +47,10 @@
* HISTORY
* 03/2001 - Written by Wayne Boyer
*
+ * 06/03/2008 Renaud Lottiaux ([EMAIL PROTECTED])
+ * - Fix concurrency issue. The second key used for this test could
+ * conflict with the key from another task.
+ *
* RESTRICTIONS
* none
*/
@@ -159,6 +163,8 @@
void
setup(void)
{
+ key_t shmkey2;
+
/* Switch to nobody user for correct error code collection */
if (geteuid() != 0) {
tst_brkm(TBROK, tst_exit, "Test must be run as root");
@@ -197,8 +203,16 @@
"segment #1 in setup()");
}
+ /* Get an new IPC resource key. Since there is a small chance the
+ * getipckey() function returns the same key as the previous one,
+ * loop until we have a different key.
+ */
+ do {
+ shmkey2 = getipckey();
+ } while (shmkey2 == shmkey);
+
/* create a shared memory segment with read and write permissions */
- if ((shm_id_2 = shmget(shmkey + 1, SHM_SIZE, IPC_CREAT | IPC_EXCL |
+ if ((shm_id_2 = shmget(shmkey2, SHM_SIZE, IPC_CREAT | IPC_EXCL |
SHM_RW)) == -1) {
tst_brkm(TBROK, cleanup, "couldn't create shared memory "
"segment #2 in setup()");
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
