[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <mhng-9C57C767-A1FB-4547-9651-A430DA137E67@Palmers-Mini.rwc.dabbelt.com>
Date: Sat, 16 Aug 2025 09:54:43 -0700 (PDT)
From: Palmer Dabbelt <palmer@...belt.com>
To: viro@...iv.linux.org.uk
CC: lkp@...el.com, cleger@...osinc.com, oe-kbuild-all@...ts.linux.dev,
linux-kernel@...r.kernel.org, alexghiti@...osinc.com
Subject: Re: mm/maccess.c:41:17: sparse: sparse: incorrect type in argument 2 (different address spaces)
On Sat, 16 Aug 2025 09:19:28 PDT (-0700), viro@...iv.linux.org.uk wrote:
> On Sat, Aug 16, 2025 at 05:28:29PM +0800, kernel test robot wrote:
>> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> head: dfd4b508c8c6106083698a0dd5e35aecc7c48725
>> commit: ca1a66cdd685030738cf077e3955fdedfe39fbb9 riscv: uaccess: do not do misaligned accesses in get/put_user()
>> date: 2 months ago
>> config: riscv-randconfig-r122-20250816 (https://download.01.org/0day-ci/archive/20250816/202508161713.RWu30Lv1-lkp@intel.com/config)
>> compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 93d24b6b7b148c47a2fa228a4ef31524fa1d9f3f)
>> reproduce: (https://download.01.org/0day-ci/archive/20250816/202508161713.RWu30Lv1-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@...el.com>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/202508161713.RWu30Lv1-lkp@intel.com/
>>
>> sparse warnings: (new ones prefixed by >>)
>> WARNING: invalid argument to '-march': '_zacas_zabha'
>> >> mm/maccess.c:41:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got unsigned long long [usertype] * @@
>> mm/maccess.c:41:17: sparse: expected void const [noderef] __user *from
>> mm/maccess.c:41:17: sparse: got unsigned long long [usertype] *
>> >> mm/maccess.c:43:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got unsigned int [usertype] * @@
>> mm/maccess.c:43:17: sparse: expected void const [noderef] __user *from
>> mm/maccess.c:43:17: sparse: got unsigned int [usertype] *
>> >> mm/maccess.c:45:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got unsigned short [usertype] * @@
>> mm/maccess.c:45:17: sparse: expected void const [noderef] __user *from
>> mm/maccess.c:45:17: sparse: got unsigned short [usertype] *
>> >> mm/maccess.c:46:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got unsigned char [usertype] * @@
>> mm/maccess.c:46:9: sparse: expected void const [noderef] __user *from
>> mm/maccess.c:46:9: sparse: got unsigned char [usertype] *
>> >> mm/maccess.c:73:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *to @@ got unsigned long long [usertype] * @@
>> mm/maccess.c:73:17: sparse: expected void [noderef] __user *to
>> mm/maccess.c:73:17: sparse: got unsigned long long [usertype] *
>> >> mm/maccess.c:75:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *to @@ got unsigned int [usertype] * @@
>> mm/maccess.c:75:17: sparse: expected void [noderef] __user *to
>> mm/maccess.c:75:17: sparse: got unsigned int [usertype] *
>> >> mm/maccess.c:77:17: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *to @@ got unsigned short [usertype] * @@
>> mm/maccess.c:77:17: sparse: expected void [noderef] __user *to
>> mm/maccess.c:77:17: sparse: got unsigned short [usertype] *
>> >> mm/maccess.c:78:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *to @@ got unsigned char [usertype] * @@
>> mm/maccess.c:78:9: sparse: expected void [noderef] __user *to
>> mm/maccess.c:78:9: sparse: got unsigned char [usertype] *
>> mm/maccess.c:98:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got unsigned char [usertype] * @@
>> mm/maccess.c:98:17: sparse: expected void const [noderef] __user *from
>> mm/maccess.c:98:17: sparse: got unsigned char [usertype] *
>
> ... and that clearly has fuck-all to do with mm/maccess.c.
Ya, sorry, looks like something's just broken on the RISC-V side of
things. We lost the __user annotations when moving around the
misaligned access handling.
> The problem is in
> #define __get_kernel_nofault(dst, src, type, err_label) \
> __get_user_nocheck(*((type *)(dst)), (type *)(src), err_label)
>
> Make that
> __get_user_nocheck(*((type *)(dst)), (__force __user type *)(src), err_label)
> and similar in
> #define __put_kernel_nofault(dst, src, type, err_label) \
> __put_user_nocheck(*((type *)(src)), (type *)(dst), err_label)
> (cast also on the second argument) and see how much noise will go away.
Thanks, I'll go clean it up.
Powered by blists - more mailing lists