lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fdae3de9-db03-b04d-1992-bc8efd053053@intel.com>
Date:   Mon, 14 Nov 2022 14:55:46 -0800
From:   Dave Hansen <dave.hansen@...el.com>
To:     kernel test robot <lkp@...el.com>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc:     oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
        x86@...nel.org, Dave Hansen <dave.hansen@...ux.intel.com>
Subject: Re: [tip:x86/mm 5/16] sound/core/hwdep.c:243:24: sparse: sparse:
 incorrect type in assignment (different address spaces)

On 11/14/22 13:41, kernel test robot wrote:
>    sound/core/hwdep.c:243:24: sparse:     expected int [noderef] __user *__ptr_clean
>    sound/core/hwdep.c:243:24: sparse:     got int *
>    sound/core/hwdep.c:273:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected int [noderef] __user *__ptr_clean @@     got int * @@
>    sound/core/hwdep.c:273:29: sparse:     expected int [noderef] __user *__ptr_clean
>    sound/core/hwdep.c:273:29: sparse:     got int *
>    sound/core/hwdep.c:292:29: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected int [noderef] __user *__ptr_clean @@     got int * @@
>    sound/core/hwdep.c:292:29: sparse:     expected int [noderef] __user *__ptr_clean
>    sound/core/hwdep.c:292:29: sparse:     got int *

I think the sparse ends up throwing away all of its annotations once it
dereferences a pointer.  So, '*(int __user *)' boils down to a plain
'int'.  Confusingly, a '*(int __user *) *' boils down to an 'int *'.

That's what happened here.  A __user-annotated point got dereferenced
down to an 'int' and then turned into a pointer again.

I think the trick in this case is to avoid dereferencing the pointer too
early by just moving the dereference outside of the casting, like the
attached patch.  But, it also feels kinda wrong.  I'd love a second
opinion on this one.
View attachment "lam-sparse.patch" of type "text/x-patch" (528 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ