[arnd-playground:asm-generic-uaccess-4 1/7] arch/um/kernel/skas/uaccess.c:211:15: error: '__strncpy_from_user' undeclared here (not in a function); did you mean 'strncpy_from_user'?

From: kernel test robot
Date: Tue Jul 20 2021 - 15:51:33 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git asm-generic-uaccess-4
head: d7d80410412f516869e09904cffd817acaeec742
commit: d6c30cddd046b12ea68ec67c50bac29cae3da28c [1/7] asm-generic/uaccess.h: remove __strncpy_from_user/__strnlen_user
config: um-x86_64_defconfig (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?id=d6c30cddd046b12ea68ec67c50bac29cae3da28c
git remote add arnd-playground https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
git fetch --no-tags arnd-playground asm-generic-uaccess-4
git checkout d6c30cddd046b12ea68ec67c50bac29cae3da28c
# save the attached .config to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=um SUBARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

In file included from include/linux/linkage.h:7,
from include/linux/fs.h:5,
from include/linux/highmem.h:5,
from arch/um/kernel/skas/uaccess.c:7:
>> arch/um/kernel/skas/uaccess.c:211:15: error: '__strncpy_from_user' undeclared here (not in a function); did you mean 'strncpy_from_user'?
211 | EXPORT_SYMBOL(__strncpy_from_user);
| ^~~~~~~~~~~~~~~~~~~
include/linux/export.h:98:16: note: in definition of macro '___EXPORT_SYMBOL'
98 | extern typeof(sym) sym; \
| ^~~
include/linux/export.h:160:34: note: in expansion of macro '__EXPORT_SYMBOL'
160 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "")
| ^~~~~~~~~~~~~~~
include/linux/export.h:163:29: note: in expansion of macro '_EXPORT_SYMBOL'
163 | #define EXPORT_SYMBOL(sym) _EXPORT_SYMBOL(sym, "")
| ^~~~~~~~~~~~~~
arch/um/kernel/skas/uaccess.c:211:1: note: in expansion of macro 'EXPORT_SYMBOL'
211 | EXPORT_SYMBOL(__strncpy_from_user);
| ^~~~~~~~~~~~~
>> arch/um/kernel/skas/uaccess.c:242:6: warning: no previous prototype for '__strnlen_user' [-Wmissing-prototypes]
242 | long __strnlen_user(const void __user *str, long len)
| ^~~~~~~~~~~~~~


vim +211 arch/um/kernel/skas/uaccess.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 191
d6c30cddd046b1 Arnd Bergmann 2020-01-16 192 long strncpy_from_user(char *dst, const char __user *src, long count)
^1da177e4c3f41 Linus Torvalds 2005-04-16 193 {
f8d65d27e677da Richard Weinberger 2015-05-12 194 long n;
^1da177e4c3f41 Linus Torvalds 2005-04-16 195 char *ptr = dst;
^1da177e4c3f41 Linus Torvalds 2005-04-16 196
d6c30cddd046b1 Arnd Bergmann 2020-01-16 197 if (!access_ok(src, 1))
d6c30cddd046b1 Arnd Bergmann 2020-01-16 198 return -EFAULT;
d6c30cddd046b1 Arnd Bergmann 2020-01-16 199
db68ce10c4f0a2 Al Viro 2017-03-20 200 if (uaccess_kernel()) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 201 strncpy(dst, (__force void *) src, count);
8ca842c4b5cbc7 Jeff Dike 2007-10-16 202 return strnlen(dst, count);
^1da177e4c3f41 Linus Torvalds 2005-04-16 203 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 204
^1da177e4c3f41 Linus Torvalds 2005-04-16 205 n = buffer_op((unsigned long) src, count, 0, strncpy_chunk_from_user,
^1da177e4c3f41 Linus Torvalds 2005-04-16 206 &ptr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 207 if (n != 0)
8ca842c4b5cbc7 Jeff Dike 2007-10-16 208 return -EFAULT;
8ca842c4b5cbc7 Jeff Dike 2007-10-16 209 return strnlen(dst, count);
^1da177e4c3f41 Linus Torvalds 2005-04-16 210 }
f8d65d27e677da Richard Weinberger 2015-05-12 @211 EXPORT_SYMBOL(__strncpy_from_user);
^1da177e4c3f41 Linus Torvalds 2005-04-16 212
^1da177e4c3f41 Linus Torvalds 2005-04-16 213 static int clear_chunk(unsigned long addr, int len, void *unused)
^1da177e4c3f41 Linus Torvalds 2005-04-16 214 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 215 memset((void *) addr, 0, len);
8ca842c4b5cbc7 Jeff Dike 2007-10-16 216 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 217 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 218
f8d65d27e677da Richard Weinberger 2015-05-12 219 unsigned long __clear_user(void __user *mem, unsigned long len)
^1da177e4c3f41 Linus Torvalds 2005-04-16 220 {
db68ce10c4f0a2 Al Viro 2017-03-20 221 if (uaccess_kernel()) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 222 memset((__force void*)mem, 0, len);
8ca842c4b5cbc7 Jeff Dike 2007-10-16 223 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 224 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 225
f8d65d27e677da Richard Weinberger 2015-05-12 226 return buffer_op((unsigned long) mem, len, 1, clear_chunk, NULL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 227 }
f8d65d27e677da Richard Weinberger 2015-05-12 228 EXPORT_SYMBOL(__clear_user);
^1da177e4c3f41 Linus Torvalds 2005-04-16 229
^1da177e4c3f41 Linus Torvalds 2005-04-16 230 static int strnlen_chunk(unsigned long str, int len, void *arg)
^1da177e4c3f41 Linus Torvalds 2005-04-16 231 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 232 int *len_ptr = arg, n;
^1da177e4c3f41 Linus Torvalds 2005-04-16 233
^1da177e4c3f41 Linus Torvalds 2005-04-16 234 n = strnlen((void *) str, len);
^1da177e4c3f41 Linus Torvalds 2005-04-16 235 *len_ptr += n;
^1da177e4c3f41 Linus Torvalds 2005-04-16 236
^1da177e4c3f41 Linus Torvalds 2005-04-16 237 if (n < len)
8ca842c4b5cbc7 Jeff Dike 2007-10-16 238 return 1;
8ca842c4b5cbc7 Jeff Dike 2007-10-16 239 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 240 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 241
f8d65d27e677da Richard Weinberger 2015-05-12 @242 long __strnlen_user(const void __user *str, long len)
^1da177e4c3f41 Linus Torvalds 2005-04-16 243 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 244 int count = 0, n;
^1da177e4c3f41 Linus Torvalds 2005-04-16 245
db68ce10c4f0a2 Al Viro 2017-03-20 246 if (uaccess_kernel())
8ca842c4b5cbc7 Jeff Dike 2007-10-16 247 return strnlen((__force char*)str, len) + 1;
^1da177e4c3f41 Linus Torvalds 2005-04-16 248
^1da177e4c3f41 Linus Torvalds 2005-04-16 249 n = buffer_op((unsigned long) str, len, 0, strnlen_chunk, &count);
^1da177e4c3f41 Linus Torvalds 2005-04-16 250 if (n == 0)
8ca842c4b5cbc7 Jeff Dike 2007-10-16 251 return count + 1;
3179ce7254ffa4 Richard Weinberger 2013-05-11 252 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 253 }
f8d65d27e677da Richard Weinberger 2015-05-12 254 EXPORT_SYMBOL(__strnlen_user);
dd3035a21ba7cc Anton Ivanov 2021-03-12 255

:::::: The code at line 211 was first introduced by commit
:::::: f8d65d27e677da0ce33de570e3068308a77ed2b1 um: Rework uaccess code

:::::: TO: Richard Weinberger <richard@xxxxxx>
:::::: CC: Richard Weinberger <richard@xxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip