From patchwork Sat Jun 14 00:39:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rafael J. Wysocki" X-Patchwork-Id: 4352021 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9C9909F314 for ; Sat, 14 Jun 2014 00:22:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D026120320 for ; Sat, 14 Jun 2014 00:22:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DEB7820303 for ; Sat, 14 Jun 2014 00:22:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754276AbaFNAVw (ORCPT ); Fri, 13 Jun 2014 20:21:52 -0400 Received: from v094114.home.net.pl ([79.96.170.134]:54733 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1753222AbaFNAVv (ORCPT ); Fri, 13 Jun 2014 20:21:51 -0400 Received: from afcf234.neoplus.adsl.tpnet.pl [95.49.57.234] (HELO vostro.rjw.lan) by serwer1319399.home.pl [79.96.170.134] with SMTP (IdeaSmtpServer v0.80) id e0bfaf6af0f12e4e; Sat, 14 Jun 2014 02:21:49 +0200 From: "Rafael J. Wysocki" To: Kees Cook Cc: Pavel Machek , "H. Peter Anvin" , LKML , Randy Dunlap , Thomas Gleixner , Ingo Molnar , "x86@kernel.org" , Len Brown , Wei Yongjun , "linux-doc@vger.kernel.org" , linux-pm@vger.kernel.org Subject: Re: [PATCH 0/2] make kASLR vs hibernation boot-time selectable Date: Sat, 14 Jun 2014 02:39:18 +0200 Message-ID: <13135927.OjVm86GPrt@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/3.15.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <1402602419-27934-1-git-send-email-keescook@chromium.org> <1517175.iyVMqh7r2z@vostro.rjw.lan> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Friday, June 13, 2014 05:08:21 PM Kees Cook wrote: > On Fri, Jun 13, 2014 at 5:14 PM, Rafael J. Wysocki wrote: > > On Friday, June 13, 2014 03:59:57 PM Kees Cook wrote: > >> On Fri, Jun 13, 2014 at 3:54 PM, Rafael J. Wysocki wrote: > >> > On Friday, June 13, 2014 03:07:19 PM Kees Cook wrote: > > > > [cut] > > > >> > I'll have a closer look at that shortly (it's been quite some time since > >> > I wrote that code). > >> > >> Thanks; I'm trying to get a test environment instrumented too so I can > >> look at this. (At the very least, it sounds like we'll still need my > >> patch series for other architectures.) > > > > How can I obtain a kernel address of the beginning of a given page > > (as represented by struct page) on x86_64 today? > > I don't know off the top of my head. I've used virt_to_phys, but > things like PFN_PHYS(page_to_pfn(page)) maybe? I'm not entirely clear > which you need, but mm.h seems to have the bulk of what I've seen. OK, I'm not sure how much sense this makes, but at least it should illustrate the direction. :-) --- arch/x86/power/hibernate_64.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 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/power/hibernate_64.c =================================================================== --- linux-pm.orig/arch/x86/power/hibernate_64.c +++ linux-pm/arch/x86/power/hibernate_64.c @@ -115,7 +115,7 @@ struct restore_data_record { unsigned long magic; }; -#define RESTORE_MAGIC 0x0123456789ABCDEFUL +#define RESTORE_MAGIC 0x0123456789ABCDF0UL /** * arch_hibernation_header_save - populate the architecture specific part @@ -128,7 +128,8 @@ int arch_hibernation_header_save(void *a if (max_size < sizeof(struct restore_data_record)) return -EOVERFLOW; - rdr->jump_address = restore_jump_address; + + rdr->jump_address = virt_to_phys((void *)restore_jump_address); rdr->cr3 = restore_cr3; rdr->magic = RESTORE_MAGIC; return 0; @@ -143,7 +144,7 @@ int arch_hibernation_header_restore(void { struct restore_data_record *rdr = addr; - restore_jump_address = rdr->jump_address; + restore_jump_address = (unsigned long)phys_to_virt(rdr->jump_address); restore_cr3 = rdr->cr3; return (rdr->magic == RESTORE_MAGIC) ? 0 : -EINVAL; }