Re: [PATCH] powerpc/uaccess: fix warning/error with access_ok()

From: kbuild test robot
Date: Thu Oct 18 2018 - 19:12:19 EST


Hi Christophe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.19-rc8 next-20181018]
[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/Christophe-Leroy/powerpc-uaccess-fix-warning-error-with-access_ok/20181019-031908
base: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-socrates_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.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=7.2.0 make.cross ARCH=powerpc

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

In file included from include/linux/uaccess.h:14:0,
from arch/powerpc/include/asm/sections.h:7,
from include/linux/kallsyms.h:15,
from include/linux/ftrace.h:11,
from include/linux/init_task.h:9,
from arch/powerpc/kernel/process.c:32:
arch/powerpc/kernel/process.c: In function 'show_user_instructions':
>> arch/powerpc/include/asm/uaccess.h:21:25: error: incompatible type for argument 3 of '__access_ok'
#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
^
>> arch/powerpc/include/asm/uaccess.h:28:18: note: in expansion of macro 'MAKE_MM_SEG'
#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
^~~~~~~~~~~
>> arch/powerpc/kernel/process.c:1313:55: note: in expansion of macro 'USER_DS'
if (!__access_ok(pc, NR_INSN_TO_PRINT * sizeof(int), USER_DS)) {
^~~~~~~
arch/powerpc/include/asm/uaccess.h:58:19: note: expected 'long unsigned int' but argument is of type 'mm_segment_t {aka struct <anonymous>}'
static inline int __access_ok(int type, unsigned long addr, unsigned long size,
^~~~~~~~~~~
>> arch/powerpc/kernel/process.c:1313:7: error: too few arguments to function '__access_ok'
if (!__access_ok(pc, NR_INSN_TO_PRINT * sizeof(int), USER_DS)) {
^~~~~~~~~~~
In file included from include/linux/uaccess.h:14:0,
from arch/powerpc/include/asm/sections.h:7,
from include/linux/kallsyms.h:15,
from include/linux/ftrace.h:11,
from include/linux/init_task.h:9,
from arch/powerpc/kernel/process.c:32:
arch/powerpc/include/asm/uaccess.h:58:19: note: declared here
static inline int __access_ok(int type, unsigned long addr, unsigned long size,
^~~~~~~~~~~
--
In file included from include/linux/uaccess.h:14:0,
from arch/powerpc/include/asm/sections.h:7,
from include/linux/kallsyms.h:15,
from include/linux/ftrace.h:11,
from include/linux/kprobes.h:42,
from arch/powerpc/lib/sstep.c:12:
arch/powerpc/lib/sstep.c: In function 'address_ok':
>> arch/powerpc/include/asm/uaccess.h:21:25: error: incompatible type for argument 3 of '__access_ok'
#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
^
>> arch/powerpc/include/asm/uaccess.h:28:18: note: in expansion of macro 'MAKE_MM_SEG'
#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
^~~~~~~~~~~
>> arch/powerpc/lib/sstep.c:113:26: note: in expansion of macro 'USER_DS'
if (__access_ok(ea, nb, USER_DS))
^~~~~~~
arch/powerpc/include/asm/uaccess.h:58:19: note: expected 'long unsigned int' but argument is of type 'mm_segment_t {aka struct <anonymous>}'
static inline int __access_ok(int type, unsigned long addr, unsigned long size,
^~~~~~~~~~~
>> arch/powerpc/lib/sstep.c:113:6: error: too few arguments to function '__access_ok'
if (__access_ok(ea, nb, USER_DS))
^~~~~~~~~~~
In file included from include/linux/uaccess.h:14:0,
from arch/powerpc/include/asm/sections.h:7,
from include/linux/kallsyms.h:15,
from include/linux/ftrace.h:11,
from include/linux/kprobes.h:42,
from arch/powerpc/lib/sstep.c:12:
arch/powerpc/include/asm/uaccess.h:58:19: note: declared here
static inline int __access_ok(int type, unsigned long addr, unsigned long size,
^~~~~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:21:25: error: incompatible type for argument 3 of '__access_ok'
#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
^
>> arch/powerpc/include/asm/uaccess.h:28:18: note: in expansion of macro 'MAKE_MM_SEG'
#define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
^~~~~~~~~~~
arch/powerpc/lib/sstep.c:115:25: note: in expansion of macro 'USER_DS'
if (__access_ok(ea, 1, USER_DS))
^~~~~~~
arch/powerpc/include/asm/uaccess.h:58:19: note: expected 'long unsigned int' but argument is of type 'mm_segment_t {aka struct <anonymous>}'
static inline int __access_ok(int type, unsigned long addr, unsigned long size,
^~~~~~~~~~~
arch/powerpc/lib/sstep.c:115:6: error: too few arguments to function '__access_ok'
if (__access_ok(ea, 1, USER_DS))
^~~~~~~~~~~
In file included from include/linux/uaccess.h:14:0,
from arch/powerpc/include/asm/sections.h:7,
from include/linux/kallsyms.h:15,
from include/linux/ftrace.h:11,
from include/linux/kprobes.h:42,
from arch/powerpc/lib/sstep.c:12:
arch/powerpc/include/asm/uaccess.h:58:19: note: declared here
static inline int __access_ok(int type, unsigned long addr, unsigned long size,
^~~~~~~~~~~

vim +/__access_ok +21 arch/powerpc/include/asm/uaccess.h

2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 9
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 10 /*
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 11 * The fs value determines whether argument validity checking should be
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 12 * performed or not. If get_fs() == USER_DS, checking is performed, with
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 13 * get_fs() == KERNEL_DS, checking is bypassed.
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 14 *
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 15 * For historical reasons, these macros are grossly misnamed.
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 16 *
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 17 * The fs/ds values are now the highest legal address in the "segment".
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 18 * This simplifies the checking in the routines below.
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 19 */
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 20
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 @21 #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 22
5015b494 include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-31 23 #define KERNEL_DS MAKE_MM_SEG(~0UL)
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 24 #ifdef __powerpc64__
5015b494 include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-31 25 /* We use TASK_SIZE_USER64 as TASK_SIZE is not constant */
5015b494 include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-31 26 #define USER_DS MAKE_MM_SEG(TASK_SIZE_USER64 - 1)
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 27 #else
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 @28 #define USER_DS MAKE_MM_SEG(TASK_SIZE - 1)
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 29 #endif
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 30

:::::: The code at line 21 was first introduced by commit
:::::: 2df5e8bcca53e528a78ee0e3b114d0d21dd6d043 powerpc: merge uaccess.h

:::::: TO: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
:::::: CC: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip