Re: [PATCH v4 04/45] x86: asm: instrument usercopy in get_user() and __put_user_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 2, 2022 at 5:47 AM kernel test robot <lkp@xxxxxxxxx> wrote:
>
> Hi Alexander,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on masahiroy-kbuild/for-next]
> [also build test WARNING on linus/master v5.19-rc4 next-20220701]
> [cannot apply to tip/x86/core tip/x86/mm]
> [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]
>
> url:    https://github.com/intel-lab-lkp/linux/commits/Alexander-Potapenko/Add-KernelMemorySanitizer-infrastructure/20220701-222712
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next
> config: i386-randconfig-s002 (https://download.01.org/0day-ci/archive/20220702/202207021129.palrTLrL-lkp@xxxxxxxxx/config)
> compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
> reproduce:
>         # apt-get install sparse
>         # sparse version: v0.6.4-39-gce1a6720-dirty
>         # https://github.com/intel-lab-lkp/linux/commit/0ca0e4029535365a65588446ba55a952ca186079
>         git remote add linux-review https://github.com/intel-lab-lkp/linux
>         git fetch --no-tags linux-review Alexander-Potapenko/Add-KernelMemorySanitizer-infrastructure/20220701-222712
>         git checkout 0ca0e4029535365a65588446ba55a952ca186079
>         # save the config file
>         mkdir build_dir && cp config build_dir/.config
>         make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kernel/ mm/
>
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
>
> sparse warnings: (new ones prefixed by >>)
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned long long [usertype] * @@
>    arch/x86/kernel/signal.c:360:9: sparse:     expected void const volatile [noderef] __user *ptr
>    arch/x86/kernel/signal.c:360:9: sparse:     got unsigned long long [usertype] *
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
> >> arch/x86/kernel/signal.c:360:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned long long [usertype] * @@
>    arch/x86/kernel/signal.c:360:9: sparse:     expected void [noderef] __user *to
>    arch/x86/kernel/signal.c:360:9: sparse:     got unsigned long long [usertype] *
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned long long [usertype] * @@
>    arch/x86/kernel/signal.c:420:9: sparse:     expected void const volatile [noderef] __user *ptr
>    arch/x86/kernel/signal.c:420:9: sparse:     got unsigned long long [usertype] *
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned long long [usertype] * @@
>    arch/x86/kernel/signal.c:420:9: sparse:     expected void [noderef] __user *to
>    arch/x86/kernel/signal.c:420:9: sparse:     got unsigned long long [usertype] *
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
>    arch/x86/kernel/signal.c:953:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct lockdep_map const *lock @@     got struct lockdep_map [noderef] __rcu * @@
>    arch/x86/kernel/signal.c:953:9: sparse:     expected struct lockdep_map const *lock
>    arch/x86/kernel/signal.c:953:9: sparse:     got struct lockdep_map [noderef] __rcu *

Looks like sparse is complaining about the missing __user attribute in the cast:
============================================
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 9c7265b524c73..437de52e2ecaa 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -357,7 +357,7 @@ __setup_frame(int sig, struct ksignal *ksig, sigset_t *set,
         * reasons and because gdb uses it as a signature to notice
         * signal handler stack frames.
         */
-       unsafe_put_user(*((u64 *)&retcode), (u64 *)frame->retcode, Efault);
+       unsafe_put_user(*((u64 *)&retcode), (__user u64
*)frame->retcode, Efault);
        user_access_end();

        /* Set up registers for signal handler */
============================================

The only reason it blames KMSAN patches is because those add yet
another hook inside unsafe_put_user() that expects a __user pointer.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux