linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Benjamin LaHaise <bcrl@kvack.org>
Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Michael Ellerman <mpe@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linuxppc-dev@lists.ozlabs.org, Al Viro <viro@ZenIV.linux.org.uk>,
	Christoph Hellwig <hch@lst.de>
Subject: linux-next: build failure after merge of the aio tree
Date: Tue, 15 Mar 2016 17:46:34 +1100	[thread overview]
Message-ID: <20160315174634.6766cd88@canb.auug.org.au> (raw)

Hi Benjamin,

After merging the aio tree, today's linux-next build (powerpc
ppc44x_defconfig) failed like this:

fs/built-in.o: In function `aio_thread_op_foo_at':
aio.c:(.text+0x4dab4): undefined reference to `__get_user_bad'
aio.c:(.text+0x4daec): undefined reference to `__get_user_bad'

Caused by commit

  150a0b4905f1 ("aio: add support for async openat()")

despite commit

  d2f7a973e11e ("aio: don't use __get_user() for 64 bit values")

This is due to a bug in the powerpc __get_user_check() macro (the return
value is defined to be "unsigned long" which is only 32 bits on a 32
bit platform).

I applied the patch below which seems to help (Michael, what do you
think?), but given Al's and Christoph's reactions, I am inclined to
remove the aio tree from tomorrow and maybe it can be revisited after
the merge window.

From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Tue, 15 Mar 2016 16:36:06 +1100
Subject: [PATCH] powerpc: fix get_user for 64 bit typs on 32 bit platforms

solution borrowed from the x86 uaccess.h

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
---
 arch/powerpc/include/asm/uaccess.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index b7c20f0b8fbe..52262b2f37fc 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -261,10 +261,13 @@ do {								\
 	}							\
 } while (0)
 
+#define __inttype(x) \
+	__typeof__(__builtin_choose_expr(sizeof(x) > sizeof(0UL), 0ULL, 0UL))
+
 #define __get_user_nocheck(x, ptr, size)			\
 ({								\
 	long __gu_err;						\
-	unsigned long __gu_val;					\
+	__inttype(*(ptr)) __gu_val;				\
 	__typeof__(*(ptr)) __user *__gu_addr = (ptr);	\
 	__chk_user_ptr(ptr);					\
 	if (!is_kernel_addr((unsigned long)__gu_addr))		\
@@ -277,7 +280,7 @@ do {								\
 #define __get_user_check(x, ptr, size)					\
 ({									\
 	long __gu_err = -EFAULT;					\
-	unsigned long  __gu_val = 0;					\
+	__inttype(*(ptr)) __gu_val = 0;				\
 	__typeof__(*(ptr)) __user *__gu_addr = (ptr);		\
 	might_fault();							\
 	if (access_ok(VERIFY_READ, __gu_addr, (size)))			\
@@ -289,7 +292,7 @@ do {								\
 #define __get_user_nosleep(x, ptr, size)			\
 ({								\
 	long __gu_err;						\
-	unsigned long __gu_val;					\
+	__inttype(*(ptr)) __gu_val;				\
 	__typeof__(*(ptr)) __user *__gu_addr = (ptr);	\
 	__chk_user_ptr(ptr);					\
 	__get_user_size(__gu_val, __gu_addr, (size), __gu_err);	\
-- 
2.7.0

-- 
Cheers,
Stephen Rothwell

             reply	other threads:[~2016-03-15  6:46 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15  6:46 Stephen Rothwell [this message]
2016-03-15 14:38 ` linux-next: build failure after merge of the aio tree Andy Shevchenko
2016-03-15 16:42   ` Arnd Bergmann
2016-03-15 16:19 ` Sudip Mukherjee
2016-03-15 16:22   ` Benjamin LaHaise
2016-03-15 22:02     ` Arnd Bergmann
2016-03-16 11:12       ` Andy Shevchenko
2016-03-16 13:59         ` Arnd Bergmann
2016-03-16 14:07           ` Benjamin LaHaise
  -- strict thread matches above, loose matches on Subject: below --
2016-01-12  5:40 Stephen Rothwell
2016-01-12 16:38 ` Benjamin LaHaise
2016-01-27  2:40   ` Stephen Rothwell
2016-01-29 11:30     ` Russell King - ARM Linux
2016-01-29 12:03       ` Geert Uytterhoeven
2016-02-04  2:19         ` Stephen Rothwell
2016-02-04 13:41           ` Benjamin LaHaise
2016-02-04 13:50             ` Russell King - ARM Linux
2016-02-04 14:08               ` Benjamin LaHaise
2016-02-04 14:12                 ` Russell King - ARM Linux
2016-02-04 14:32                   ` Benjamin LaHaise
2016-02-04 14:39                     ` Russell King - ARM Linux
2016-02-04 16:01                       ` Benjamin LaHaise
2016-02-04 16:17                         ` Russell King - ARM Linux
2016-02-04 16:27                           ` Benjamin LaHaise
2016-02-04 16:47                           ` Benjamin LaHaise
2016-02-04 18:48                           ` Benjamin LaHaise
2016-01-15  2:24 ` Stephen Rothwell
2016-01-15  7:39 ` Christoph Hellwig
2016-01-15  9:23   ` Stephen Rothwell
2016-01-15  9:25     ` Christoph Hellwig
2016-01-15 15:18       ` Benjamin LaHaise
2016-01-15 22:55         ` Stephen Rothwell
2016-03-14  4:49           ` Stephen Rothwell
2016-03-14 17:08             ` Benjamin LaHaise
2016-03-14 20:41               ` Stephen Rothwell
2013-08-30  7:55 Stephen Rothwell
2013-08-30 14:26 ` Benjamin LaHaise
2013-08-30 17:38 ` Linus Torvalds
2013-08-30 17:42   ` Benjamin LaHaise
2013-08-21  7:45 Stephen Rothwell
2013-08-21 15:52 ` Dave Kleikamp
2013-08-21 23:53   ` Stephen Rothwell

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=20160315174634.6766cd88@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=bcrl@kvack.org \
    --cc=benh@kernel.crashing.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=viro@ZenIV.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).