From: "Dmitry V. Levin" <ldv@altlinux.org>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: + uapi-fix-linux-sysctlh-userspace-compilation-errors.patch added to -mm tree
Date: Mon, 27 Feb 2017 13:09:48 +0300 [thread overview]
Message-ID: <20170227100948.GA16920@altlinux.org> (raw)
In-Reply-To: <CACVxJT-HtOWPoqWv6O6ecGxOa=8axvKZkhzJv71Jz4B9+wNdCg@mail.gmail.com>
[-- 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 --]
next prev parent reply other threads:[~2017-02-27 10:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2017-02-27 19:48 ` Dmitry V. Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170227100948.GA16920@altlinux.org \
--to=ldv@altlinux.org \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.