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: <89e914cc-e050-a901-1674-e9efcd53a981@redhat.com>
Date:   Fri, 2 Sep 2016 14:53:52 -0700
From:   Laura Abbott <labbott@...hat.com>
To:     Arnd Bergmann <arnd@...db.de>, linaro-mm-sig@...ts.linaro.org
Cc:     kbuild test robot <lkp@...el.com>,
        Daniel Vetter <daniel.vetter@...ll.ch>,
        devel@...verdev.osuosl.org, Jon Medhurst <tixy@...aro.org>,
        Android Kernel Team <kernel-team@...roid.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jeremy Gebben <jgebben@...eaurora.org>,
        Liviu Dudau <Liviu.Dudau@....com>,
        Arve Hjønnevåg <arve@...roid.com>,
        linux-kernel@...r.kernel.org,
        Riley Andrews <riandrews@...roid.com>,
        John Stultz <john.stultz@...aro.org>, kbuild-all@...org,
        Eun Taik Lee <eun.taik.lee@...sung.com>,
        Chen Feng <puck.chen@...ilicon.com>,
        Brian Starkey <brian.starkey@....com>
Subject: Re: [Linaro-mm-sig] [PATCHv2 4/4] staging: android: ion: Add ioctl to
 query available heaps

On 09/02/2016 02:37 PM, Arnd Bergmann wrote:
> On Friday, September 2, 2016 2:27:21 PM CEST Laura Abbott wrote:
>>>
>>> All warnings (new ones prefixed by >>):
>>>
>>>    drivers/staging/android/ion/ion.c: In function 'ion_query_heaps':
>>>>> drivers/staging/android/ion/ion.c:1181:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>>>       (struct ion_heap_data __user *)query->heaps;
>>>       ^
>>>
>>
>> botching-up-ioctls.txt says:
>>
>>   * Pointers are __u64, cast from/to a uintprt_t on the userspace side and
>>     from/to a void __user * in the kernel. Try really hard not to delay this
>>     conversion or worse, fiddle the raw __u64 through your code since that
>>     diminishes the checking tools like sparse can provide.
>>
>> This doesn't seem like it will work on 32-bit systems since you'll end up
>> with the warning above. Is there a better option or did I misunderstand
>> how that is supposed to work?
>>
>
> I don't know a better way that two cast, doing
> 	
> 	(struct ion_heap_data __user *)(uintptr_t)query->heaps;
>
> It may help to put this into an inline function though.
>
> 	Arnd
>

There already is one it turns out in kernel.h:

#define u64_to_user_ptr(x) (            \
{                                       \
         typecheck(u64, x);              \
         (void __user *)(uintptr_t)x;    \
}                                       \
)

At least this way I don't have to look at the double casts.

Thanks,
Laura


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ