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]
Date:   Wed, 15 Feb 2017 17:19:49 +0300
From:   Andrey Ryabinin <aryabinin@...tuozzo.com>
To:     Arnd Bergmann <arnd@...db.de>, Dmitry Vyukov <dvyukov@...gle.com>
CC:     "kasan-dev@...glegroups.com" <kasan-dev@...glegroups.com>,
        Alexander Potapenko <glider@...gle.com>,
        <linux-kernel@...r.kernel.org>,
        Christian Borntraeger <borntraeger@...ibm.com>
Subject: Re: [RFC] kasan stack overflow warnings again: READ_ONCE(),
 typecheck()



On 02/15/2017 05:06 PM, Andrey Ryabinin wrote:

> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index 10bca12..5d9dd63 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -301,10 +301,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
>   */
>  
>  #define __READ_ONCE(x, check)						\
> -	__builtin_choose_expr(sizeof(x) == 1, *(volatile typeof(&(x)))&(x), \
> -	__builtin_choose_expr(sizeof(x) == 2, *(volatile typeof(&(x)))&(x), \
> -	__builtin_choose_expr(sizeof(x) == 4, *(volatile typeof(&(x)))&(x), \
> -	__builtin_choose_expr(sizeof(x) == sizeof(long), *(volatile typeof(&(x)))&(x), \
> +	__builtin_choose_expr(sizeof(x) == 1, (typeof(x))(__u64)*(volatile __u8 *)&(x), \
> +	__builtin_choose_expr(sizeof(x) == 2, (typeof(x))(__u64)*(volatile __u16 *)&(x), \
> +	__builtin_choose_expr(sizeof(x) == 4, (typeof(x))(__u64)*(volatile __u32 *)&(x), \
> +	__builtin_choose_expr(sizeof(x) == 8, (typeof(x))(__u64)*(volatile __u64 *)&(x), \
>  	({union { typeof(x) __val; char __c[1]; } __u;			\
>  	if (check)							\
>  		__read_once_size(&(x), __u.__c, sizeof(x));		\

Scratch this, it doesn't work:
../arch/x86/mm/gup.c:20:2: error: conversion to non-scalar type requested
  return READ_ONCE(*ptep);
  ^

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ