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
| ||
|
Date: Tue, 21 Apr 2020 07:58:37 +0100 From: Will Deacon <will@...nel.org> To: Mike Kravetz <mike.kravetz@...cle.com> Cc: Anders Roxell <anders.roxell@...aro.org>, Qian Cai <cai@....pw>, Linux-MM <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>, Linux ARM <linux-arm-kernel@...ts.infradead.org>, linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>, linux-riscv@...ts.infradead.org, linux-s390@...r.kernel.org, sparclinux@...r.kernel.org, linux-doc@...r.kernel.org, Catalin Marinas <catalin.marinas@....com>, Benjamin Herrenschmidt <benh@...nel.crashing.org>, Paul Mackerras <paulus@...ba.org>, Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>, Heiko Carstens <heiko.carstens@...ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>, Christian Borntraeger <borntraeger@...ibm.com>, "David S.Miller" <davem@...emloft.net>, Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>, Jonathan Corbet <corbet@....net>, Longpeng <longpeng2@...wei.com>, Christophe Leroy <christophe.leroy@....fr>, Randy Dunlap <rdunlap@...radead.org>, Mina Almasry <almasrymina@...gle.com>, Peter Xu <peterx@...hat.com>, Nitesh Narayan Lal <nitesh@...hat.com>, Andrew Morton <akpm@...ux-foundation.org> Subject: Re: [PATCH v3 0/4] Clean up hugetlb boot command line processing On Mon, Apr 20, 2020 at 02:40:05PM -0700, Mike Kravetz wrote: > On 4/20/20 1:29 PM, Anders Roxell wrote: > > On Mon, 20 Apr 2020 at 20:23, Mike Kravetz <mike.kravetz@...cle.com> wrote: > >> On 4/20/20 8:34 AM, Qian Cai wrote: > >>> > >>> Reverted this series fixed many undefined behaviors on arm64 with the config, > >> While rearranging the code (patch 3 in series), I made the incorrect > >> assumption that CONT_XXX_SIZE == (1UL << CONT_XXX_SHIFT). However, > >> this is not the case. Does the following patch fix these issues? > >> > >> From b75cb4a0852e208bee8c4eb347dc076fcaa88859 Mon Sep 17 00:00:00 2001 > >> From: Mike Kravetz <mike.kravetz@...cle.com> > >> Date: Mon, 20 Apr 2020 10:41:18 -0700 > >> Subject: [PATCH] arm64/hugetlb: fix hugetlb initialization > >> > >> When calling hugetlb_add_hstate() to initialize a new hugetlb size, > >> be sure to use correct huge pages size order. > >> > >> Signed-off-by: Mike Kravetz <mike.kravetz@...cle.com> > >> --- > >> arch/arm64/mm/hugetlbpage.c | 8 ++++---- > >> 1 file changed, 4 insertions(+), 4 deletions(-) > >> > >> diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c > >> index 9ca840527296..a02411a1f19a 100644 > >> --- a/arch/arm64/mm/hugetlbpage.c > >> +++ b/arch/arm64/mm/hugetlbpage.c > >> @@ -453,11 +453,11 @@ void huge_ptep_clear_flush(struct vm_area_struct *vma, > >> static int __init hugetlbpage_init(void) > >> { > >> #ifdef CONFIG_ARM64_4K_PAGES > >> - hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT); > >> + hugetlb_add_hstate(ilog2(PUD_SIZE) - PAGE_SHIFT); > >> #endif > >> - hugetlb_add_hstate(CONT_PMD_SHIFT - PAGE_SHIFT); > >> - hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT); > >> - hugetlb_add_hstate(CONT_PTE_SHIFT - PAGE_SHIFT); > >> + hugetlb_add_hstate(ilog2(CONT_PMD_SIZE) - PAGE_SHIFT); > >> + hugetlb_add_hstate(ilog2(PMD_SIZE) - PAGE_SHIFT); > >> + hugetlb_add_hstate(ilog2(CONT_PTE_SIZE) - PAGE_SHIFT); > >> > >> return 0; > >> } > > > > I build this for an arm64 kernel and ran it in qemu and it worked. > > Thanks for testing Anders! > > Will, here is an updated version of the patch based on your suggestion. > I added the () for emphasis but that may just be noise for some. Also, > the naming differences and values for CONT_PTE may make some people > look twice. Not sure if being consistent here helps? Cheers, thanks for this. I think being consistent is worthwhile, as it's the definitions themselves that are weird and we can conceivably clean that up as a separate patch. So, Acked-by: Will Deacon <will@...nel.org> Looks like Andrew already picked it up (thanks!) Thanks, Will
Powered by blists - more mailing lists