Re: [PATCH v4 2/6] uaccess: Use user_access_ok() in user_access_begin()

From: kbuild test robot
Date: Sun Mar 03 2019 - 07:49:14 EST


Hi Masami,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/perf/core]
[also build test ERROR on v5.0-rc8 next-20190301]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Masami-Hiramatsu/tracing-probes-uaccess-Add-support-user-space-access/20190303-150015
config: riscv-defconfig (attached as .config)
compiler: riscv64-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
# save the attached .config to linux build tree
GCC_VERSION=8.2.0 make.cross ARCH=riscv

All errors (new ones prefixed by >>):

In file included from arch/riscv/include/asm/bug.h:75,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from lib/strncpy_from_user.c:5:
lib/strncpy_from_user.c: In function 'strncpy_from_user':
>> arch/riscv/include/asm/uaccess.h:42:19: error: 'TASK_SIZE' undeclared (first use in this function); did you mean 'TASK_SIZE_OF'?
#define USER_DS (TASK_SIZE)
^~~~~~~~~
include/asm-generic/bug.h:148:27: note: in definition of macro 'WARN_ON_ONCE'
int __ret_warn_once = !!(condition); \
^~~~~~~~~
include/linux/uaccess.h:26:16: note: in expansion of macro 'segment_eq'
WARN_ON_ONCE(!segment_eq(get_fs(), USER_DS)); \
^~~~~~~~~~
include/linux/uaccess.h:26:37: note: in expansion of macro 'USER_DS'
WARN_ON_ONCE(!segment_eq(get_fs(), USER_DS)); \
^~~~~~~
include/linux/uaccess.h:285:37: note: in expansion of macro 'user_access_ok'
#define user_access_begin(ptr, len) user_access_ok(ptr, len)
^~~~~~~~~~~~~~
lib/strncpy_from_user.c:117:7: note: in expansion of macro 'user_access_begin'
if (user_access_begin(src, max)) {
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/uaccess.h:42:19: note: each undeclared identifier is reported only once for each function it appears in
#define USER_DS (TASK_SIZE)
^~~~~~~~~
include/asm-generic/bug.h:148:27: note: in definition of macro 'WARN_ON_ONCE'
int __ret_warn_once = !!(condition); \
^~~~~~~~~
include/linux/uaccess.h:26:16: note: in expansion of macro 'segment_eq'
WARN_ON_ONCE(!segment_eq(get_fs(), USER_DS)); \
^~~~~~~~~~
include/linux/uaccess.h:26:37: note: in expansion of macro 'USER_DS'
WARN_ON_ONCE(!segment_eq(get_fs(), USER_DS)); \
^~~~~~~
include/linux/uaccess.h:285:37: note: in expansion of macro 'user_access_ok'
#define user_access_begin(ptr, len) user_access_ok(ptr, len)
^~~~~~~~~~~~~~
lib/strncpy_from_user.c:117:7: note: in expansion of macro 'user_access_begin'
if (user_access_begin(src, max)) {
^~~~~~~~~~~~~~~~~
--
In file included from arch/riscv/include/asm/bug.h:75,
from include/linux/bug.h:5,
from arch/riscv/include/asm/current.h:21,
from include/linux/sched.h:12,
from include/linux/uaccess.h:5,
from lib/strnlen_user.c:4:
lib/strnlen_user.c: In function 'strnlen_user':
>> arch/riscv/include/asm/uaccess.h:42:19: error: 'TASK_SIZE' undeclared (first use in this function); did you mean 'TASK_SIZE_OF'?
#define USER_DS (TASK_SIZE)
^~~~~~~~~
include/asm-generic/bug.h:148:27: note: in definition of macro 'WARN_ON_ONCE'
int __ret_warn_once = !!(condition); \
^~~~~~~~~
include/linux/uaccess.h:26:16: note: in expansion of macro 'segment_eq'
WARN_ON_ONCE(!segment_eq(get_fs(), USER_DS)); \
^~~~~~~~~~
include/linux/uaccess.h:26:37: note: in expansion of macro 'USER_DS'
WARN_ON_ONCE(!segment_eq(get_fs(), USER_DS)); \
^~~~~~~
include/linux/uaccess.h:285:37: note: in expansion of macro 'user_access_ok'
#define user_access_begin(ptr, len) user_access_ok(ptr, len)
^~~~~~~~~~~~~~
lib/strnlen_user.c:117:7: note: in expansion of macro 'user_access_begin'
if (user_access_begin(str, max)) {
^~~~~~~~~~~~~~~~~
arch/riscv/include/asm/uaccess.h:42:19: note: each undeclared identifier is reported only once for each function it appears in
#define USER_DS (TASK_SIZE)
^~~~~~~~~
include/asm-generic/bug.h:148:27: note: in definition of macro 'WARN_ON_ONCE'
int __ret_warn_once = !!(condition); \
^~~~~~~~~
include/linux/uaccess.h:26:16: note: in expansion of macro 'segment_eq'
WARN_ON_ONCE(!segment_eq(get_fs(), USER_DS)); \
^~~~~~~~~~
include/linux/uaccess.h:26:37: note: in expansion of macro 'USER_DS'
WARN_ON_ONCE(!segment_eq(get_fs(), USER_DS)); \
^~~~~~~
include/linux/uaccess.h:285:37: note: in expansion of macro 'user_access_ok'
#define user_access_begin(ptr, len) user_access_ok(ptr, len)
^~~~~~~~~~~~~~
lib/strnlen_user.c:117:7: note: in expansion of macro 'user_access_begin'
if (user_access_begin(str, max)) {
^~~~~~~~~~~~~~~~~

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

5d8544e2 Palmer Dabbelt 2017-07-10 27
5d8544e2 Palmer Dabbelt 2017-07-10 28 #define __enable_user_access() \
5d8544e2 Palmer Dabbelt 2017-07-10 29 __asm__ __volatile__ ("csrs sstatus, %0" : : "r" (SR_SUM) : "memory")
5d8544e2 Palmer Dabbelt 2017-07-10 30 #define __disable_user_access() \
5d8544e2 Palmer Dabbelt 2017-07-10 31 __asm__ __volatile__ ("csrc sstatus, %0" : : "r" (SR_SUM) : "memory")
5d8544e2 Palmer Dabbelt 2017-07-10 32
5d8544e2 Palmer Dabbelt 2017-07-10 33 /*
5d8544e2 Palmer Dabbelt 2017-07-10 34 * The fs value determines whether argument validity checking should be
5d8544e2 Palmer Dabbelt 2017-07-10 35 * performed or not. If get_fs() == USER_DS, checking is performed, with
5d8544e2 Palmer Dabbelt 2017-07-10 36 * get_fs() == KERNEL_DS, checking is bypassed.
5d8544e2 Palmer Dabbelt 2017-07-10 37 *
5d8544e2 Palmer Dabbelt 2017-07-10 38 * For historical reasons, these macros are grossly misnamed.
5d8544e2 Palmer Dabbelt 2017-07-10 39 */
5d8544e2 Palmer Dabbelt 2017-07-10 40
5d8544e2 Palmer Dabbelt 2017-07-10 41 #define KERNEL_DS (~0UL)
5d8544e2 Palmer Dabbelt 2017-07-10 @42 #define USER_DS (TASK_SIZE)
5d8544e2 Palmer Dabbelt 2017-07-10 43

:::::: The code at line 42 was first introduced by commit
:::::: 5d8544e2d0075a5f3c9a2cf27152354d54360da1 RISC-V: Generic library routines and assembly

:::::: TO: Palmer Dabbelt <palmer@xxxxxxxxxxx>
:::::: CC: Palmer Dabbelt <palmer@xxxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip