lkml.org 
[lkml]   [2004]   [Sep]   [13]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateMon, 13 Sep 2004 08:56:21 +0200
FromAndi Kleen <>
SubjectRe: more numa maxnode confusions
On Sun, Sep 12, 2004 at 08:02:53PM -0700, Paul Jackson wrote:
>  2) About Aug 9, Brent Casavant sent in a patch changing the set (not get)
>     side calls, sys_mbind and sys_set_mempolicy, to N64.  This patch
>     removed the following line from the implementation of get_nodes() in
>     mm/mempolicy.c:
> 
> 	--maxnode;

Ah, I wasn't aware that this patch got merged into mainline. 
That was a bad thing, because it broke the ABI used by libnuma
subtly.

Please whoever merged it revert it.

> Currently, by my reading, Linus' bk tree has the mixed N64/N65
> interfaces, since it has Brent's patch, but not my cpuset patch.
> Andrew's *-mm tree has the pure N65 interface, due to my cpuset patch
> reversing Brent's patch.> > My guess is that Andi wants this all N65, and that he didn't agree to
> Brent's patch.  If Andi understands different, that's fine -- I'm not
> trying to reopen that battle.

Correct.


> > Andi:> >  0) Are my above statements anywhere close to correct?

Yes.

> >  1) Should the "--maxnode" be re-inserted in get_nodes()?

Yes.

> >  2) Should it be re-inserted by a separate patch from you,
>     rather than as a hidden side affect of my cpuset patch?
>     I will gladly remove that line from my cpuset patch, in
>     favor of a one-liner from you that re-inserts that line.

Yes. I appended a patch. Linus or Andrew, please apply it.

Thanks for catching this.

-Andi


----------------------------------------------------------------
Fix ABI in set_mempolicy() that got broken by an earlier change.

Add a check for very big input values and prevent excessive
looping in the kernel.


diff -u linux-2.6.9rc1-bk19/mm/mempolicy.c-o linux-2.6.9rc1-bk19/mm/mempolicy.c
--- linux-2.6.9rc1-bk19/mm/mempolicy.c-o	2004-09-13 08:51:46.000000000 +0200
+++ linux-2.6.9rc1-bk19/mm/mempolicy.c	2004-09-13 08:53:58.000000000 +0200
@@ -132,6 +132,7 @@
 	unsigned long nlongs;
 	unsigned long endmask;
 
+	--maxnode;
 	bitmap_zero(nodes, MAX_NUMNODES);
 	if (maxnode == 0 || !nmask)
 		return 0;
@@ -145,6 +146,8 @@
 	/* When the user specified more nodes than supported just check
 	   if the non supported part is all zero. */
 	if (nlongs > BITS_TO_LONGS(MAX_NUMNODES)) {
+		if (nlongs > PAGE_SIZE/sizeof(long))
+			return -EINVAL;
 		for (k = BITS_TO_LONGS(MAX_NUMNODES); k < nlongs; k++) {
 			unsigned long t;
 			if (get_user(t,  nmask + k))




-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:06    [from the cache]
©2003-2008