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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 4 Nov 2021 13:57:00 +0000
From:   Matthew Wilcox <willy@...radead.org>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Arnd Bergmann <arnd@...db.de>,
        "Uladzislau Rezki (Sony)" <urezki@...il.com>,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Nicholas Piggin <npiggin@...il.com>,
        Michal Hocko <mhocko@...e.com>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Chen Wandun <chenwandun@...wei.com>,
        David Hildenbrand <david@...hat.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: vmap: avoid -Wsequence-point warning

On Thu, Nov 04, 2021 at 02:35:40PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
> 
> gcc warns about potentially undefined behavior in an array index:
> 
> mm/vmalloc.c: In function 'vmap_pfn_apply':
> mm/vmalloc.c:2800:58: error: operation on 'data->idx' may be undefined [-Werror=sequence-point]
>  2800 |         *pte = pte_mkspecial(pfn_pte(data->pfns[data->idx++], data->prot));
>       |                                                 ~~~~~~~~~^~
> arch/arm64/include/asm/pgtable-types.h:25:37: note: in definition of macro '__pte'
>    25 | #define __pte(x)        ((pte_t) { (x) } )
>       |                                     ^
> arch/arm64/include/asm/pgtable.h:80:15: note: in expansion of macro '__phys_to_pte_val'
>    80 |         __pte(__phys_to_pte_val((phys_addr_t)(pfn) << PAGE_SHIFT) | pgprot_val(prot))
>       |               ^~~~~~~~~~~~~~~~~
> mm/vmalloc.c:2800:30: note: in expansion of macro 'pfn_pte'
>  2800 |         *pte = pte_mkspecial(pfn_pte(data->pfns[data->idx++], data->prot));
>       |                              ^~~~~~~
> 
> This only appeared in one randconfig build so far, and I don't know
> what caused it, but moving the index increment out of the expression
> at least addresses the warning.

Would that randconfig include CONFIG_ARM64_PA_BITS_52?

#define __phys_to_pte_val(phys) (((phys) | ((phys) >> 36)) & PTE_ADDR_MASK)

because that's going to double-increment idx.  Or single increment.
Or whatever else the compiler feels like doing.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ