[PATCH 3/4] riscv: uaccess: use 'asm goto' for put_user()

kernel test robot lkp at intel.com
Thu Jul 4 19:22:40 PDT 2024


Hi Jisheng,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.10-rc6 next-20240703]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jisheng-Zhang/riscv-implement-user_access_begin-and-families/20240626-005352
base:   linus/master
patch link:    https://lore.kernel.org/r/20240625040500.1788-4-jszhang%40kernel.org
patch subject: [PATCH 3/4] riscv: uaccess: use 'asm goto' for put_user()
config: riscv-randconfig-r121-20240705 (https://download.01.org/0day-ci/archive/20240705/202407051058.kE7ADWxJ-lkp@intel.com/config)
compiler: riscv32-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240705/202407051058.kE7ADWxJ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407051058.kE7ADWxJ-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:13,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/compat.h:17,
                    from arch/riscv/include/asm/elf.h:12,
                    from include/linux/elf.h:6,
                    from include/linux/module.h:19,
                    from include/linux/device/driver.h:21,
                    from include/linux/device.h:32,
                    from include/linux/node.h:18,
                    from include/linux/cpu.h:17,
                    from arch/riscv/kernel/process.c:10:
   arch/riscv/kernel/process.c: In function 'get_unalign_ctl':
>> arch/riscv/include/asm/uaccess.h:211:46: error: expected ')' before ':' token
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:301:17: note: in expansion of macro '__put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^~~~~~~~~~
   arch/riscv/kernel/process.c:57:16: note: in expansion of macro 'put_user'
      57 |         return put_user(tsk->thread.align_ctl, (unsigned long __user *)adr);
         |                ^~~~~~~~
   arch/riscv/include/asm/uaccess.h:202:30: note: to match this '('
     202 |         __asm__ __volatile__ (                                  \
         |                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:301:17: note: in expansion of macro '__put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^~~~~~~~~~
   arch/riscv/kernel/process.c:57:16: note: in expansion of macro 'put_user'
      57 |         return put_user(tsk->thread.align_ctl, (unsigned long __user *)adr);
         |                ^~~~~~~~
--
   In file included from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:13,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/linux/compat.h:17,
                    from arch/riscv/kernel/signal.c:9:
   arch/riscv/kernel/signal.c: In function 'setup_sigcontext':
>> arch/riscv/include/asm/uaccess.h:211:46: error: expected ')' before ':' token
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/kernel/signal.c:290:16: note: in expansion of macro '__put_user'
     290 |         err |= __put_user(0, &sc->sc_extdesc.reserved);
         |                ^~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:202:30: note: to match this '('
     202 |         __asm__ __volatile__ (                                  \
         |                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/kernel/signal.c:290:16: note: in expansion of macro '__put_user'
     290 |         err |= __put_user(0, &sc->sc_extdesc.reserved);
         |                ^~~~~~~~~~
>> arch/riscv/include/asm/uaccess.h:211:46: error: expected ')' before ':' token
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/kernel/signal.c:292:16: note: in expansion of macro '__put_user'
     292 |         err |= __put_user(END_MAGIC, &sc_ext_ptr->magic);
         |                ^~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:202:30: note: to match this '('
     202 |         __asm__ __volatile__ (                                  \
         |                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/kernel/signal.c:292:16: note: in expansion of macro '__put_user'
     292 |         err |= __put_user(END_MAGIC, &sc_ext_ptr->magic);
         |                ^~~~~~~~~~
>> arch/riscv/include/asm/uaccess.h:211:46: error: expected ')' before ':' token
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/kernel/signal.c:293:16: note: in expansion of macro '__put_user'
     293 |         err |= __put_user(END_HDR_SIZE, &sc_ext_ptr->size);
         |                ^~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:202:30: note: to match this '('
     202 |         __asm__ __volatile__ (                                  \
         |                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/kernel/signal.c:293:16: note: in expansion of macro '__put_user'
     293 |         err |= __put_user(END_HDR_SIZE, &sc_ext_ptr->size);
         |                ^~~~~~~~~~
   arch/riscv/kernel/signal.c: In function 'setup_rt_frame':
>> arch/riscv/include/asm/uaccess.h:211:46: error: expected ')' before ':' token
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/kernel/signal.c:336:16: note: in expansion of macro '__put_user'
     336 |         err |= __put_user(0, &frame->uc.uc_flags);
         |                ^~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:202:30: note: to match this '('
     202 |         __asm__ __volatile__ (                                  \
         |                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/kernel/signal.c:336:16: note: in expansion of macro '__put_user'
     336 |         err |= __put_user(0, &frame->uc.uc_flags);
         |                ^~~~~~~~~~
>> arch/riscv/include/asm/uaccess.h:211:46: error: expected ')' before ':' token
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/kernel/signal.c:337:16: note: in expansion of macro '__put_user'
     337 |         err |= __put_user(NULL, &frame->uc.uc_link);
         |                ^~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:202:30: note: to match this '('
     202 |         __asm__ __volatile__ (                                  \
         |                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/kernel/signal.c:337:16: note: in expansion of macro '__put_user'
     337 |         err |= __put_user(NULL, &frame->uc.uc_link);
         |                ^~~~~~~~~~
--
   In file included from include/linux/uaccess.h:11,
                    from include/linux/sched/task.h:13,
                    from include/linux/sched/signal.h:9,
                    from include/linux/rcuwait.h:6,
                    from include/linux/percpu-rwsem.h:7,
                    from include/linux/fs.h:33,
                    from include/uapi/linux/aio_abi.h:31,
                    from include/linux/syscalls.h:82,
                    from arch/riscv/kernel/sys_hwprobe.c:7:
   arch/riscv/kernel/sys_hwprobe.c: In function 'hwprobe_get_values':
>> arch/riscv/include/asm/uaccess.h:211:46: error: expected ')' before ':' token
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:301:17: note: in expansion of macro '__put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^~~~~~~~~~
   arch/riscv/kernel/sys_hwprobe.c:278:23: note: in expansion of macro 'put_user'
     278 |                 ret = put_user(pair.key, &pairs->key);
         |                       ^~~~~~~~
   arch/riscv/include/asm/uaccess.h:202:30: note: to match this '('
     202 |         __asm__ __volatile__ (                                  \
         |                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:301:17: note: in expansion of macro '__put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^~~~~~~~~~
   arch/riscv/kernel/sys_hwprobe.c:278:23: note: in expansion of macro 'put_user'
     278 |                 ret = put_user(pair.key, &pairs->key);
         |                       ^~~~~~~~
>> arch/riscv/include/asm/uaccess.h:211:46: error: expected ')' before ':' token
     211 |                         "m" (__ptr[__MSW]) : : label);          \
         |                                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:301:17: note: in expansion of macro '__put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^~~~~~~~~~
   arch/riscv/kernel/sys_hwprobe.c:280:31: note: in expansion of macro 'put_user'
     280 |                         ret = put_user(pair.value, &pairs->value);
         |                               ^~~~~~~~
   arch/riscv/include/asm/uaccess.h:202:30: note: to match this '('
     202 |         __asm__ __volatile__ (                                  \
         |                              ^
   arch/riscv/include/asm/uaccess.h:228:17: note: in expansion of macro '__put_user_8'
     228 |                 __put_user_8((x), __gu_ptr, label);             \
         |                 ^~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:238:9: note: in expansion of macro '__put_user_nocheck'
     238 |         __put_user_nocheck(x, ptr, err_label);                  \
         |         ^~~~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:274:9: note: in expansion of macro '__put_user_error'
     274 |         __put_user_error(__val, __gu_ptr, __pu_err);            \
         |         ^~~~~~~~~~~~~~~~
   arch/riscv/include/asm/uaccess.h:301:17: note: in expansion of macro '__put_user'
     301 |                 __put_user((x), __p) :                          \
         |                 ^~~~~~~~~~
   arch/riscv/kernel/sys_hwprobe.c:280:31: note: in expansion of macro 'put_user'
     280 |                         ret = put_user(pair.value, &pairs->value);
         |                               ^~~~~~~~


vim +211 arch/riscv/include/asm/uaccess.h

   193	
   194	#ifdef CONFIG_64BIT
   195	#define __put_user_8(x, ptr, label) \
   196		__put_user_asm("sd", x, ptr, label)
   197	#else /* !CONFIG_64BIT */
   198	#define __put_user_8(x, ptr, label)				\
   199	do {								\
   200		u32 __user *__ptr = (u32 __user *)(ptr);		\
   201		u64 __x = (__typeof__((x)-(x)))(x);			\
   202		__asm__ __volatile__ (					\
   203			"1:\n"						\
   204			"	sw %z0, %2\n"				\
   205			"2:\n"						\
   206			"	sw %z1, %3\n"				\
   207			_ASM_EXTABLE(1b, %l4)				\
   208			_ASM_EXTABLE(2b, %l4)				\
   209			: : "rJ" (__x), "rJ" (__x >> 32),		\
   210				"m" (__ptr[__LSW]),			\
 > 211				"m" (__ptr[__MSW]) : : label);		\
   212	} while (0)
   213	#endif /* CONFIG_64BIT */
   214	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



More information about the linux-riscv mailing list