From patchwork Thu Aug 10 17:25:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 9894329 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 4F253603B4 for ; Thu, 10 Aug 2017 17:29:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 364FA1FF61 for ; Thu, 10 Aug 2017 17:29:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A0CF285F0; Thu, 10 Aug 2017 17:29:14 +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=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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 ABAD627C05 for ; Thu, 10 Aug 2017 17:29:13 +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 1dfrES-0007XB-2D; Thu, 10 Aug 2017 17:26:52 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfrER-0007W6-A6 for xen-devel@lists.xenproject.org; Thu, 10 Aug 2017 17:26:51 +0000 Received: from [85.158.143.35] by server-5.bemta-6.messagelabs.com id D6/E4-03368-A579C895; Thu, 10 Aug 2017 17:26:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLIsWRWlGSWpSXmKPExsVyMfTAZt3I6T2 RBg/7DSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oy12/+xF1znrujZfYGtgfEZZxcjF4eQwAxG ibv/ZjOCOCwCr1gkLra/AXMkBPpZJf4vuMDexcgJ5MRJHJ7dyQRhV0hMn70WzBYSUJLYumEpM 8Sof4wSR+c/YQRJsAloSexpmM8EkhARWCoocbL1GthYZoEWJokn/7YBZTg4hAW8JNat5AZpYB FQldj1cQYrSJhXwEKitT8bYpmJxJPWSWAzOQUsJaYtm8kMsdhCYuqvlUwTGAUWMDKsYtQoTi0 qSy3SNbLQSyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQIDC4GINjBeH5t4CFGSQ4m JVHe4k/dkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkePmn9UQKCRalpqdWpGXmAMMcJi3BwaMkw rt1KlCat7ggMbc4Mx0idYrRkuPKlXVfmDimHNgOJF9N+P+NSYglLz8vVUqc1xpkngBIQ0ZpHt w4WCxeYpSVEuZlBDpQiKcgtSg3swRV/hWjOAejkjAvO8gUnsy8Eritr4AOYgI6KMK3E+SgkkS ElFQDY2c4W3mEXsVGbjvOaRP9xKPuaSg+y5/O8NMxeq7zpbAXuT9yvzGt/8jPUXH9hDVj0Qnv y5P1L8pdFDbZIvx3j+c/6ysXna+92v040MTrxNJFMw448f68u9Z86QE1yfbXu41v9898kCIdc sL6wJ5EkXnHZ9mZT1xifNrn4rsqRQ/P/4kOn5ScTyqxFGckGmoxFxUnAgDuF1s1wAIAAA== X-Env-Sender: thgarnie@google.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1502386008!77247837!1 X-Originating-IP: [209.85.192.179] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24780 invoked from network); 10 Aug 2017 17:26:49 -0000 Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by server-9.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 10 Aug 2017 17:26:49 -0000 Received: by mail-pf0-f179.google.com with SMTP id h68so5707333pfk.0 for ; Thu, 10 Aug 2017 10:26:49 -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=XP0AHvNJXIQ0dh1yFRKn4+yVNx0GtzCOb/CGU2mpPZw=; b=p7L0HFtPCokUe2yX38XNd3IeViEn9dPItBUSUOvAsBKjseOHd0sp62EqhTW9gKt5HX GATvK0KKa1cHyyuucqBw5Vp9yj+wSud9NvekSbYYPmgy+PnEYPDBV8OhUijUpFmkM5T+ mjeU/ij7LJb35daZycihwsERWqR+5qNVBOmP/rPdZoYz5MSZZ3l61IC9VEcNSdKYA5JP ZQFJcZDkrYsiYowgIUKF6SVNQxI5kUIrMhTvz2ApqHyFYf8Qeo69GugBy+cB/vbhcQAD ZHBwhzp7v/NjWTSHinpgU56yW5F0oir9UrjExdUQpyw6YrcJLHuzJG+MsrNOzjb8BMrq YLvA== 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=XP0AHvNJXIQ0dh1yFRKn4+yVNx0GtzCOb/CGU2mpPZw=; b=pP5ttAKWemx2pU2cedY+idtALIOqMlynILNUkfi4mEd03oLGtARraJ6uHoiOO1Q2J8 2Fv2QouYnavhGoTSmBZxwJ9WpqqIP53++J4wZvfasP9gjpSk3zLrqjqFkuaPPmZ5AU+V ZeUseeiexsuSAJVeZER3yr8cpbJMrdFKl6pgWE5YeforJmZXgGoeAbdA/98wKD+cuGZs eLS7giC72UHa4jjg0tbiBZmyEqDD7Jmi14oVG2oHsvhNZgxu1K0RJaGF4R+VfpXCty3C cPtIAhC+YwsbPLs0VkNnG7iiSW1tzSXSH3K6+cgSuoLHeih3+QotRP2dTEsRazbpN2cV NGZg== X-Gm-Message-State: AHYfb5h6H787XJ1D6epJPlW9Y4x/48gK0Szg0eEXeNRsVVKmrRFp0h1L hkSLeOfnGAWiSDQ6 X-Received: by 10.84.241.70 with SMTP id u6mr13972744plm.96.1502386007817; Thu, 10 Aug 2017 10:26:47 -0700 (PDT) Received: from skynet.sea.corp.google.com ([172.31.92.33]) by smtp.gmail.com with ESMTPSA id p77sm11894925pfi.153.2017.08.10.10.26.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Aug 2017 10:26:47 -0700 (PDT) From: Thomas Garnier To: Herbert Xu , "David S . Miller" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Arnd Bergmann , Thomas Garnier , Matthias Kaehlcke , Boris Ostrovsky , Juergen Gross , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Joerg Roedel , Tom Lendacky , Andy Lutomirski , Borislav Petkov , Brian Gerst , "Kirill A . Shutemov" , "Rafael J . Wysocki" , Len Brown , Pavel Machek , Tejun Heo , Christoph Lameter , Paul Gortmaker , Chris Metcalf , Andrew Morton , "Paul E . McKenney" , Nicolas Pitre , Christopher Li , "Rafael J . Wysocki" , Lukas Wunner , Mika Westerberg , Dou Liyang , Daniel Borkmann , Alexei Starovoitov , Masahiro Yamada , Markus Trippelsdorf , Steven Rostedt , Kees Cook , Rik van Riel , David Howells , Waiman Long , Kyle Huey , Peter Foley , Tim Chen , Catalin Marinas , Ard Biesheuvel , Michal Hocko , Matthew Wilcox , "H . J . Lu" , Paul Bolle , Rob Landley , Baoquan He , Daniel Micay Date: Thu, 10 Aug 2017 10:25:55 -0700 Message-Id: <20170810172615.51965-4-thgarnie@google.com> X-Mailer: git-send-email 2.14.0.434.g98096fd7a8-goog In-Reply-To: <20170810172615.51965-1-thgarnie@google.com> References: <20170810172615.51965-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 v2 03/23] x86: Use symbol name in jump table 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 Replace the %c constraint with %P. The %c is incompatible with PIE because it implies an immediate value whereas %P reference a symbol. Position Independent Executable (PIE) support will allow to extended the KASLR randomization range below the -2G memory limit. Signed-off-by: Thomas Garnier --- arch/x86/include/asm/jump_label.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h index adc54c12cbd1..6e558e4524dc 100644 --- a/arch/x86/include/asm/jump_label.h +++ b/arch/x86/include/asm/jump_label.h @@ -36,9 +36,9 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t" ".pushsection __jump_table, \"aw\" \n\t" _ASM_ALIGN "\n\t" - _ASM_PTR "1b, %l[l_yes], %c0 + %c1 \n\t" + _ASM_PTR "1b, %l[l_yes], %P0 \n\t" ".popsection \n\t" - : : "i" (key), "i" (branch) : : l_yes); + : : "X" (&((char *)key)[branch]) : : l_yes); return false; l_yes: @@ -52,9 +52,9 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool "2:\n\t" ".pushsection __jump_table, \"aw\" \n\t" _ASM_ALIGN "\n\t" - _ASM_PTR "1b, %l[l_yes], %c0 + %c1 \n\t" + _ASM_PTR "1b, %l[l_yes], %P0 \n\t" ".popsection \n\t" - : : "i" (key), "i" (branch) : : l_yes); + : : "X" (&((char *)key)[branch]) : : l_yes); return false; l_yes: