From patchwork Wed Aug 10 16:44:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 9273527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD47C600CB for ; Wed, 10 Aug 2016 18:41:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEEF02840F for ; Wed, 10 Aug 2016 18:41:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C380F28417; Wed, 10 Aug 2016 18:41:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FB342840F for ; Wed, 10 Aug 2016 18:41:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936458AbcHJSke (ORCPT ); Wed, 10 Aug 2016 14:40:34 -0400 Received: from mail-yw0-f182.google.com ([209.85.161.182]:35709 "EHLO mail-yw0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936378AbcHJSk3 convert rfc822-to-8bit (ORCPT ); Wed, 10 Aug 2016 14:40:29 -0400 Received: by mail-yw0-f182.google.com with SMTP id j12so30506561ywb.2 for ; Wed, 10 Aug 2016 11:40:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=OlT56n2q+qnPAp2FDJrfWkYsAkcwt1zYOT3H8OCINdQ=; b=NaDP6bHnwVYYBozHhCpfWXeHh9FGaZrONQrSoiDc56EjflMOio/FZxqLPqGCG3obM+ pxYmh9ktJyQcwi086+ZOmfvDDwJ+b6vMGN6WVTrOC8BXDO2oGncdKkBt/YGmIDH2z/cj bxrzQbnNTCnQXm+7qOhLvqrcIn/zWxkd3lfcS5qWqPcCuhuMRqqZqxKJtcZGmTQ664M5 JwKYjB9YjD+eyVXHbB3n4MAql2tKmPHcGaseYgZxdPv+KWEAdwFAuvcrLFGCS53HWe/O z78vUJCwCtiIxVItiI0T6x/G+lTTbkw2fgeNyav9rwYDrke8jmDgadBT2hO/a2vrWqly K0Ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=OlT56n2q+qnPAp2FDJrfWkYsAkcwt1zYOT3H8OCINdQ=; b=enyBAGBQTLHxkQMnHKkkyGwTCV9wQ4MidFjgv9syjY3vRVeXywpSNMRS1Mx3XGaK/h ZYgXCzQqVzgk9HSEZTsnFmqZ7JBA3HssqSl9YarwK8dcD0aU81RKFvOaNzrOStJmj/BL VkR6kQL9DWez2VL3DPWY/gH4bPY44zTcOQX5OhBJcoPMpp4GnfOWCn1fYB5ru+g9gIuE hGXSQgGe11TqYV9J/4SnThHJjEMIbavUnCeTrw7LusLumNCq8JdKWgrRE1WmUXmfMsiI Peq6VgeZP+dWmyN0kyRZoTo74cpL98Z3UgS+u8fw+di7P9KmZ8/B6JGoykKAvMdFphsD +2Qg== X-Gm-Message-State: AEkoout+dxaruLHo7pi4egHmaPxQay3uhgpCya9ENdpMmoJ4wURxfjhEougv640IrxKAFBRjlNTkO9SOv1WpJaCg X-Received: by 10.129.70.137 with SMTP id t131mr3479631ywa.268.1470847485181; Wed, 10 Aug 2016 09:44:45 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.12.4 with HTTP; Wed, 10 Aug 2016 09:44:44 -0700 (PDT) In-Reply-To: <20160810163500.GA9424@nazgul.tnic> References: <2206547.eDj3RJQyE5@vostro.rjw.lan> <2010434.TyoHiO9eal@vostro.rjw.lan> <1779906.DOHeuFCiDy@vostro.rjw.lan> <20160810163500.GA9424@nazgul.tnic> From: Thomas Garnier Date: Wed, 10 Aug 2016 09:44:44 -0700 Message-ID: Subject: Re: [Resend][PATCH] x86/power/64: Always create temporary identity mapping correctly To: Borislav Petkov Cc: Jiri Kosina , "Rafael J. Wysocki" , "Rafael J. Wysocki" , Linux PM list , "the arch/x86 maintainers" , Linux Kernel Mailing List , Yinghai Lu , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Kees Cook , Pavel Machek , Kernel Hardening Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Aug 10, 2016 at 9:35 AM, Borislav Petkov wrote: > On Wed, Aug 10, 2016 at 04:59:40PM +0200, Jiri Kosina wrote: >> Mine is Lenovo thinkpad x200s; I think Boris has been testing it on x230s, > > It says "X230" here under the screen. > >> but not sure whether any of the latest patches didn't actually fix it for >> him. > > Haven't tested them yet. I'm waiting for you to test them first since > this is the only machine I have right now and I need it for work. > >> The machine I am seeing the issue on, has 2G RAM, with this e820 map: > > 8G here: > > e820: BIOS-provided physical RAM map: > BIOS-e820: [mem 0x0000000000000000-0x000000000009d7ff] usable > BIOS-e820: [mem 0x000000000009d800-0x000000000009ffff] reserved > BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved > BIOS-e820: [mem 0x0000000000100000-0x000000001fffffff] usable > BIOS-e820: [mem 0x0000000020000000-0x00000000201fffff] reserved > BIOS-e820: [mem 0x0000000020200000-0x0000000040003fff] usable > BIOS-e820: [mem 0x0000000040004000-0x0000000040004fff] reserved > BIOS-e820: [mem 0x0000000040005000-0x00000000cec2ffff] usable > BIOS-e820: [mem 0x00000000cec30000-0x00000000dae9efff] reserved > BIOS-e820: [mem 0x00000000dae9f000-0x00000000daf9efff] ACPI NVS > BIOS-e820: [mem 0x00000000daf9f000-0x00000000daffefff] ACPI data > BIOS-e820: [mem 0x00000000dafff000-0x00000000df9fffff] reserved > BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved > BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved > BIOS-e820: [mem 0x00000000fed08000-0x00000000fed08fff] reserved > BIOS-e820: [mem 0x00000000fed10000-0x00000000fed19fff] reserved > BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed1ffff] reserved > BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved > BIOS-e820: [mem 0x00000000ffc00000-0x00000000ffffffff] reserved > BIOS-e820: [mem 0x0000000100000000-0x000000021e5fffff] usable > BIOS-e820: [mem 0x000000021e600000-0x000000021e7fffff] reserved > debug: ignoring loglevel setting. > NX (Execute Disable) protection: active > SMBIOS 2.7 present. > DMI: LENOVO 2320CTO/2320CTO, BIOS G2ET86WW (2.06 ) 11/13/2012 > e820: update [mem 0x00000000-0x00000fff] usable ==> reserved > e820: remove [mem 0x000a0000-0x000fffff] usable > e820: last_pfn = 0x21e600 max_arch_pfn = 0x400000000 > >> CPU: > > processor : 0 > vendor_id : GenuineIntel > cpu family : 6 > model : 58 > model name : Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz > stepping : 9 > microcode : 0x1c > cpu MHz : 1257.421 > cache size : 4096 KB > physical id : 0 > siblings : 4 > core id : 0 > cpu cores : 2 > apicid : 0 > initial apicid : 0 > fpu : yes > fpu_exception : yes > cpuid level : 13 > wp : yes > flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts > bugs : > bogomips : 5786.68 > clflush size : 64 > cache_alignment : 64 > address sizes : 36 bits physical, 48 bits virtual > power management: > Ok, I want to know if the problem is the PUD alignment or the change of PAGE_OFFSET based all together. Can you test the following change? (on top of everything else with KASLR enabled). It will randomize the memory sections only on PGD level. > -- > Regards/Gruss, > Boris. > > ECO tip #101: Trim your mails when you reply. > > SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) > -- --- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/mm/kaslr.c b/arch/x86/mm/kaslr.c index ec8654f..a8477b0 100644 --- a/arch/x86/mm/kaslr.c +++ b/arch/x86/mm/kaslr.c @@ -120,7 +120,7 @@ void __init kernel_randomize_memory(void) */ entropy = remain_entropy / (ARRAY_SIZE(kaslr_regions) - i); prandom_bytes_state(&rand_state, &rand, sizeof(rand)); - entropy = (rand % (entropy + 1)) & PUD_MASK; + entropy = (rand % (entropy + 1)) & PGDIR_MASK; vaddr += entropy; *kaslr_regions[i].base = vaddr; @@ -129,7 +129,7 @@ void __init kernel_randomize_memory(void) * randomization alignment. */ vaddr += get_padding(&kaslr_regions[i]); - vaddr = round_up(vaddr + 1, PUD_SIZE); + vaddr = round_up(vaddr + 1, PGDIR_SIZE); remain_entropy -= entropy; } }