Skip to contentSkip to conversation

2.4.15-final drivers/net/bonding.c includes user space headers

DISCUSSION Keith Owens 4 participants 9 messages Nov 23, 2001 – Nov 26, 2001

lore
Share & tools
lore
#0 lore raw

2.4.15-final/drivers/net/bonding.c:188: #include <limits.h>

Kernel code must not include use space headers. I thought this had been fixed. It will not compile in 2.5.

#1 lore raw
Followup to:  <[email protected]>
By author:    Keith Owens <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 6 lines

2.4.15-final/drivers/net/bonding.c:188: #include <limits.h>

Kernel code must not include use space headers. I thought this had been fixed. It will not compile in 2.5.

<limits.h> is one of the compiler-provided headers, i.e. from /usr/lib/gcc-lib/*/*/include -- if your kbuild harness don't allow those headers to be included, it's broken.

-hpa

Signature · 3 lines
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt	<[email protected]>
#2 lore raw
Quoted 10 lines · H. Peter Anvin

By author: Keith Owens <[email protected]>

Quoted 5 lines

2.4.15-final/drivers/net/bonding.c:188: #include <limits.h>

Kernel code must not include use space headers. I thought this had been fixed. It will not compile in 2.5.

<limits.h> is one of the compiler-provided headers, i.e. from /usr/lib/gcc-lib/*/*/include -- if your kbuild harness don't allow those headers to be included, it's broken.

kbuild 2.5 does
'-nostdinc -I/usr/lib/gcc-lib/... gcc version ../include/'
so it allows includes from the compiler headers. The problem is:

bonding.c includes limits.h, picked up from gcc, OK. limits.h includes syslimits.h from gcc, OK.
syslimits.h tries to include_next <limits.h> to get the user space limits, not OK.

Any kernel code that includes limits.h or syslimits.h is polluted by user space headers. net/bonding.c does not even need limits.h.

#3 lore raw
Quoted 5 lines · Keith Owens

kbuild 2.5 does
'-nostdinc -I/usr/lib/gcc-lib/... gcc version ../include/'
so it allows includes from the compiler headers. The problem is:

Quoted 8 lines

bonding.c includes limits.h, picked up from gcc, OK. limits.h includes syslimits.h from gcc, OK.
syslimits.h tries to include_next <limits.h> to get the user space limits, not OK.

Any kernel code that includes limits.h or syslimits.h is polluted by user space headers. net/bonding.c does not even need limits.h.

How UTTERLY braindamaged... I guess we could provide a (dummy?) <limits.h> for the kernel environment. I would definitely like to see the standard compiler-related headers like <stdint.h> as well...

-hpa

#4 lore raw
Quoted 6 lines · H. Peter Anvin
Quoted 5 lines · Keith Owens

bonding.c includes limits.h, picked up from gcc, OK. limits.h includes syslimits.h from gcc, OK.
syslimits.h tries to include_next <limits.h> to get the user space limits, not OK.

Quoted 6 lines
Quoted 2 lines

Any kernel code that includes limits.h or syslimits.h is polluted by user space headers. net/bonding.c does not even need limits.h.

How UTTERLY braindamaged... I guess we could provide a (dummy?) <limits.h> for the kernel environment. I would definitely like to see the standard compiler-related headers like <stdint.h> as well...

We already have include/linux/limits.h that is included by filesystem code. If anybody needs additional #defines, they can go in our version of limits.h instead of trying to use the gcc version.

#5 lore raw
Quoted 5 lines · Keith Owens

We already have include/linux/limits.h that is included by filesystem code. If anybody needs additional #defines, they can go in our version of limits.h instead of trying to use the gcc version.

I guess. I don't like the idea of not using the compiler-provided headers, since it seems to me to make it harder to deal properly with gcc changes, though...

-hpa

#6 lore raw
In reply to H. Peter Anvin

From: "H. Peter Anvin" <[email protected]>
Date: 25 Nov 2001 13:49:33 -0800

<limits.h> is one of the compiler-provided headers, i.e. from /usr/lib/gcc-lib/*/*/include -- if your kbuild harness don't allow those headers to be included, it's broken.

Perhaps, but in this case (the bonding driver) the include was totally unnecessary.

#7 lore raw
In reply to Keith Owens
Quoted 6 lines · Keith Owens

2.4.15-final/drivers/net/bonding.c:188: #include <limits.h>

Kernel code must not include use space headers. I thought this had been fixed. It will not compile in 2.5.

I should probably also point out that I'm not the maintainer/creator of that version that did this too..

The Lab hasn't said yet from the DOE's point of view it's ok to work on GPL to me, as part of my job..

Signature · 4 lines
------------------------+--------------------------------------------------
Thomas Davis		| ASG Cluster guy
[email protected]		| 
(510) 486-4524		| "80 nodes and chugging Captain!"
#8 lore raw
Quoted 6 lines · Keith Owens

2.4.15-final/drivers/net/bonding.c:188: #include <limits.h>

Kernel code must not include use space headers. I thought this had been fixed. It will not compile in 2.5.

Keith I fully agree with you. I sent the fix to Linus probably 4 times but he simply was not accepting any non-OOPS fixing patches.

It's in my queue and will go to Marcelo today.

Franks a lot,
David S. Miller
[email protected]