public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86_64 NUMA : Bug correction in populate_memnodemap()
       [not found] <a762e240512062124i517a9c35xd1ec681428418341@mail.gmail.com>
@ 2005-12-07 15:35 ` Eric Dumazet
  2005-12-07 17:46   ` Andi Kleen
  2005-12-11 18:27   ` Andi Kleen
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Dumazet @ 2005-12-07 15:35 UTC (permalink / raw)
  To: Keith Mannthey, Andi Kleen; +Cc: linux-kernel, torvalds

[-- Attachment #1: Type: text/plain, Size: 400 bytes --]

As reported by Keith Mannthey, there are problems in populate_memnodemap()

The bug was that the compute_hash_shift() was returning 31, with incorrect 
initialization of memnodemap[]

To correct the bug, we must use (1UL << shift) instead of (1 << shift) to 
avoid an integer overflow, and we must check that shift < 64 to avoid an 
infinite loop.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>


[-- Attachment #2: populate_memnodemap.patch --]
[-- Type: text/plain, Size: 594 bytes --]

--- linux-2.6.15-rc5/arch/x86_64/mm/numa.c	2005-12-04 06:10:42.000000000 +0100
+++ linux-2.6.15-rc5-ed/arch/x86_64/mm/numa.c	2005-12-07 16:45:15.000000000 +0100
@@ -53,6 +53,8 @@
 	int res = -1;
 	unsigned long addr, end;
 
+	if (shift >= 64)
+		return -1;
 	memset(memnodemap, 0xff, sizeof(memnodemap));
 	for (i = 0; i < numnodes; i++) {
 		addr = nodes[i].start;
@@ -65,7 +67,7 @@
 			if (memnodemap[addr >> shift] != 0xff)
 				return -1;
 			memnodemap[addr >> shift] = i;
-			addr += (1 << shift);
+                       addr += (1UL << shift);
 		} while (addr < end);
 		res = 1;
 	} 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86_64 NUMA : Bug correction in populate_memnodemap()
  2005-12-07 15:35 ` [PATCH] x86_64 NUMA : Bug correction in populate_memnodemap() Eric Dumazet
@ 2005-12-07 17:46   ` Andi Kleen
  2005-12-11 18:27   ` Andi Kleen
  1 sibling, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2005-12-07 17:46 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Keith Mannthey, Andi Kleen, linux-kernel, torvalds

On Wed, Dec 07, 2005 at 04:35:18PM +0100, Eric Dumazet wrote:
> As reported by Keith Mannthey, there are problems in populate_memnodemap()
> 
> The bug was that the compute_hash_shift() was returning 31, with incorrect 
> initialization of memnodemap[]
> 
> To correct the bug, we must use (1UL << shift) instead of (1 << shift) to 
> avoid an integer overflow, and we must check that shift < 64 to avoid an 
> infinite loop.

Thanks looks good.

I guess we'll need that for 2.6.15.

-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86_64 NUMA : Bug correction in populate_memnodemap()
  2005-12-07 15:35 ` [PATCH] x86_64 NUMA : Bug correction in populate_memnodemap() Eric Dumazet
  2005-12-07 17:46   ` Andi Kleen
@ 2005-12-11 18:27   ` Andi Kleen
  2005-12-12  8:34     ` Eric Dumazet
  1 sibling, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2005-12-11 18:27 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Keith Mannthey, Andi Kleen, linux-kernel, torvalds

On Wed, Dec 07, 2005 at 04:35:18PM +0100, Eric Dumazet wrote:
> As reported by Keith Mannthey, there are problems in populate_memnodemap()
> 
> The bug was that the compute_hash_shift() was returning 31, with incorrect 
> initialization of memnodemap[]
> 
> To correct the bug, we must use (1UL << shift) instead of (1 << shift) to 
> avoid an integer overflow, and we must check that shift < 64 to avoid an 
> infinite loop.

It's already merged, no need to resubmit. P.S.: It would be easier
to merge if you didn't use attachments.

-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86_64 NUMA : Bug correction in populate_memnodemap()
  2005-12-11 18:27   ` Andi Kleen
@ 2005-12-12  8:34     ` Eric Dumazet
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Dumazet @ 2005-12-12  8:34 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Keith Mannthey, linux-kernel, torvalds

Andi Kleen a écrit :
> On Wed, Dec 07, 2005 at 04:35:18PM +0100, Eric Dumazet wrote:
> 
>>As reported by Keith Mannthey, there are problems in populate_memnodemap()
>>
>>The bug was that the compute_hash_shift() was returning 31, with incorrect 
>>initialization of memnodemap[]
>>
>>To correct the bug, we must use (1UL << shift) instead of (1 << shift) to 
>>avoid an integer overflow, and we must check that shift < 64 to avoid an 
>>infinite loop.
> 
> 
> It's already merged, no need to resubmit. P.S.: It would be easier
> to merge if you didn't use attachments.

Hi Andi

AFAIK I posted the patch on linux-kernel only once... and once privatly to 
Keith because it seems he missed the linux-kernel post.
I'm confused by your answer.

Eric

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-12-12  8:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <a762e240512062124i517a9c35xd1ec681428418341@mail.gmail.com>
2005-12-07 15:35 ` [PATCH] x86_64 NUMA : Bug correction in populate_memnodemap() Eric Dumazet
2005-12-07 17:46   ` Andi Kleen
2005-12-11 18:27   ` Andi Kleen
2005-12-12  8:34     ` Eric Dumazet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox