From patchwork Mon Jun 25 22:38:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 10488273 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 7A0E7601A0 for ; Tue, 26 Jun 2018 08:42:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63CD3288CA for ; Tue, 26 Jun 2018 08:42:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B8A428996; Tue, 26 Jun 2018 08:42:22 +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 5BA2228B72 for ; Tue, 26 Jun 2018 08:41:38 +0000 (UTC) Received: (qmail 25933 invoked by uid 550); 26 Jun 2018 08:39:19 -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 Delivered-To: moderator for kernel-hardening@lists.openwall.com Received: (qmail 11432 invoked from network); 25 Jun 2018 22:41:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:date:in-reply-to:message-id:references:subject:from:to :cc; bh=DWmGvA0lR6w7y5ULZBpH8CF04xCV2RqblUumbO+kjTU=; b=bFiGmUWPHjGBuOHdMmFSusIQ4RcqGqhbbC+KO7++F6XJa+rf+G/3sdSMCGx49hQWap H7c2uu35f4WsOO6xSPy/vZ0iJ6bbZcpqkrEkBUpfuUtlPADE8NNGlM8twAK8lfavlb8J 8ID9qhlzz4joD/ksZjgFL2hQfRPt/mQZkgBVF6c1hOtF9e4a1eixZl6FBdSB6AeHDGsz oCAwSIreuCI8DA1JmKJcgsEob73EknV752zZQ4+aszUshK0UJ6JNe0PzZxjB2zV+srSj /D0qDEL/nmED3KCzRWDM2SzpEBdqpoahCIuO5EAP7HctBdMCXR5iljEevMEFplg0lhrp VZcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:date:in-reply-to:message-id :references:subject:from:to:cc; bh=DWmGvA0lR6w7y5ULZBpH8CF04xCV2RqblUumbO+kjTU=; b=fvA4yQ8VS0BcOI+ivamrisxTqx3WYSI769NEFIT5+0NFCwTl3QjKGklJ1tC9fQE9Ci wPQDjjlF+C68t7/CmCv1H6vCPW9tJjnMoEHtAe9Z5C+b6KhcNfPwmi4ttHcmM90gcFxb cANHKPkyXOQgSkrWRcdHkKwx8vN3xfJqC+N2d6EPpYQS+JjDTvtyUpvEgNriYeayNprU wEeO81+QWvm78LBfb8V+6imyZcNNavwR8QiTzL3pBAbL7DJQly15HNJj97Lzei9w6wfu lJpWzMN6NwVuAWBrw/Cd4B7RIWR/J148BVbLQIGkn9nUP/DoUzXXGeUcJzNODriG5eQd Eqpg== X-Gm-Message-State: APt69E2N5d8wRT2sinRQGh0ZNHoECco3mVVbL9R46+7eIeTADdkY/KFF Suv1IRQ44tttjFGfc/b5XhZt4Uf1skLCoMJbSeWl8G1MFKG7L7mpptN4dvXjKxhWpYlOA7iIa0i qFk5RYXK+Ke5gZLkSV8/kkZpic/mkKadwxXnSoKUU4cmQXWuDZuF5fB7ZjUQKH52k1DUFrfxn9F ZepgPv1pwH X-Google-Smtp-Source: AAOMgpcMfOgsNjQ3gS57e24UnR3P+4f45NGqjZpwIO8a6CATrwhRFOqvNBr8LlS8GSAmtKv643o/RgJRATOtow== MIME-Version: 1.0 X-Received: by 2002:a24:6b15:: with SMTP id v21-v6mr1197132itc.1.1529966488785; Mon, 25 Jun 2018 15:41:28 -0700 (PDT) Date: Mon, 25 Jun 2018 15:38:59 -0700 In-Reply-To: <20180625224014.134829-1-thgarnie@google.com> Message-Id: <20180625224014.134829-12-thgarnie@google.com> References: <20180625224014.134829-1-thgarnie@google.com> X-Mailer: git-send-email 2.18.0.rc2.346.g013aa6912e-goog Subject: [PATCH v5 11/27] x86/power/64: Adapt assembly for PIE support 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 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