2001-11-23 06:32:25

by Keith Owens

[permalink] [raw]
Subject: 2.4.15-final drivers/net/bonding.c includes user space headers

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.


2001-11-25 21:50:00

by H. Peter Anvin

[permalink] [raw]
Subject: Re: 2.4.15-final drivers/net/bonding.c includes user space headers

Followup to: <[email protected]>
By author: Keith Owens <[email protected]>
In newsgroup: linux.dev.kernel
>
> 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
--
<[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]>

2001-11-26 02:07:07

by Keith Owens

[permalink] [raw]
Subject: Re: 2.4.15-final drivers/net/bonding.c includes user space headers

On 25 Nov 2001 13:49:33 -0800,
"H. Peter Anvin" <[email protected]> wrote:
>By author: Keith Owens <[email protected]>
>>
>> 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.

2001-11-26 02:09:58

by H. Peter Anvin

[permalink] [raw]
Subject: Re: 2.4.15-final drivers/net/bonding.c includes user space headers

Keith Owens wrote:

>
> 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.
>

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

2001-11-26 02:22:57

by H. Peter Anvin

[permalink] [raw]
Subject: Re: 2.4.15-final drivers/net/bonding.c includes user space headers

Keith Owens wrote:

>
> 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

2001-11-26 02:20:17

by Keith Owens

[permalink] [raw]
Subject: Re: 2.4.15-final drivers/net/bonding.c includes user space headers

On Sun, 25 Nov 2001 18:09:05 -0800,
"H. Peter Anvin" <[email protected]> wrote:
>Keith Owens wrote:
>> 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...

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.

2001-11-26 05:02:33

by David Miller

[permalink] [raw]
Subject: Re: 2.4.15-final drivers/net/bonding.c includes user space headers

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.

2001-11-26 18:06:01

by Thomas Davis

[permalink] [raw]
Subject: Re: 2.4.15-final drivers/net/bonding.c includes user space headers

Keith Owens wrote:
>
> 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..

--
------------------------+--------------------------------------------------
Thomas Davis | ASG Cluster guy
[email protected] |
(510) 486-4524 | "80 nodes and chugging Captain!"

2001-11-26 19:00:11

by David Miller

[permalink] [raw]
Subject: Re: 2.4.15-final drivers/net/bonding.c includes user space headers


Keith Owens wrote:
>
> 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]