Re: 2.6.23-rc8 build failure: __you_cannot_kmalloc_that_much in dmi_id_init

Previous thread: Re: - eepro100-avoid-potential-null-pointer-deref-in-speedo_init_rx_ring.patch removed from -mm tree by Kok, Auke on Monday, October 1, 2007 - 4:54 pm. (2 messages)

Next thread: [PATCH 3/3] UML - Definitively kill subprocesses on panic by Jeff Dike on Monday, October 1, 2007 - 5:23 pm. (1 message)
To: LKML <linux-kernel@...>
Date: Monday, October 1, 2007 - 4:54 pm

Hi all,

2.6.23-rc8 and 2.6.23-rc8-git4 fail to build on one of my test
machines, with:

The code is allocating sizeof(struct device) so it really shouldn't be
a problem. I have no idea what's wrong. That's on i386, very old
machine (Pentium 166MMX / Intel TX chipset), with gcc 3.2.3 and
binutils 2.14.90.0.6. 2.6.22.9 compiles fine on the same system (but it
doesn't include dmi-id so it's not very surprising).

.config attached.

--
Jean Delvare

To: LKML <linux-kernel@...>
Date: Monday, October 1, 2007 - 5:54 pm

More information: building the same config on a much more recent system
works fine. This seems to point at a toolchain issue.

--
Jean Delvare
-

To: LKML <linux-kernel@...>
Date: Tuesday, October 2, 2007 - 5:26 pm

More information:
* No improvement in 2.6.23-rc9.
* Building the same config on a different system with the same
toolchain, fails the same. So it's not just one system acting weirdly,
the bug can be reproduced.
* I tried arbitrary values for the kzalloc() in dmi-id.c, the bottom line
is that anything above 64 bytes triggers the bug.
* The same kzalloc() in a different driver doesn't trigger the bug.

I'm puzzled, no idea what to try next.

--
Jean Delvare
-

To: Jean Delvare <khali@...>
Cc: LKML <linux-kernel@...>, Christoph Lameter <clameter@...>, Roland Dreier <rolandd@...>
Date: Thursday, October 4, 2007 - 4:48 am

Yeah, the tricks we play in there do fool some versions of gcc, and you see
the result.

Roland came up with this:

--- a/include/linux/slub_def.h
+++ b/include/linux/slub_def.h
@@ -145,7 +145,7 @@ static __always_inline struct kmem_cache *kmalloc_slab(size_t size)
* testing it here shouldn't be needed. But some versions of gcc need
* help.
*/
- if (__builtin_constant_p(size) && index < 0) {
+ if (__builtin_constant_p(index) && index < 0) {
/*
* Generate a link failure. Would be great if we could
* do something to stop the compile here.

Does it fix things for you?
-

To: Andrew Morton <akpm@...>
Cc: LKML <linux-kernel@...>, Christoph Lameter <clameter@...>, Roland Dreier <rolandd@...>
Date: Thursday, October 4, 2007 - 5:28 am

Hi Andrew,

No, it doesn't, but I hardly see how it could. The above change is in
kmalloc_slab() in slub_def.h while my own problem happens in kmalloc()
in slab_def.h.

--
Jean Delvare
-

Previous thread: Re: - eepro100-avoid-potential-null-pointer-deref-in-speedo_init_rx_ring.patch removed from -mm tree by Kok, Auke on Monday, October 1, 2007 - 4:54 pm. (2 messages)

Next thread: [PATCH 3/3] UML - Definitively kill subprocesses on panic by Jeff Dike on Monday, October 1, 2007 - 5:23 pm. (1 message)