From patchwork Tue Jul 18 22:33:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 9850067 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 2621860392 for ; Tue, 18 Jul 2017 22:37:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 122ED285CB for ; Tue, 18 Jul 2017 22:37:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 065F4285E4; Tue, 18 Jul 2017 22:37:17 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7DFE4285CB for ; Tue, 18 Jul 2017 22:37:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXb4d-0000hd-5A; Tue, 18 Jul 2017 22:34:35 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXb4b-0000eW-G9 for xen-devel@lists.xenproject.org; Tue, 18 Jul 2017 22:34:33 +0000 Received: from [85.158.139.211] by server-16.bemta-5.messagelabs.com id 5E/51-01712-8FC8E695; Tue, 18 Jul 2017 22:34:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRWlGSWpSXmKPExsXiVRusrfu9Jy/ SYM8iU4vvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPZtuPsBa84Kj7vCG1gPMXexcjFISQwnVFi xelHjCAOi8ArFonH/6+ydDFyckgI9LNK/H+tB2HHSUx5u5QZwi6V+PTlIyOILSSgJLF1A0gcZ NI/RokDZz+CFbEJaEnsaZjPBJIQEZjNIbG46wwLiCMg8JFN4saWw2AtzAItTBJP/m1jAmkRFn CUWPX9PZDNAXSIqsT16/4gJq+AlcSB5ZEgpoSAscTfL/ogJidQdPl9HogbLCV6extYJjAKLmB kWMWoUZxaVJZapGtoqpdUlJmeUZKbmJmja2hgqpebWlycmJ6ak5hUrJecn7uJERhuDECwg7Fh u+chRkkOJiVR3q3KeZFCfEn5KZUZicUZ8UWlOanFhxhlODiUJHgPdQPlBItS01Mr0jJzgIEPk 5bg4FES4bUBBr8Qb3FBYm5xZjpE6hSjMcekA9u/MHG8mvD/G5MQS15+XqqUOO8CkEkCIKUZpX lwg2AReYlRVkqYlxHoNCGegtSi3MwSVPlXjOIcjErCvP0gU3gy80rg9r0COoUJ6BRh3xyQU0o SEVJSDYwTf/D3qZXtrjW84PDI+hrj3tcHPIPeVjMmFBT3Jte2fs5KyHMtC1tYmnZD7sLniZqz AxjK7eLLFOsnc54Iy9PpNrdLYBdL2bN74t0LIesl93/gs79wRqdzu9i2j4KbXJ/xMctylPCWF t4pN193m+tZ2vfmh6pnJPJP/Ijvr67p7Dhn77lOQomlOCPRUIu5qDgRAPYQzjTDAgAA X-Env-Sender: thgarnie@google.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1500417270!87970877!1 X-Originating-IP: [74.125.83.43] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7876 invoked from network); 18 Jul 2017 22:34:31 -0000 Received: from mail-pg0-f43.google.com (HELO mail-pg0-f43.google.com) (74.125.83.43) by server-13.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Jul 2017 22:34:31 -0000 Received: by mail-pg0-f43.google.com with SMTP id u5so19920371pgq.3 for ; Tue, 18 Jul 2017 15:34:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wwFPvBOrg+9pqOiUuvpMW6sbi1f/697Y5jk3CxC04XA=; b=hB9v7r8GryWJy8lzS0bsw3I6ezo+AmF1YNhtTAM+hVnstaSnP6xjDmiT4l4PKsPEU3 HqyCnr1ELEW3y+b32hH+c3fVfcw5r+85LKyRn2rObdUTd6VZZB4EG1ey62SHG4vrnCK7 s79WMaKu8YgcVucFzq8+Z1z6IpaWI03jFB8S2fD0xuoePF2Cta92+Rvrp37q7RQA0quw MA20+r56V0j5mZvhSxz8F9zORZWARmYP+EIs2A7x7988/YHh4uQuEiWaAB1j/CwQWz5j z1TPMF8PDu4pQAFUAnbJnHezc0PkJyUQ/4u65Dgzl7DkvH9m5FDqT/+urts0SNmAa/sX 6LaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wwFPvBOrg+9pqOiUuvpMW6sbi1f/697Y5jk3CxC04XA=; b=OxEX2zs7hJgMv/ryTk8U8ON/LHhOtGhY9mC9qCpjYIRuNCqazUpEVcjo5BMnmf0yjs gFkgFP17/WR1RBgH1Ol4yZv7iREyk0f9ir/P1ejari4CK7FZt5MOd31spImpANN6oqhI 7sfevDj74vqHc+1WviMvyamugeYv1QKu815GSUhM/C0ta4dnUiWtkSxo4JFlvWd4dEcb k3q9LQwdOnYkvvgxg099vXX5oigBju43tT0b1alskMNI3AYSrkX3QEfegrlaxkPSbL3L Hk75htYzry+rFu+CEsmERvJHBxuKUNXwaUUSs6CTk8NuKAZhuJeOXDE/QcV/5JSy7fo1 X7iw== X-Gm-Message-State: AIVw112sKj/p1hyvIys4VRTtaAUcWl5sEjaTqjCnEtm9YQl5y1CRIvlL 16hGDI6l8Tx/xn4W X-Received: by 10.99.56.5 with SMTP id f5mr3924794pga.14.1500417269835; Tue, 18 Jul 2017 15:34:29 -0700 (PDT) Received: from skynet.sea.corp.google.com ([100.100.206.164]) by smtp.gmail.com with ESMTPSA id b6sm6444242pgn.67.2017.07.18.15.34.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Jul 2017 15:34:29 -0700 (PDT) From: Thomas Garnier To: Herbert Xu , "David S . Miller" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Thomas Garnier , Arnd Bergmann , Matthias Kaehlcke , Boris Ostrovsky , Juergen Gross , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Joerg Roedel , Andy Lutomirski , Borislav Petkov , "Kirill A . Shutemov" , Brian Gerst , Borislav Petkov , Christian Borntraeger , "Rafael J . Wysocki" , Len Brown , Pavel Machek , Tejun Heo , Christoph Lameter , Kees Cook , Paul Gortmaker , Chris Metcalf , "Paul E . McKenney" , Andrew Morton , Christopher Li , Dou Liyang , Masahiro Yamada , Daniel Borkmann , Markus Trippelsdorf , Peter Foley , Steven Rostedt , Tim Chen , Ard Biesheuvel , Catalin Marinas , Matthew Wilcox , Michal Hocko , Rob Landley , Jiri Kosina , "H . J . Lu" , Paul Bolle , Baoquan He , Daniel Micay Date: Tue, 18 Jul 2017 15:33:24 -0700 Message-Id: <20170718223333.110371-14-thgarnie@google.com> X-Mailer: git-send-email 2.13.2.932.g7449e964c-goog In-Reply-To: <20170718223333.110371-1-thgarnie@google.com> References: <20170718223333.110371-1-thgarnie@google.com> Cc: linux-arch@vger.kernel.org, kvm@vger.kernel.org, linux-pm@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-sparse@vger.kernel.org, linux-crypto@vger.kernel.org, kernel-hardening@lists.openwall.com, xen-devel@lists.xenproject.org Subject: [Xen-devel] [RFC 13/22] x86/power/64: Adapt assembly for PIE support X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Change the assembly code to use only relative references of symbols for the kernel to be PIE compatible. Position Independent Executable (PIE) support will allow to extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier Acked-by: Pavel Machek --- arch/x86/power/hibernate_asm_64.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/power/hibernate_asm_64.S b/arch/x86/power/hibernate_asm_64.S index ce8da3a0412c..6fdd7bbc3c33 100644 --- a/arch/x86/power/hibernate_asm_64.S +++ b/arch/x86/power/hibernate_asm_64.S @@ -24,7 +24,7 @@ #include ENTRY(swsusp_arch_suspend) - movq $saved_context, %rax + leaq saved_context(%rip), %rax movq %rsp, pt_regs_sp(%rax) movq %rbp, pt_regs_bp(%rax) movq %rsi, pt_regs_si(%rax) @@ -115,7 +115,7 @@ ENTRY(restore_registers) movq %rax, %cr4; # turn PGE back on /* We don't restore %rax, it must be 0 anyway */ - movq $saved_context, %rax + leaq saved_context(%rip), %rax movq pt_regs_sp(%rax), %rsp movq pt_regs_bp(%rax), %rbp movq pt_regs_si(%rax), %rsi