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:   Thu, 12 May 2022 11:04:24 +0200
From:   David Hildenbrand <david@...hat.com>
To:     Adrian-Ken Rueegsegger <ken@...elabs.ch>,
        dave.hansen@...ux.intel.com, osalvador@...e.de
Cc:     luto@...nel.org, peterz@...radead.org, tglx@...utronix.de,
        mingo@...hat.com, bp@...en8.de, hpa@...or.com, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/mm: Fix marking of unused sub-pmd ranges

On 09.05.22 11:06, Adrian-Ken Rueegsegger wrote:
> The unused part precedes the new range spanned by the start, end
> parameters of vmemmap_use_new_sub_pmd. This means it actually goes from
> ALIGN_DOWN(start, PMD_SIZE) up to start. Use the correct address when
> applying the mark using memset.
> 
> Fixes: 8d400913c231 ("x86/vmemmap: handle unpopulated sub-pmd ranges")
> Signed-off-by: Adrian-Ken Rueegsegger <ken@...elabs.ch>
> ---
>  arch/x86/mm/init_64.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index 96d34ebb20a9..e2942335d143 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -902,6 +902,8 @@ static void __meminit vmemmap_use_sub_pmd(unsigned long start, unsigned long end
>  
>  static void __meminit vmemmap_use_new_sub_pmd(unsigned long start, unsigned long end)
>  {
> +	const unsigned long page = ALIGN_DOWN(start, PMD_SIZE);
> +
>  	vmemmap_flush_unused_pmd();
>  
>  	/*
> @@ -914,8 +916,7 @@ static void __meminit vmemmap_use_new_sub_pmd(unsigned long start, unsigned long
>  	 * Mark with PAGE_UNUSED the unused parts of the new memmap range
>  	 */
>  	if (!IS_ALIGNED(start, PMD_SIZE))
> -		memset((void *)start, PAGE_UNUSED,
> -			start - ALIGN_DOWN(start, PMD_SIZE));
> +		memset((void *)page, PAGE_UNUSED, start - page);
>  
>  	/*
>  	 * We want to avoid memset(PAGE_UNUSED) when populating the vmemmap of

As the x86 code was based on my s390x code, I assume that this was
accidentally introduced in the x86 variant.


We'd be marking the wrong range PAGE_UNUSED.


Your fix looks correct to me:

Reviewed-by: David Hildenbrand <david@...hat.com>


Do we want to cc stable?

-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ