Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1587690 > unrolled thread

Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree

Started byAlexey Dobriyan <adobriyan@gmail.com>
First post2017-02-24 15:40 +0100
Last post2017-02-27 20:50 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch  added to -mm tree Alexey Dobriyan <adobriyan@gmail.com> - 2017-02-24 15:40 +0100
    Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree "Dmitry V. Levin" <ldv@altlinux.org> - 2017-02-24 23:40 +0100
      Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added  to -mm tree Alexey Dobriyan <adobriyan@gmail.com> - 2017-02-27 10:50 +0100
        Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree "Dmitry V. Levin" <ldv@altlinux.org> - 2017-02-27 11:20 +0100
      Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree "Dmitry V. Levin" <ldv@altlinux.org> - 2017-02-27 20:50 +0100

#1587690 — Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree

FromAlexey Dobriyan <adobriyan@gmail.com>
Date2017-02-24 15:40 +0100
SubjectRe: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
Message-ID<tepcl-1uK-3@gated-at.bofh.it>
On Thu, Feb 23, 2017 at 02:44:31PM -0800, akpm@linux-foundation.org wrote:
> /usr/include/linux/sysctl.h:38:2: error: unknown type name 'size_t'
>   size_t *oldlenp;
> /usr/include/linux/sysctl.h:40:2: error: unknown type name 'size_t'
>   size_t newlen;

> --- a/include/uapi/linux/sysctl.h~uapi-fix-linux-sysctlh-userspace-compilation-errors
> +++ a/include/uapi/linux/sysctl.h
> @@ -26,6 +26,10 @@
>  #include <linux/types.h>
>  #include <linux/compiler.h>
>  
> +#ifndef __KERNEL__
> +#include <stddef.h>		/* For size_t. */
> +#endif

There is __kernel_size_t for cases like this.

[toc] | [next] | [standalone]


#1587986 — Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree

From"Dmitry V. Levin" <ldv@altlinux.org>
Date2017-02-24 23:40 +0100
SubjectRe: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
Message-ID<tewGR-6Uo-1@gated-at.bofh.it>
In reply to#1587690

[Multipart message — attachments visible in raw view] — view raw

On Fri, Feb 24, 2017 at 05:35:33PM +0300, Alexey Dobriyan wrote:
> On Thu, Feb 23, 2017 at 02:44:31PM -0800, akpm@linux-foundation.org wrote:
> > /usr/include/linux/sysctl.h:38:2: error: unknown type name 'size_t'
> >   size_t *oldlenp;
> > /usr/include/linux/sysctl.h:40:2: error: unknown type name 'size_t'
> >   size_t newlen;
> 
> > --- a/include/uapi/linux/sysctl.h~uapi-fix-linux-sysctlh-userspace-compilation-errors
> > +++ a/include/uapi/linux/sysctl.h
> > @@ -26,6 +26,10 @@
> >  #include <linux/types.h>
> >  #include <linux/compiler.h>
> >  
> > +#ifndef __KERNEL__
> > +#include <stddef.h>		/* For size_t. */
> > +#endif
> 
> There is __kernel_size_t for cases like this.

No, __kernel_size_t is not for cases like this because size_t differs
from __kernel_size_t on x32 and mips n32.

Fortunately, there is no sysctl syscall entry on x32, but on mips m32
it is there with number 6152, implemented using compat_sys_sysctl.
The latter operates with argument of type struct compat_sysctl_args*
where newlen is of type compat_size_t.

If you change it from size_t to __kernel_size_t, you'll break mips n32.


-- 
ldv

[toc] | [prev] | [next] | [standalone]


#1588566 — Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree

FromAlexey Dobriyan <adobriyan@gmail.com>
Date2017-02-27 10:50 +0100
SubjectRe: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
Message-ID<tfq6m-3H7-7@gated-at.bofh.it>
In reply to#1587986
On Sat, Feb 25, 2017 at 1:35 AM, Dmitry V. Levin <ldv@altlinux.org> wrote:
> On Fri, Feb 24, 2017 at 05:35:33PM +0300, Alexey Dobriyan wrote:
>> On Thu, Feb 23, 2017 at 02:44:31PM -0800, akpm@linux-foundation.org wrote:
>> > /usr/include/linux/sysctl.h:38:2: error: unknown type name 'size_t'
>> >   size_t *oldlenp;
>> > /usr/include/linux/sysctl.h:40:2: error: unknown type name 'size_t'
>> >   size_t newlen;
>>
>> > --- a/include/uapi/linux/sysctl.h~uapi-fix-linux-sysctlh-userspace-compilation-errors
>> > +++ a/include/uapi/linux/sysctl.h
>> > @@ -26,6 +26,10 @@
>> >  #include <linux/types.h>
>> >  #include <linux/compiler.h>
>> >
>> > +#ifndef __KERNEL__
>> > +#include <stddef.h>                /* For size_t. */
>> > +#endif
>>
>> There is __kernel_size_t for cases like this.
>
> No, __kernel_size_t is not for cases like this because size_t differs
> from __kernel_size_t on x32 and mips n32.
>
> Fortunately, there is no sysctl syscall entry on x32, but on mips m32
> it is there with number 6152, implemented using compat_sys_sysctl.
> The latter operates with argument of type struct compat_sysctl_args*
> where newlen is of type compat_size_t.
>
> If you change it from size_t to __kernel_size_t, you'll break mips n32.

You're gluing kernel interface to an userspace header
which kernel doesn't control. How can this fix anything?

[toc] | [prev] | [next] | [standalone]


#1588582 — Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree

From"Dmitry V. Levin" <ldv@altlinux.org>
Date2017-02-27 11:20 +0100
SubjectRe: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
Message-ID<tfqzo-491-5@gated-at.bofh.it>
In reply to#1588566

[Multipart message — attachments visible in raw view] — view raw

On Mon, Feb 27, 2017 at 12:38:16PM +0300, Alexey Dobriyan wrote:
> On Sat, Feb 25, 2017 at 1:35 AM, Dmitry V. Levin <ldv@altlinux.org> wrote:
> > On Fri, Feb 24, 2017 at 05:35:33PM +0300, Alexey Dobriyan wrote:
> >> On Thu, Feb 23, 2017 at 02:44:31PM -0800, akpm@linux-foundation.org wrote:
> >> > /usr/include/linux/sysctl.h:38:2: error: unknown type name 'size_t'
> >> >   size_t *oldlenp;
> >> > /usr/include/linux/sysctl.h:40:2: error: unknown type name 'size_t'
> >> >   size_t newlen;
> >>
> >> > --- a/include/uapi/linux/sysctl.h~uapi-fix-linux-sysctlh-userspace-compilation-errors
> >> > +++ a/include/uapi/linux/sysctl.h
> >> > @@ -26,6 +26,10 @@
> >> >  #include <linux/types.h>
> >> >  #include <linux/compiler.h>
> >> >
> >> > +#ifndef __KERNEL__
> >> > +#include <stddef.h>                /* For size_t. */
> >> > +#endif
> >>
> >> There is __kernel_size_t for cases like this.
> >
> > No, __kernel_size_t is not for cases like this because size_t differs
> > from __kernel_size_t on x32 and mips n32.
> >
> > Fortunately, there is no sysctl syscall entry on x32, but on mips m32
> > it is there with number 6152, implemented using compat_sys_sysctl.
> > The latter operates with argument of type struct compat_sysctl_args*
> > where newlen is of type compat_size_t.
> >
> > If you change it from size_t to __kernel_size_t, you'll break mips n32.
> 
> You're gluing kernel interface to an userspace header
> which kernel doesn't control.

Are you sure it's me who does the gluing?

As no uapi header provides a definition of size_t, they are essentially
relying on size_t being provided elsewhere.

For this reason, inclusion of <stddef.h> is the most conservative fix.

> How can this fix anything?

For example,
AC_CHECK_HEADERS([<linux/sysctl.h>]) doesn't work, one has to use
AC_CHECK_HEADERS([<linux/sysctl.h>], , , [#include <stddef.h>]) instead.
The same issue arises with other autoconf checks.

I think that every uapi header file should be standalone, i.e. it must
include, directly or indirectly, every definition it uses, so that no user
should have to guess header dependencies.


-- 
ldv

[toc] | [prev] | [next] | [standalone]


#1588899 — Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree

From"Dmitry V. Levin" <ldv@altlinux.org>
Date2017-02-27 20:50 +0100
SubjectRe: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
Message-ID<tfzt0-1N7-41@gated-at.bofh.it>
In reply to#1587986

[Multipart message — attachments visible in raw view] — view raw

On Sat, Feb 25, 2017 at 01:35:51AM +0300, Dmitry V. Levin wrote:
> On Fri, Feb 24, 2017 at 05:35:33PM +0300, Alexey Dobriyan wrote:
> > On Thu, Feb 23, 2017 at 02:44:31PM -0800, akpm@linux-foundation.org wrote:
> > > /usr/include/linux/sysctl.h:38:2: error: unknown type name 'size_t'
> > >   size_t *oldlenp;
> > > /usr/include/linux/sysctl.h:40:2: error: unknown type name 'size_t'
> > >   size_t newlen;
> > 
> > > --- a/include/uapi/linux/sysctl.h~uapi-fix-linux-sysctlh-userspace-compilation-errors
> > > +++ a/include/uapi/linux/sysctl.h
> > > @@ -26,6 +26,10 @@
> > >  #include <linux/types.h>
> > >  #include <linux/compiler.h>
> > >  
> > > +#ifndef __KERNEL__
> > > +#include <stddef.h>		/* For size_t. */
> > > +#endif
> > 
> > There is __kernel_size_t for cases like this.
> 
> No, __kernel_size_t is not for cases like this because size_t differs
> from __kernel_size_t on x32 and mips n32.
> 
> Fortunately, there is no sysctl syscall entry on x32, but on mips m32
> it is there with number 6152, implemented using compat_sys_sysctl.
> The latter operates with argument of type struct compat_sysctl_args*
> where newlen is of type compat_size_t.
> 
> If you change it from size_t to __kernel_size_t, you'll break mips n32.

Apparently, my statement that sizeof(size_t) < sizeof(__kernel_size_t)
on mips n32 is not correct, so x32 is the only architecture of this kind.

This means that size_t can be replaced with __kernel_size_t in this
particular case.  Does anybody want that change instead of my original
proposal?


-- 
ldv

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web