From patchwork Thu Jan 31 19:24:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 10791343 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 864471390 for ; Thu, 31 Jan 2019 19:43:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D7583102E for ; Thu, 31 Jan 2019 19:43:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 701B931053; Thu, 31 Jan 2019 19:43:52 +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=-5.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 A210F3102E for ; Thu, 31 Jan 2019 19:43:51 +0000 (UTC) Received: (qmail 5916 invoked by uid 550); 31 Jan 2019 19:43:03 -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 19680 invoked from network); 31 Jan 2019 19:28:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=slcSIy5bpHZyKWwlaDTRrJC/yUTgl298Zpoh2P5XAuE=; b=TKOBB61tqnBNKWdp040WyjTS0OXWqJEHjq2P+NQiGg86JDwZ9FGi/8Qz6kPKnebjDc ChUA5SanNH183SHXa/pU4MeDsCoPM2b6QUWiS5TNNr0mv+azxx0kEo0O6Nh63+2hR91j /Z+2fkdTaf5s4DTA1g4+A+BEmDimNuC9rjvoA= 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:mime-version:content-transfer-encoding; bh=slcSIy5bpHZyKWwlaDTRrJC/yUTgl298Zpoh2P5XAuE=; b=gqOPayMYWliOttvxPtf6WAsw65kYX95RL40cTVPrWJE4SwsHyw83/PmGzXOSRuL9Ac u7xxvmPlq/6ygvDN2Eh6bK4Kq+9wfHKIItcs0n+IJIFW3UrNUn39X9NRXnBTqtalOy2Z GFc3YVB9+1Y/Qyjb0R1vSoqOnyj54JueIuyUe9Lm5tNn8U4+ChHDcF6LMSsuZZBm6Nte MvB4wIgCsC9gKFsxHRukvIT3WqhJIuMn9uuO56YNmDo2Q3TBBvOxZqiFvBR2jtXvZXRm AtyrQLsv/wV1HPLuEdhwJ4C2mX45Hu/ZRVLHcCEIS1b2gHznA6vIhORhgAcjT9LaYAh0 M7jw== X-Gm-Message-State: AJcUukewlVaJbqwnM8dV5aHuB/9Y/rZcXeOp7JWnN2dSvmhbiX7jPhk7 VtVTCn9g+/WTEYuVg+oG9xE48Il35p0= X-Google-Smtp-Source: ALg8bN7K7Jp37yglEz23FpvrxI3w/t8wvaBzIGcgvz2oGt1tM5UakNsoqpDPmwdjiwGArBnM4rp4kw== X-Received: by 2002:a63:5320:: with SMTP id h32mr32738683pgb.414.1548962910189; Thu, 31 Jan 2019 11:28:30 -0800 (PST) From: Thomas Garnier To: kernel-hardening@lists.openwall.com Cc: kristen@linux.intel.com, Thomas Garnier , Pavel Machek , "Rafael J . Wysocki" , "Rafael J. Wysocki" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 10/27] x86/power/64: Adapt assembly for PIE support Date: Thu, 31 Jan 2019 11:24:17 -0800 Message-Id: <20190131192533.34130-11-thgarnie@chromium.org> X-Mailer: git-send-email 2.20.1.495.gaa96b0ce6b-goog In-Reply-To: <20190131192533.34130-1-thgarnie@chromium.org> References: <20190131192533.34130-1-thgarnie@chromium.org> MIME-Version: 1.0 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 below 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 3008baa2fa95..9ed980efef72 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