* + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
@ 2017-02-23 22:44 akpm
2017-02-24 14:35 ` Alexey Dobriyan
0 siblings, 1 reply; 6+ messages in thread
From: akpm @ 2017-02-23 22:44 UTC (permalink / raw)
To: ldv, adobriyan, ebiederm, mm-commits
The patch titled
Subject: uapi: fix linux/sysctl.h userspace compilation errors
has been added to the -mm tree. Its filename is
uapi-fix-linux-sysctlh-userspace-compilation-errors.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/uapi-fix-linux-sysctlh-userspace-compilation-errors.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/uapi-fix-linux-sysctlh-userspace-compilation-errors.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated
there every 3-4 working days
------------------------------------------------------
From: "Dmitry V. Levin" <ldv@altlinux.org>
Subject: uapi: fix linux/sysctl.h userspace compilation errors
Include <stddef.h> (guarded by #ifndef __KERNEL__) to fix the following
linux/sysctl.h userspace compilation errors:
/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;
This also fixes userspace compilation of uapi headers that include
linux/sysctl.h, e.g. linux/netfilter.h.
Link: http://lkml.kernel.org/r/20170222230652.GA14373@altlinux.org
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/uapi/linux/sysctl.h | 4 ++++
1 file changed, 4 insertions(+)
diff -puN include/uapi/linux/sysctl.h~uapi-fix-linux-sysctlh-userspace-compilation-errors include/uapi/linux/sysctl.h
--- 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
+
#define CTL_MAXNAME 10 /* how many path components do we allow in a
call to sysctl? In other words, what is
the largest acceptable value for the nlen
_
Patches currently in -mm which might be from ldv@altlinux.org are
uapi-fix-linux-sysctlh-userspace-compilation-errors.patch
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
2017-02-23 22:44 + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree akpm
@ 2017-02-24 14:35 ` Alexey Dobriyan
2017-02-24 22:35 ` Dmitry V. Levin
0 siblings, 1 reply; 6+ messages in thread
From: Alexey Dobriyan @ 2017-02-24 14:35 UTC (permalink / raw)
To: akpm; +Cc: ldv, ebiederm, linux-kernel
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
2017-02-24 14:35 ` Alexey Dobriyan
@ 2017-02-24 22:35 ` Dmitry V. Levin
2017-02-27 9:38 ` Alexey Dobriyan
2017-02-27 19:48 ` Dmitry V. Levin
0 siblings, 2 replies; 6+ messages in thread
From: Dmitry V. Levin @ 2017-02-24 22:35 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: akpm, ebiederm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]
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
[-- Attachment #2: Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
2017-02-24 22:35 ` Dmitry V. Levin
@ 2017-02-27 9:38 ` Alexey Dobriyan
2017-02-27 10:09 ` Dmitry V. Levin
2017-02-27 19:48 ` Dmitry V. Levin
1 sibling, 1 reply; 6+ messages in thread
From: Alexey Dobriyan @ 2017-02-27 9:38 UTC (permalink / raw)
To: Dmitry V. Levin; +Cc: Andrew Morton, Eric W. Biederman, Linux Kernel
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?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
2017-02-27 9:38 ` Alexey Dobriyan
@ 2017-02-27 10:09 ` Dmitry V. Levin
0 siblings, 0 replies; 6+ messages in thread
From: Dmitry V. Levin @ 2017-02-27 10:09 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: Andrew Morton, Eric W. Biederman, Linux Kernel
[-- Attachment #1: Type: text/plain, Size: 2170 bytes --]
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
[-- Attachment #2: Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
2017-02-24 22:35 ` Dmitry V. Levin
2017-02-27 9:38 ` Alexey Dobriyan
@ 2017-02-27 19:48 ` Dmitry V. Levin
1 sibling, 0 replies; 6+ messages in thread
From: Dmitry V. Levin @ 2017-02-27 19:48 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: akpm, ebiederm, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1583 bytes --]
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
[-- Attachment #2: Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-02-27 19:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-23 22:44 + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree akpm
2017-02-24 14:35 ` Alexey Dobriyan
2017-02-24 22:35 ` Dmitry V. Levin
2017-02-27 9:38 ` Alexey Dobriyan
2017-02-27 10:09 ` Dmitry V. Levin
2017-02-27 19:48 ` Dmitry V. Levin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.