Skip to contentSkip to conversation

ipc-shmc-check-for-integer-overflow-during-shmget.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jun 9, 2014

lore
Share & tools
lore
#0 lore raw

Subject: [merged] ipc-shmc-check-for-integer-overflow-during-shmget.patch removed from -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Mon, 09 Jun 2014 12:37:22 -0700

The patch titled
Subject: ipc/shm.c: check for integer overflow during shmget.
has been removed from the -mm tree. Its filename was
ipc-shmc-check-for-integer-overflow-during-shmget.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Manfred Spraul <[email protected]>
Subject: ipc/shm.c: check for integer overflow during shmget.

SHMMAX is the upper limit for the size of a shared memory segment, counted in bytes. The actual allocation is that size, rounded up to the next full page.

Add a check that prevents the creation of segments where the rounded up size causes an integer overflow.

---

 ipc/shm.c |    3 +++
 1 file changed, 3 insertions(+)
ipc/shm.c renamed from ipc/shm.c~ipc-shmc-check-for-integer-overflow-during-shmget +3 -0
diff -puN ipc/shm.c~ipc-shmc-check-for-integer-overflow-during-shmget ipc/shm.c
@@ -493,6 +493,9 @@ static int newseg(struct ipc_namespace *
 	if (size < SHMMIN || size > ns->shm_ctlmax)
 		return -EINVAL;
 
+	if (numpages << PAGE_SHIFT < size)
+		return -ENOSPC;
+
 	if (ns->shm_tot + numpages < ns->shm_tot ||
 			ns->shm_tot + numpages > ns->shm_ctlall)
 		return -ENOSPC;

_

Patches currently in -mm which might be from [email protected] are

origin.patch
slab-leaks3-default-y.patch