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: <CAJcbSZFOMJkXNJX-eMCgyesp71+j+MZTteuS9gBUjpHL=u_sZA@mail.gmail.com>
Date:	Tue, 9 Aug 2016 09:00:04 -0700
From:	Thomas Garnier <thgarnie@...gle.com>
To:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H . Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...e.de>,
	Joerg Roedel <jroedel@...e.de>, Dave Young <dyoung@...hat.com>,
	"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
	Lv Zheng <lv.zheng@...el.com>,
	Thomas Garnier <thgarnie@...gle.com>,
	Baoquan He <bhe@...hat.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Mark Salter <msalter@...hat.com>,
	Aleksey Makarov <aleksey.makarov@...aro.org>,
	Kees Cook <keescook@...omium.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Christian Borntraeger <borntraeger@...ibm.com>,
	Fabian Frederick <fabf@...net.be>,
	Toshi Kani <toshi.kani@...com>,
	Dan Williams <dan.j.williams@...el.com>
Cc:	"the arch/x86 maintainers" <x86@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Kernel Hardening <kernel-hardening@...ts.openwall.com>
Subject: Re: [PATCH v1 1/2] x86/KASLR: Fix physical memory calculation on
 KASLR memory randomization

On Mon, Aug 8, 2016 at 11:40 AM, Thomas Garnier <thgarnie@...gle.com> wrote:
> Initialize KASLR memory randomization after max_pfn is initialized. Also
> ensure the size is rounded up. Could have create problems on machines
> with more than 1Tb of memory on certain random addresses.
>
> Signed-off-by: Thomas Garnier <thgarnie@...gle.com>

I will send a new version of this PATCH soon. The test bot found
places where virtual addresses were computed before PAGE_OFFSET was
set. I will investigate that.

> ---
> Based on next-20160805
> ---
>  arch/x86/kernel/setup.c | 4 ++--
>  arch/x86/mm/kaslr.c     | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index bcabb88..8dda0ce 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -936,8 +936,6 @@ void __init setup_arch(char **cmdline_p)
>
>         x86_init.oem.arch_setup();
>
> -       kernel_randomize_memory();
> -
>         iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1;
>         setup_memory_map();
>         parse_setup_data();
> @@ -1071,6 +1069,8 @@ void __init setup_arch(char **cmdline_p)
>         high_memory = (void *)__va(max_pfn * PAGE_SIZE - 1) + 1;
>  #endif
>
> +       kernel_randomize_memory();
> +
>         /*
>          * Find and reserve possible boot-time SMP configuration:
>          */
> diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c
> index 26dccd6..ec8654f 100644
> --- a/arch/x86/mm/kaslr.c
> +++ b/arch/x86/mm/kaslr.c
> @@ -97,7 +97,7 @@ void __init kernel_randomize_memory(void)
>          * add padding if needed (especially for memory hotplug support).
>          */
>         BUG_ON(kaslr_regions[0].base != &page_offset_base);
> -       memory_tb = ((max_pfn << PAGE_SHIFT) >> TB_SHIFT) +
> +       memory_tb = DIV_ROUND_UP(max_pfn << PAGE_SHIFT, 1UL << TB_SHIFT) +
>                 CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING;
>
>         /* Adapt phyiscal memory region size based on available memory */
> --
> 2.8.0.rc3.226.g39d4020
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ