lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20070609013450.17278.29072.sendpatchset@jackhammer.engr.sgi.com>
Date:	Fri, 08 Jun 2007 18:34:50 -0700
From:	Paul Jackson <pj@....com>
To:	Andrew Morton <akpm@...l.org>
Cc:	Herbert Poetzl <herbert@...hfloor.at>,
	"Serge E. Hallyn" <serue@...ibm.com>,
	Balbir Singh <balbir@...ibm.com>,
	Paul Menage <menage@...gle.com>,
	Kirill Korotaev <dev@...nvz.org>, linux-kernel@...r.kernel.org,
	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Srivatsa Vaddagiri <vatsa@...ibm.com>,
	Paul Jackson <pj@....com>, Dave Hansen <haveblue@...ibm.com>
Subject: [PATCH 3/3] cpuset: zero malloc - fix for new containers

From: Paul Jackson <pj@....com>

Third of three -- This applies after the container patches,
fixing a problem that earlier patches also fixed in the older
cpuset code.

The container code to present a list of tasks using a container
to user space could write to an array that it had kmalloc'd,
after a kmalloc request of zero size.

The problem was that the code didn't check for writes past the
allocated end of the array until -after- the first write.

This is a race condition that is likely rare -- it would only show
up if a container went from being empty to having a task in it,
during the brief time between the allocation and the first write.

Prior to roughly 2.6.22 kernels, this was also a benign problem,
because a zero kmalloc returned a few usable bytes anyway,
and no harm was done with the bogus write.

With the 2.6.22 kernel changes to make issue a warning if
code tries to write to the location returned from a zero size
allocation, this problem is no longer benign.  This container code
would occassionally trigger that warning.

The fix is trivial -- check before storing into the array,
not after, whether the array is big enough to hold the store.

Cc: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: "Serge E. Hallyn" <serue@...ibm.com>
Cc: Balbir Singh <balbir@...ibm.com>
Cc: Dave Hansen <haveblue@...ibm.com>
Cc: Herbert Poetzl <herbert@...hfloor.at>
Cc: Kirill Korotaev <dev@...nvz.org>
Cc: Paul Menage <menage@...gle.com>
Cc: Srivatsa Vaddagiri <vatsa@...ibm.com>
Cc: Christoph Lameter <clameter@....com>

Signed-off-by: Paul Jackson <pj@....com>

---

Andrew - this is the third of three similar patches.  This one
redoes the fix for the container code.

Please apply somewhere after:
  containersv10-share-css_group-arrays-between-tasks-with-same-container-memberships.patch

 kernel/container.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 2.6.22-rc4-mm2.orig/kernel/container.c	2007-06-08 15:36:14.997835546 -0700
+++ 2.6.22-rc4-mm2/kernel/container.c	2007-06-08 15:37:09.606655972 -0700
@@ -1451,9 +1451,9 @@ static int pid_array_load(pid_t *pidarra
 	struct task_struct *tsk;
 	container_iter_start(cont, &it);
 	while ((tsk = container_iter_next(cont, &it))) {
-		pidarray[n++] = pid_nr(task_pid(tsk));
 		if (unlikely(n == npids))
 			break;
+		pidarray[n++] = pid_nr(task_pid(tsk));
 	}
 	container_iter_end(cont, &it);
 	return n;

-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj@....com> 1.650.933.1373
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ