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, 18 Aug 2021 16:01:26 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Kees Cook <keescook@...omium.org>
Cc:     linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] lkdtm/heap: Avoid __alloc_size hint warning

On Tue, Aug 17, 2021 at 09:45:40PM -0700, Kees Cook wrote:
> Once __alloc_size hints have been added, the compiler will
> (correctly!) see this as an overflow. We are, however, trying to test
> for this condition, so work around it with a volatile int.
> 
> Signed-off-by: Kees Cook <keescook@...omium.org>
> ---
>  drivers/misc/lkdtm/heap.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/lkdtm/heap.c b/drivers/misc/lkdtm/heap.c
> index 3d9aae5821a0..e59fcbe00ae0 100644
> --- a/drivers/misc/lkdtm/heap.c
> +++ b/drivers/misc/lkdtm/heap.c
> @@ -12,6 +12,8 @@ static struct kmem_cache *double_free_cache;
>  static struct kmem_cache *a_cache;
>  static struct kmem_cache *b_cache;
>  
> +static volatile int __offset = 1;

Perhaps a comment here as to why volatile is ok to use?  That feels like
it is a hack around the compiler of today, what happens tomorrow when
newer versions decide to ignore volatile as it "knows" no one ever
changes it?

thanks,

greg k-h

Powered by blists - more mailing lists