2009-09-03 00:30:20

by Luis R. Rodriguez

[permalink] [raw]
Subject: Exporting kmemleak.h to userspace

I was reviewing kmemleak code and noticed kmemleak.h went exported to
userspace under include/linux/kmemleak.h. Do we expect userspace to
use this stuff somehow? All relevant kmemleak structs are kept
private, I'm curious what userspace apps would use this.

Luis


2009-09-03 06:23:30

by Pekka Enberg

[permalink] [raw]
Subject: Re: Exporting kmemleak.h to userspace

On Thu, Sep 3, 2009 at 3:29 AM, Luis R. Rodriguez<[email protected]> wrote:
> I was reviewing kmemleak code and noticed kmemleak.h went exported to
> userspace under include/linux/kmemleak.h. Do we expect userspace to
> use this stuff somehow? All relevant kmemleak structs are kept
> private, I'm curious what userspace apps would use this.

AFAICT, nobody. Catalin, why is the header exported?

2009-09-03 13:19:53

by Catalin Marinas

[permalink] [raw]
Subject: Re: Exporting kmemleak.h to userspace

On Thu, 2009-09-03 at 09:23 +0300, Pekka Enberg wrote:
> On Thu, Sep 3, 2009 at 3:29 AM, Luis R. Rodriguez<[email protected]> wrote:
> > I was reviewing kmemleak code and noticed kmemleak.h went exported to
> > userspace under include/linux/kmemleak.h. Do we expect userspace to
> > use this stuff somehow? All relevant kmemleak structs are kept
> > private, I'm curious what userspace apps would use this.
>
> AFAICT, nobody. Catalin, why is the header exported?

I haven't done anything specifically to export it. It probably gets
included via other files. Is adding #ifdef __KERNEL__ enough to avoid
this problem?

--
Catalin

2009-09-03 13:34:31

by Johannes Berg

[permalink] [raw]
Subject: Re: Exporting kmemleak.h to userspace

On Thu, 2009-09-03 at 14:18 +0100, Catalin Marinas wrote:
> On Thu, 2009-09-03 at 09:23 +0300, Pekka Enberg wrote:
> > On Thu, Sep 3, 2009 at 3:29 AM, Luis R. Rodriguez<[email protected]> wrote:
> > > I was reviewing kmemleak code and noticed kmemleak.h went exported to
> > > userspace under include/linux/kmemleak.h. Do we expect userspace to
> > > use this stuff somehow? All relevant kmemleak structs are kept
> > > private, I'm curious what userspace apps would use this.
> >
> > AFAICT, nobody. Catalin, why is the header exported?
>
> I haven't done anything specifically to export it. It probably gets
> included via other files. Is adding #ifdef __KERNEL__ enough to avoid
> this problem?

It should be exported only if it's listed in Kbuild, which it isn't.
Luis?

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part

2009-09-03 18:00:26

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: Exporting kmemleak.h to userspace

On Thu, Sep 3, 2009 at 6:34 AM, Johannes Berg<[email protected]> wrote:
> On Thu, 2009-09-03 at 14:18 +0100, Catalin Marinas wrote:
>> On Thu, 2009-09-03 at 09:23 +0300, Pekka Enberg wrote:
>> > On Thu, Sep 3, 2009 at 3:29 AM, Luis R. Rodriguez<[email protected]> wrote:
>> > > I was reviewing kmemleak code and noticed kmemleak.h went exported to
>> > > userspace under include/linux/kmemleak.h. Do we expect userspace to
>> > > use this stuff somehow? All relevant kmemleak structs are kept
>> > > private, I'm curious what userspace apps would use this.
>> >
>> > AFAICT, nobody. Catalin, why is the header exported?
>>
>> I haven't done anything specifically to export it. It probably gets
>> included via other files. Is adding #ifdef __KERNEL__ enough to avoid
>> this problem?
>
> It should be exported only if it's listed in Kbuild,

What do you mean by that?

> which it isn't. Luis?

Well I see kmemleak on

Kernel hacking -->
[*] Kernel memory leak detector

but its not clear to me by what you mean by that it should be exported
only if its listed in Kbuild.

Anyway my point was that userspace does not need kmemleak.h and we are
providing it to userspace. Unfortunately I really am not sure what the
alternative is, it seems we tend to export to userspace a lot of other
kernel headers which userspace does not use. For networking we have
private header space for example on include/net/ but for general
kernel stuff is there an alternative? Should there be? Or as Catalin
mentions should we just use #ifdef __KERNEL__ for headers we do not
want to export to userspace?

Luis

2009-09-03 18:04:50

by Johannes Berg

[permalink] [raw]
Subject: Re: Exporting kmemleak.h to userspace

On Thu, 2009-09-03 at 11:00 -0700, Luis R. Rodriguez wrote:

> Anyway my point was that userspace does not need kmemleak.h and we are
> providing it to userspace.

No, we're not providing it to userspace.

If you actually build userspace headers it won't be included.

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part

2009-09-03 18:06:39

by Luis R. Rodriguez

[permalink] [raw]
Subject: Re: Exporting kmemleak.h to userspace

On Thu, Sep 3, 2009 at 11:04 AM, Johannes Berg<[email protected]> wrote:
> On Thu, 2009-09-03 at 11:00 -0700, Luis R. Rodriguez wrote:
>
>> Anyway my point was that userspace does not need kmemleak.h and we are
>> providing it to userspace.
>
> No, we're not providing it to userspace.
>
> If you actually build userspace headers it won't be included.

Ah then I completely mispoke. Ignore this then.

How *do* you export headers through kbuild then?

Luis

2009-09-03 18:12:59

by Johannes Berg

[permalink] [raw]
Subject: Re: Exporting kmemleak.h to userspace

On Thu, 2009-09-03 at 11:06 -0700, Luis R. Rodriguez wrote:
> On Thu, Sep 3, 2009 at 11:04 AM, Johannes Berg<[email protected]> wrote:
> > On Thu, 2009-09-03 at 11:00 -0700, Luis R. Rodriguez wrote:
> >
> >> Anyway my point was that userspace does not need kmemleak.h and we are
> >> providing it to userspace.
> >
> > No, we're not providing it to userspace.
> >
> > If you actually build userspace headers it won't be included.
>
> Ah then I completely mispoke. Ignore this then.
>
> How *do* you export headers through kbuild then?

You mention them in include/linux/Kbuild, and then you run "make
headers_install" (I think)

johannes


Attachments:
signature.asc (801.00 B)
This is a digitally signed message part