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: <20200610084223.GE1151302@kernel.org>
Date:   Wed, 10 Jun 2020 11:42:23 +0300
From:   Mike Rapoport <rppt@...nel.org>
To:     "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc:     Dave Hansen <dave.hansen@...ux.intel.com>,
        Andy Lutomirski <luto@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        "H. Peter Anvin" <hpa@...or.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Tony Luck <tony.luck@...el.com>, x86@...nel.org,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Dave Hansen <dave.hansen@...el.com>, stable@...r.kernel.org
Subject: Re: [PATCHv2 2/2] x86/boot/KASLR: Fix boot with some memory above
 MAXMEM

On Mon, Jun 08, 2020 at 03:54:24PM +0300, Kirill A. Shutemov wrote:
> A 5-level paging capable machine can have memory above 46-bit in the
> physical address space. This memory is only addressable in the 5-level
> paging mode: we don't have enough virtual address space to create direct
> mapping for such memory in the 4-level paging mode
> 
> Teach KASLR to avoid memory regions above MAXMEM or truncate the region
> if the end is above MAXMEM.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Reviewed-by: Dave Hansen <dave.hansen@...el.com>
> Cc: stable@...r.kernel.org # v4.14

Reviewed-by: Mike Rapoport <rppt@...ux.ibm.com>

> ---
>  arch/x86/boot/compressed/kaslr.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
> index d7408af55738..99db18eeb40e 100644
> --- a/arch/x86/boot/compressed/kaslr.c
> +++ b/arch/x86/boot/compressed/kaslr.c
> @@ -695,7 +695,18 @@ static bool process_mem_region(struct mem_vector *region,
>  			       unsigned long long minimum,
>  			       unsigned long long image_size)
>  {
> +	unsigned long long end;
>  	int i;
> +
> +	/* Cannot access memory region above MAXMEM: skip it. */
> +	if (region->start >= MAXMEM)
> +		return 0;
> +
> +	/* Truncate the region if the end is above MAXMEM */
> +	end = region->start + region->size;
> +	end = min_t(unsigned long long, end, MAXMEM - 1);
> +	region->size = end - region->start;
> +
>  	/*
>  	 * If no immovable memory found, or MEMORY_HOTREMOVE disabled,
>  	 * use @region directly.
> -- 
> 2.26.2
> 
> 

-- 
Sincerely yours,
Mike.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ