From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Christoph Hellwig <hch@infradead.org>,
Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <yuchao0@huawei.com>,
Qiuyang Sun <sunqiuyang@huawei.com>,
Sahitya Tummala <stummala@codeaurora.org>,
Eric Biggers <ebiggers@google.com>,
Wang Shilong <wangshilong1991@gmail.com>,
"Linux F2FS DEV,
Mailing List" <linux-f2fs-devel@lists.sourceforge.net>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] f2fs: fix 32-bit linking
Date: Fri, 28 Jun 2019 18:58:35 +0100 [thread overview]
Message-ID: <20190628175835.hwzfrgrtwphi6kka@shell.armlinux.org.uk> (raw)
In-Reply-To: <CAK8P3a0t+vGge8uDOuwex6j+ddaUqovxCXoJOO8Ec3z6_brvsg@mail.gmail.com>
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@infradead.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.
>
> This might contain a double uaccess_save_and_enable/uaccess_restore,
> not sure how much we care about that.
>
> Arnd
>
> index 7e0d2727c6b5..c21cdecadf26 100644
> --- a/arch/arm/include/asm/uaccess.h
> +++ b/arch/arm/include/asm/uaccess.h
> @@ -307,6 +307,7 @@ static inline void set_fs(mm_segment_t fs)
> do { \
> unsigned long __gu_addr = (unsigned long)(ptr); \
> unsigned long __gu_val; \
> + unsigned long long __gu_val8; \
> unsigned int __ua_flags; \
> __chk_user_ptr(ptr); \
> might_fault(); \
> @@ -315,10 +316,13 @@ do {
> \
> case 1: __get_user_asm_byte(__gu_val, __gu_addr, err); break; \
> case 2: __get_user_asm_half(__gu_val, __gu_addr, err); break; \
> case 4: __get_user_asm_word(__gu_val, __gu_addr, err); break; \
> + case 8: __get_user_asm_dword(__gu_val8, __gu_addr, err);break; \
> default: (__gu_val) = __get_user_bad(); \
> } \
> 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)
>
> #define __get_user_asm(x, addr, err, instr) \
> @@ -373,6 +377,8 @@ do {
> \
> __get_user_asm(x, addr, err, ldr)
> #endif
>
> +#define __get_user_asm_dword(x, addr, err) \
> + do { err = raw_copy_from_user(&x, (void __user *)addr, 8) ?
> -EFAULT : 0; } while (0)
>
> #define __put_user_switch(x, ptr, __err, __fn) \
> do { \
>
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up
next prev parent reply other threads:[~2019-06-28 17:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-28 10:39 [PATCH] f2fs: fix 32-bit linking Arnd Bergmann
2019-06-28 12:44 ` Christoph Hellwig
2019-06-28 13:09 ` Arnd Bergmann
2019-06-28 13:17 ` Christoph Hellwig
2019-06-28 14:46 ` Arnd Bergmann
2019-06-28 17:58 ` Russell King - ARM Linux admin [this message]
2019-07-01 14:58 ` Arnd Bergmann
2019-06-28 23:25 ` Randy Dunlap
2019-06-28 15:59 ` Jaegeuk Kim
2019-07-01 14:54 ` Arnd Bergmann
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=20190628175835.hwzfrgrtwphi6kka@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=arnd@arndb.de \
--cc=ebiggers@google.com \
--cc=hch@infradead.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stummala@codeaurora.org \
--cc=sunqiuyang@huawei.com \
--cc=wangshilong1991@gmail.com \
--cc=yuchao0@huawei.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox