[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK8P3a1AdseCGhg2aNkvtfCd-Wn2-rG9Z_LbvkkheGnbpT8EWA@mail.gmail.com>
Date: Mon, 1 Jul 2019 16:58:23 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Russell King - ARM Linux admin <linux@...linux.org.uk>
Cc: Christoph Hellwig <hch@...radead.org>,
Jaegeuk Kim <jaegeuk@...nel.org>, Chao Yu <yuchao0@...wei.com>,
Qiuyang Sun <sunqiuyang@...wei.com>,
Sahitya Tummala <stummala@...eaurora.org>,
Eric Biggers <ebiggers@...gle.com>,
Wang Shilong <wangshilong1991@...il.com>,
"Linux F2FS DEV, Mailing List"
<linux-f2fs-devel@...ts.sourceforge.net>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] f2fs: fix 32-bit linking
On Fri, Jun 28, 2019 at 7:58 PM Russell King - ARM Linux admin
<linux@...linux.org.uk> wrote:
>
> On Fri, Jun 28, 2019 at 04:46:14PM +0200, Arnd Bergmann wrote:
> > On Fri, Jun 28, 2019 at 3:17 PM Christoph Hellwig <hch@...radead.org> wrote:
> > >
> > > On Fri, Jun 28, 2019 at 03:09:47PM +0200, Arnd Bergmann wrote:
> > > > I came across this on arm-nommu (which disables
> > > > CONFIG_CPU_SPECTRE) during randconfig testing.
> > > >
> > > > I don't see an easy way to add this in there, short of rewriting the
> > > > whole __get_user_err() function. Any suggestions?
> > >
> > > Can't we just fall back to using copy_from_user with a little wrapper
> > > that switches based on sizeof()?
> >
> > I came up with something now. It's not pretty, but seems to satisfy the
> > compiler. Not a proper patch yet, but let me know if you find a bug.
>
> Have you checked what the behaviour is when "ptr" is a pointer to a
> pointer? I think you'll end up with a compiler warning for every
> case, complaining about casting an unsigned long long to a pointer.
I have built lots of kernels using this patch as a test, though my autobuilder
is currently configured to use clang-8, and other compilers or versions
might show more warnings.
> > uaccess_restore(__ua_flags); \
> > - (x) = (__typeof__(*(ptr)))__gu_val; \
> > + (x) = __builtin_choose_expr(sizeof(*(ptr)) == 8, \
> > + (__typeof__(*(ptr)))__gu_val8, \
> > + (__typeof__(*(ptr)))__gu_val); \
> > } while (0)
The __builtin_choose_expr() here is supposed to take care of the case
of a pointer type, gcc and clang should both ignore the non-taken
branch and only produce warnings for the case they actually use.
Arnd
Powered by blists - more mailing lists