From patchwork Thu Aug 11 01:35:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 9274395 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 F3C6E6022E for ; Thu, 11 Aug 2016 01:35:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC9A928417 for ; Thu, 11 Aug 2016 01:35:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBC252842A; Thu, 11 Aug 2016 01:35:44 +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_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 5B6CC28417 for ; Thu, 11 Aug 2016 01:35:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752544AbcHKBfn (ORCPT ); Wed, 10 Aug 2016 21:35:43 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36157 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752234AbcHKBfm (ORCPT ); Wed, 10 Aug 2016 21:35:42 -0400 Received: by mail-wm0-f68.google.com with SMTP id i138so241838wmf.3; Wed, 10 Aug 2016 18:35:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/j9xjxdB2+xyJ5vTgV6XsLNXg+JqLXqyzHoyPhpQ1vU=; b=NMiKZPcT3spCKSRO6LUM4rQiHJYBqZ2iQ9ehUhTcSppFcdR8ne9rqXubA4xl0clUq7 dUjAP6OYdcaRiZlYaOduJa1/Ygy6o6WpMxMdXS+OdVzzNPm43Lj+n/2UxH9/LWxfcPJm Mjuj09drrjwAoAwtuA+AIHDUhXGsq3nvRb2P0P9qolecHty0sUzCPWuPm8Yo0IK+YNP6 3C+V2NlRNlWE/uxvFbfo8fhzRmbPk0D0gxyXfWa+5JDM7odqX40ZrTeVnTplf5Bt0zdy +BLffYVnw9QJgaw1WtVNgGi+//GafIExZlDuQVX5usLFVnTJws/wCXCHsSPS9dEPBada dnog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=/j9xjxdB2+xyJ5vTgV6XsLNXg+JqLXqyzHoyPhpQ1vU=; b=Sz86I+QxdENZt7o/PEQpmHzSpCCRF/YjP3Niet/rnEBe5nhh3yhgmFzeC+s5V/wwYp aNqr/PtGGKXf4CV3YzBuTlwo1x3cfrnCKUgf+TdQb4F+OMm+U2As907i3oc8ftdI6EJG E96qXiCeK8jjKgGPKoy7qYn0g9DQMQ04uLKncvPtTvDkkVCnqYGon3Y8XkgDoLrsljms uXiRxYHzK6G80MuJWMZlBj9uVSTZ789R/qAld3GdQ8QQPAUTciPuHR0Fs5JumIOCyR7y aPhCD3Of1/JZLYMo9SnEJp2bs+LDnZ1mJ9E18Dvc8blueycP9+Ekzic1V+1POaXlp8kP cZ8A== X-Gm-Message-State: AEkooutYdVuALKZzS607rMSeJoFBgtXnyxWuaOB2cAXHbvim2C/jrqUYOb+/YHojeqjgttsDnd+rcNJoAMIVSQ== X-Received: by 10.194.82.67 with SMTP id g3mr6778075wjy.71.1470879340156; Wed, 10 Aug 2016 18:35:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.52.71 with HTTP; Wed, 10 Aug 2016 18:35:39 -0700 (PDT) In-Reply-To: References: <2206547.eDj3RJQyE5@vostro.rjw.lan> <2010434.TyoHiO9eal@vostro.rjw.lan> <1779906.DOHeuFCiDy@vostro.rjw.lan> <20160810163500.GA9424@nazgul.tnic> From: "Rafael J. Wysocki" Date: Thu, 11 Aug 2016 03:35:39 +0200 X-Google-Sender-Auth: RRorHVrLzC1lGxJaNSlrGPy1sEU Message-ID: Subject: Re: [Resend][PATCH] x86/power/64: Always create temporary identity mapping correctly To: Thomas Garnier Cc: "Rafael J. Wysocki" , Jiri Kosina , Borislav Petkov , "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 Thu, Aug 11, 2016 at 3:17 AM, Thomas Garnier wrote: > On Wed, Aug 10, 2016 at 5:35 PM, Rafael J. Wysocki wrote: >> On Wed, Aug 10, 2016 at 11:59 PM, Jiri Kosina wrote: >>> On Wed, 10 Aug 2016, Rafael J. Wysocki wrote: >>> >>>> So I used your .config to generate one for my test machine and with >>>> that I can reproduce. >>> >>> Was that the config I've sent, or did Boris provide one as well? Which one >>> are you able to reproduce with please? >> >> It's the Boris' one. >> >> Moreover, I have found the options that make the difference: unsetting >> CONFIG_PROVE_LOCKING and CONFIG_DEBUG_LOCK_ALLOC (which also will >> unset CONFIG_LOCKDEP AFAICS) in it makes hibernation work again with >> CONFIG_RANDOMIZE_MEMORY set and with the $subject patch applied. >> >> Unbelievable, but that's what I'm seeing. > > Nice find! > >> >> Now, that leads to a few questions: >> >> - How does lockdep change the picture so it matters for hibernation? >> - Why is hibernation the only piece that's affected? >> - Why is RANDOMIZE_MEMORY necessary to make this breakage show up? >> >> Thomas, any ideas? > > No idea so far. I will investigate though. > > We had an unrelated issue with CONFIG_DEBUG_PAGEALLOC on early boot. I > don't think it was related because it was on early boot and with > certain e820 memory layout (and PUD randomization that I disabled on > the previous patch test). The fix is on tip: > http://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?id=fb754f958f8e46202c1efd7f66d5b3db1208117d Well, I don't think this is related. In the meantime, I went back to my original .config and verified that setting CONFIG_DEBUG_LOCK_ALLOC in it caused hibernation to fail (with CONFIG_RANDOMIZE_MEMORY set and with the $subject patch applied), so this really matters somehow. Besides, now that I have a reproducer, I can check various other things and for example this change (sorry for broken whitespace): makes hibernation work for me again in the above configuration. To me, this means that the $subject patch works as expected and the problem really is related to the vaddr value being too big. Thanks, Rafael --- 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 Index: linux-pm/arch/x86/mm/kaslr.c =================================================================== --- linux-pm.orig/arch/x86/mm/kaslr.c +++ linux-pm/arch/x86/mm/kaslr.c @@ -122,7 +122,7 @@ void __init kernel_randomize_memory(void prandom_bytes_state(&rand_state, &rand, sizeof(rand)); entropy = (rand % (entropy + 1)) & PUD_MASK; vaddr += entropy; - *kaslr_regions[i].base = vaddr; + *kaslr_regions[i].base += PUD_SIZE; /* * Jump the region and add a minimum padding based on