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: <16BFDECA-7774-49D0-A68C-86711E10DDC5@lca.pw>
Date:   Thu, 1 Aug 2019 08:09:44 -0400
From:   Qian Cai <cai@....pw>
To:     Will Deacon <will@...nel.org>
Cc:     Catalin Marinas <catalin.marinas@....com>, andreyknvl@...gle.com,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] arm64/mm: fix variable 'tag' set but not used



> On Aug 1, 2019, at 8:07 AM, Qian Cai <cai@....pw> wrote:
> 
> 
> 
>> On Aug 1, 2019, at 8:01 AM, Will Deacon <will@...nel.org> wrote:
>> 
>> On Wed, Jul 31, 2019 at 04:38:18PM -0400, Qian Cai wrote:
>>> When CONFIG_KASAN_SW_TAGS=n, set_tag() is compiled away. GCC throws a
>>> warning,
>>> 
>>> mm/kasan/common.c: In function '__kasan_kmalloc':
>>> mm/kasan/common.c:464:5: warning: variable 'tag' set but not used
>>> [-Wunused-but-set-variable]
>>> u8 tag = 0xff;
>>>    ^~~
>>> 
>>> Fix it by making __tag_set() a static inline function.
>>> 
>>> Signed-off-by: Qian Cai <cai@....pw>
>>> ---
>>> arch/arm64/include/asm/memory.h | 6 +++++-
>>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>> 
>>> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
>>> index b7ba75809751..9645b1340afe 100644
>>> --- a/arch/arm64/include/asm/memory.h
>>> +++ b/arch/arm64/include/asm/memory.h
>>> @@ -210,7 +210,11 @@ static inline unsigned long kaslr_offset(void)
>>> #define __tag_reset(addr)	untagged_addr(addr)
>>> #define __tag_get(addr)		(__u8)((u64)(addr) >> 56)
>>> #else
>>> -#define __tag_set(addr, tag)	(addr)
>>> +static inline const void *__tag_set(const void *addr, u8 tag)
>>> +{
>>> +	return addr;
>>> +}
>> 
>> Why doesn't this trigger a warning in page_to_virt(), which passes an
>> unsigned long for the address parameter?
> 
> #define page_to_virt(page) … __tag_set(__addr, page_kasan_tag(page)); …
> 
> static inline u8 page_kasan_tag(const struct page *page)
> {	
> 	return 0xff;
> }
> 
> GCC will see that “page” is used.

If you are talking about “addr”,

#define __tag_set(addr, tag)	(addr)

It is actually used.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ