From patchwork Thu Jan 31 19:24:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 10791329 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 5B95D746 for ; Thu, 31 Jan 2019 19:42:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52B4031524 for ; Thu, 31 Jan 2019 19:42:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4719931545; Thu, 31 Jan 2019 19:42:44 +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 8796E31524 for ; Thu, 31 Jan 2019 19:42:43 +0000 (UTC) Received: (qmail 1391 invoked by uid 550); 31 Jan 2019 19:42:32 -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 19475 invoked from network); 31 Jan 2019 19:28:32 -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=aVzH3++K/2N/bei/W7brwrZIoSH+2V+4aNBxSbRjbq4=; b=jS2vtOqYqLE/UAH85ZVuBHyHcP6KJfCYF/kd2GCumX7Km1JENVatuWyLBZXwtUcZ78 uuJWTV92JL0DWP/oclQZqlxzCj8+Wr4Yg+P1AZUMQQh/uwJYs9eTqMszVYOeXuU3VhMk tqo7aPoLoLPUsQkRcbW/K1+4phYfubMX5KMoM= 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=aVzH3++K/2N/bei/W7brwrZIoSH+2V+4aNBxSbRjbq4=; b=rThc9eT3U/ff7t4Q6uy7UCZr4R5SkL8PBvpNugV/oRrOd4r8/fey3TVEFhqgF+2fof 4sqwMhzx04BOXliPx+rl9VxVz+suvO8Lt2/lOjF94wa1iBtnFyiTqdHd58BSCgEcBC+T gxCgPIifaqm393RpadCJO9MxhiylBNYRrRnvZKSuYYZpTiqtSM562MuT6cCZkxePMyro 0+jJGngIfi1s2MkCOize15/M6seMoD6TPPa3QFI8UCxTKO+OE9z8IFcZUxYV6+5/WqPw jtN8N12eeghc4Itc4DVcbSK9wdYhLr0AHAIoBsQioYN9agXoOfpQYAsTysgxxiEONavz a4ZQ== X-Gm-Message-State: AJcUukc5H8tFPlQ8gsL3Sx/8M13RdGGbeZY9XPZhfpQ/SbcHBg//+OYr 6y4hJgiBt+ES6qd61s4bxn/4U9UVg1A= X-Google-Smtp-Source: ALg8bN5Pa1G5uAAreLJUsvnXuKXoqnB/OuhYT6/cS4vJiBDbtX21eMh64bYx4cARh8Y2v53zKN5yuA== X-Received: by 2002:a63:a553:: with SMTP id r19mr32449265pgu.53.1548962900998; Thu, 31 Jan 2019 11:28:20 -0800 (PST) From: Thomas Garnier To: kernel-hardening@lists.openwall.com Cc: kristen@linux.intel.com, Thomas Garnier , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Thomas Garnier , linux-kernel@vger.kernel.org Subject: [PATCH v6 04/27] x86: relocate_kernel - Adapt assembly for PIE support Date: Thu, 31 Jan 2019 11:24:11 -0800 Message-Id: <20190131192533.34130-5-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 absolute 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 --- arch/x86/kernel/relocate_kernel_64.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/relocate_kernel_64.S b/arch/x86/kernel/relocate_kernel_64.S index 11eda21eb697..3320368b6ec9 100644 --- a/arch/x86/kernel/relocate_kernel_64.S +++ b/arch/x86/kernel/relocate_kernel_64.S @@ -208,7 +208,7 @@ identity_mapped: movq %rax, %cr3 lea PAGE_SIZE(%r8), %rsp call swap_pages - movq $virtual_mapped, %rax + movabsq $virtual_mapped, %rax pushq %rax ret