Re: drivers/infiniband/core/.tmp_gl_uverbs_main.o:undefined reference to `__user_bad'
From: Randy Dunlap
Date: Mon Aug 05 2019 - 00:50:59 EST
On 4/2/19 7:38 PM, Randy Dunlap wrote:
> On 2/28/19 1:03 AM, kbuild test robot wrote:
>> Hi Jason,
>>
>> FYI, the error/warning still remains.
>>
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: 7d762d69145a54d169f58e56d6dac57a5508debc
>> commit: 3a6532c9af1a7836da2d597f1aaca73cb16c3b97 RDMA/uverbs: Use uverbs_attr_bundle to pass udata for write
>> date: 3 months ago
>> config: microblaze-allyesconfig (attached as .config)
>> compiler: microblaze-linux-gcc (GCC) 8.2.0
>> reproduce:
>> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>> chmod +x ~/bin/make.cross
>> git checkout 3a6532c9af1a7836da2d597f1aaca73cb16c3b97
>> # save the attached .config to linux build tree
>> GCC_VERSION=8.2.0 make.cross ARCH=microblaze
>>
>> All errors (new ones prefixed by >>):
>>
>> `.exit.data' referenced in section `.exit.text' of drivers/tty/n_hdlc.o: defined in discarded section `.exit.data' of drivers/tty/n_hdlc.o
>> `.exit.data' referenced in section `.exit.text' of drivers/tty/n_hdlc.o: defined in discarded section `.exit.data' of drivers/tty/n_hdlc.o
>> drivers/infiniband/core/uverbs_main.o: In function `ib_uverbs_write':
>>>> drivers/infiniband/core/.tmp_gl_uverbs_main.o:(.text+0x13a4): undefined reference to `__user_bad'
>> drivers/android/binder.o: In function `binder_thread_write':
>> drivers/android/.tmp_gl_binder.o:(.text+0xda6c): undefined reference to `__user_bad'
>> drivers/android/.tmp_gl_binder.o:(.text+0xda98): undefined reference to `__user_bad'
>> drivers/android/.tmp_gl_binder.o:(.text+0xdf10): undefined reference to `__user_bad'
>> drivers/android/.tmp_gl_binder.o:(.text+0xe498): undefined reference to `__user_bad'
>> drivers/android/binder.o:drivers/android/.tmp_gl_binder.o:(.text+0xea78): more undefined references to `__user_bad' follow
>>
>> ---
>> 0-DAY kernel test infrastructure Open Source Technology Center
>> https://lists.01.org/pipermail/kbuild-all Intel Corporation
>
> Hi Michal,
>
> Would you comment on this, please?
[crickets]
> Jason has said more than once that these build errors are because
> arch/microblaze does not support get_user() of size 8 (bytes),
> although it does support a put_user() of size 8.
>
>
> See a previous report & comment at
> https://lore.kernel.org/lkml/20190101200742.GA5757@xxxxxxxxxxxx/
>
>
> thanks.
I currently don't have a cross-build environment set up, so I haven't
built this yet, but a patch like this might fix this nagging issue.
(It's clearly not high priority since arch/microblaze/ mostly seems to be
not well-maintained.)
---
From: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
arch/microblaze/ is missing support for get_user() of size 8 bytes,
so add it by using __copy_from_user().
Fixes these build errors:
drivers/infiniband/core/uverbs_main.o: In function `ib_uverbs_write':
drivers/infiniband/core/.tmp_gl_uverbs_main.o:(.text+0x13a4): undefined reference to `__user_bad'
drivers/android/binder.o: In function `binder_thread_write':
drivers/android/.tmp_gl_binder.o:(.text+0xda6c): undefined reference to `__user_bad'
drivers/android/.tmp_gl_binder.o:(.text+0xda98): undefined reference to `__user_bad'
drivers/android/.tmp_gl_binder.o:(.text+0xdf10): undefined reference to `__user_bad'
drivers/android/.tmp_gl_binder.o:(.text+0xe498): undefined reference to `__user_bad'
drivers/android/binder.o:drivers/android/.tmp_gl_binder.o:(.text+0xea78): more undefined references to `__user_bad' follow
Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
---
arch/microblaze/include/asm/uaccess.h | 6 ++++++
1 file changed, 6 insertions(+)
--- lnx-53-rc3.orig/arch/microblaze/include/asm/uaccess.h
+++ lnx-53-rc3/arch/microblaze/include/asm/uaccess.h
@@ -186,6 +186,9 @@ extern long __user_bad(void);
__get_user_asm("lw", __gu_addr, __gu_val, \
__gu_err); \
break; \
+ case 8: \
+ __gu_err = __copy_from_user(&__gu_val, __gu_addr, 8);\
+ break; \
default: \
__gu_err = __user_bad(); \
break; \
@@ -212,6 +215,9 @@ extern long __user_bad(void);
case 4: \
__get_user_asm("lw", (ptr), __gu_val, __gu_err); \
break; \
+ case 8: \
+ __gu_err = __copy_from_user(&__gu_val, ptr, 8); \
+ break; \
default: \
/* __gu_val = 0; __gu_err = -EINVAL;*/ __gu_err = __user_bad();\
} \