Bug 10121

Summary: __you_cannot_kmalloc_that_much in hiddev.c with gcc 3.2
Product: Memory Management Reporter: Alexander (pikachu)
Component: Slab AllocatorAssignee: Christoph Lameter (clameter)
Status: CLOSED CODE_FIX    
Severity: normal CC: bunk, jdelvare, mpm, penberg
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.24.3 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: .config
Proposed fix

Description Alexander 2008-02-27 06:57:22 UTC
Latest working kernel version: 2.6.22.1
Earliest failing kernel version: 2.6.24

Problem Description:
Kernel compile finish with error:
  GEN     .version
  CHK     include/linux/compile.h
  UPD     include/linux/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
drivers/built-in.o: In function `hiddev_ioctl':
hiddev.c:(.text+0xfcc43): undefined reference to `__you_cannot_kmalloc_that_much'
make: *** [.tmp_vmlinux1] Error 1

Steps to reproduce:
gcc (GCC) 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
USB_HID=y in .config
Comment 1 Adrian Bunk 2008-02-27 07:12:22 UTC
Please attach your .config
Comment 2 Alexander 2008-02-28 00:07:13 UTC
Created attachment 15050 [details]
.config
Comment 3 Jean Delvare 2008-02-29 14:07:29 UTC
Created attachment 15099 [details]
Proposed fix

The trick is to move the handling of ioctls which need to allocate memory to separate functions. This fixes the problem for me, but needs some testing.
Comment 4 Christoph Lameter 2008-02-29 14:15:28 UTC
Right. We know that gcc 3.2 will fold constants again if the functions are smaller. That has also addressed the issue in other cases.  That also means that the issue will resurface if the function is bloated by further updates.
Comment 5 Adrian Bunk 2008-02-29 14:21:47 UTC
The alternative would be to move the minimum supported compiler version from 3.2 to 3.3 if this reoccuring issue (see e.g. #9669) convinces Linus of accepting a patch doing so.
Comment 6 Jean Delvare 2008-03-01 23:30:02 UTC
I don't think that we want to make gcc 3.3 the minimum supported compiler version. gcc 3.2 still has a significant pool of users. On top of that, overly large functions are bad anyway for many reasons, so I doubt that you will convince Linus: he might see this gcc 3.2 property as a feature not bug ;)
Comment 7 Adrian Bunk 2008-04-23 02:43:02 UTC
fixed by commit cf2a299e48cbeb6c942e1f765b92ca6058355f68