From patchwork Tue May 29 22:15:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 10437293 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 207B9601E9 for ; Tue, 29 May 2018 22:20:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0991828900 for ; Tue, 29 May 2018 22:20:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF6CC2891F; Tue, 29 May 2018 22:20:28 +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=-12.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id B3D0728900 for ; Tue, 29 May 2018 22:20:25 +0000 (UTC) Received: (qmail 17953 invoked by uid 550); 29 May 2018 22:17:23 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 17719 invoked from network); 29 May 2018 22:17:17 -0000 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=OBeVp79o+8y2wh4gv6B5X77P6I7cTGn5nwaab3VjPzk=; b=EoUVvQDoWpQRHN8aqlOk/8P7NeNvn4RJ7LRc+BFrOf0qtFDy4ub+Tpcl5CxmL5dsdG jj9SMJEHFmyhRGnL/VAGde2g3YGdP4b7RySFveDM8oJ69x9HovkkvHyD0wIDeefZdXYE dh8D8KUuV7jiYeW8r1+y4b2RfEztjLtMGJAujPIfixbr8v0NMzsLDv1NJhrSjiJa4j56 fVcik7nK6wkmtllYpL28meQ3b9g3XSG6WitrWZJnN0KcI+HkOo98bUKclPZeN70bBv0b Hz91fcvKx+4OvC992npEyWjGok90fGNoYmt/x4pa2I8bMjUX2ZOf4rOGwNiOd0H8U3Tm 5wSw== 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=OBeVp79o+8y2wh4gv6B5X77P6I7cTGn5nwaab3VjPzk=; b=HLzGlFmjogBgm9usaf/lPP/BK57LANofOq8EuuwjSYAASfsM57SDqGocXHtwZrRSSI hBssvSugoH47YVugU3JU2agOxO+p6ZXAy1TFbp7BHezbDDFQ0vRHDDUR7H40qfEG3h0E czZ4nr7q0rW6/wBVrdF4SlZ1FoIB5qtn/+EAEEiudgYGBrxiqO9GWBMj9lID6D2v+imL XIJcErvoD+WWD3+DTP15MM6FKjOyciNOWIZPvZ2mj1k3oPwWfaQXi7ZRtxZi69uxBaRp yW8hBT99FJIz076qdPAbYEmL6j+a0CpgMVITF78RYSCOJhO5HlQVVskfALQuB9XLwkRw fUyQ== X-Gm-Message-State: ALKqPwdOOFrS5NfMWC8jb7XKibw60TsXalW84Grg6DrzXlSbZ0+wA2J2 WmMM4lPN8uHSzH+aqAYOVIsOs8RoG3Q= X-Google-Smtp-Source: ADUXVKKUWtq3obkp7WRyxRCzGzWps4pogP9ggVhdYnt98WXH5nEf8V6suviRm68aEmWQR75/SssTiQ== X-Received: by 2002:a17:902:543:: with SMTP id 61-v6mr222223plf.47.1527632225389; Tue, 29 May 2018 15:17:05 -0700 (PDT) From: Thomas Garnier To: kernel-hardening@lists.openwall.com Cc: Thomas Garnier , "Rafael J. Wysocki" , Pavel Machek , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 11/27] x86/power/64: Adapt assembly for PIE support Date: Tue, 29 May 2018 15:15:12 -0700 Message-Id: <20180529221625.33541-12-thgarnie@google.com> X-Mailer: git-send-email 2.17.0.921.gf22659ad46-goog In-Reply-To: <20180529221625.33541-1-thgarnie@google.com> References: <20180529221625.33541-1-thgarnie@google.com> 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 extend the KASLR randomization range 0xffffffff80000000. Signed-off-by: Thomas Garnier Acked-by: Pavel Machek Acked-by: Rafael J. Wysocki --- 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