From patchwork Tue Jul 18 22:33:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Garnier X-Patchwork-Id: 9850047 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 5A8D060392 for ; Tue, 18 Jul 2017 22:37:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42B6D285B7 for ; Tue, 18 Jul 2017 22:37:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36204285E4; Tue, 18 Jul 2017 22:37:02 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, 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 AF1F9285B7 for ; Tue, 18 Jul 2017 22:37:01 +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 1dXb4M-0000OF-Eb; Tue, 18 Jul 2017 22:34:18 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dXb4K-0000NJ-VL for xen-devel@lists.xenproject.org; Tue, 18 Jul 2017 22:34:17 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 18/84-03406-8EC8E695; Tue, 18 Jul 2017 22:34:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrFIsWRWlGSWpSXmKPExsVyMfTAJt3nPXm RBt9vKVp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBn3Hk5hLrjGXbFz/guWBsannF2MXBxCArMY JWaeXMUE4rAIvGKR6O7+zQriSAj0s0pMuLqKrYuRE8iJk/hxcj+UXSVx+/xMVhBbSEBJYuuGp cwQo/4xSqy8OIcdJMEmoCWxp2E+2FgRgdkcEou7zrCAOAICH9kkbmw5DNbCLNDCJPHk3zYmkB ZhAXeJ7X97WEBsFgFViXWv/4HFeQUsJfadPwQU5wDabSzx94s+iMkpYCWx/D4PxBWWEr29DSw TGAUXMDKsYtQoTi0qSy3SNTTRSyrKTM8oyU3MzNE1NDDTy00tLk5MT81JTCrWS87P3cQIDDsG INjBeH1jwCFGSQ4mJVHercp5kUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeK2BYSwkWJSanlqRl pkDjACYtAQHj5IIrw1Imre4IDG3ODMdInWK0ZLjypV1X5g4phzYDiRfTfj/jUmIJS8/L1VKnN cRpEEApCGjNA9uHCxKLzHKSgnzMgIdKMRTkFqUm1mCKv+KUZyDUUmY91g30BSezLwSuK2vgA5 iAjpI2DcH5KCSRISUVAPj8puVjzyEsl3u/TepjpSJTLN70vjdzGmRVh0fc/c9U4n2jJIrXdfO LE5Iq2Zxm+hUo+EdziWS07Py5cobPD+uJzktX57SoWbLN/fmnmt7g59ellDx2xit/rS2d/L+x LALf6VWz6lj+KwvIjqdYY7tV5uOrT1Teo1ut5h4tasd0Dg0JXnrfXslluKMREMt5qLiRADC/7 UwzQIAAA== X-Env-Sender: thgarnie@google.com X-Msg-Ref: server-6.tower-21.messagelabs.com!1500417254!50829394!1 X-Originating-IP: [209.85.192.178] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15625 invoked from network); 18 Jul 2017 22:34:15 -0000 Received: from mail-pf0-f178.google.com (HELO mail-pf0-f178.google.com) (209.85.192.178) by server-6.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Jul 2017 22:34:15 -0000 Received: by mail-pf0-f178.google.com with SMTP id e199so17767086pfh.2 for ; Tue, 18 Jul 2017 15:34:15 -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=Vpbco9N4XDcCjE6iCZkupT8vWcmkCU5OcV2fZrvcLeU=; b=SBgLV5hcPfe5iF7nr9etY2Sy6y+OAsju7O/1onwqlARmWzXbCXDT6PERm1B1Q9tUZF HvgXF5ZVkys/lMNhRCVFQHWeJf38rw3pCAG90hW+aGVaSp7l1yWBM7Dil7G+O1fSyJLV yHTBrVpWkS1ovUP71qHmjQYpABoBzeLSz4ak59zt7NPsHJzbvHc1TtsHatpAiIAN31RJ Ot3YIbkbH32OH7uP3c7w7rXg6iye1Tv1tNErv5Zx40Yr/Anju8Xh/ZrAv1Rxnp+sWJdF WQTIp4M79IAWJYJylkfLVrRIqLDhnvUM7paBeX/zpYd9iGtsrFD6fxs9NT9gF2bQ2zmV Pr/w== 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=Vpbco9N4XDcCjE6iCZkupT8vWcmkCU5OcV2fZrvcLeU=; b=BuWK7CDDsmqWCssD3909B1C2CMuwpVGqO++JrPZz6WHhzDn49LilnOo/qGBQjKzJR+ b/S7Ts4iHIHVYn1NUfllMYDcYZ9ODtXAH+Wo3mlidtR2POTXCocS9yrBz8g4AiZ8VzXn csAyb1a7SmVE0Ptgsqj23qBgJTT2Smpp6rQNh6Y85wlnh9AH4yPtUKyMJabrW3Hzd90a eiV+k7FKrI9bBPbQHH0Y2jG+Km2fHfBXCpVbxTbDNKuzZJW1P/y161TU9UN4unDrCEYD 7E/Xrd4malSJhyeqGM+/PjVUk8RxSVJxDmvs/M5kvjjTNHpCeTt7HRs77ZLZrsPSrgRa 3JIw== X-Gm-Message-State: AIVw112reC5D9cdR3dp9bW06JRVBgqK4ixvrD+BDB/5cN+KrskSR5XYP MncYHx0jF2Ay6PaS X-Received: by 10.98.99.198 with SMTP id x189mr3987595pfb.180.1500417253206; Tue, 18 Jul 2017 15:34:13 -0700 (PDT) Received: from skynet.sea.corp.google.com ([100.100.206.164]) by smtp.gmail.com with ESMTPSA id b6sm6444242pgn.67.2017.07.18.15.34.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Jul 2017 15:34:12 -0700 (PDT) From: Thomas Garnier To: Herbert Xu , "David S . Miller" , Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , Peter Zijlstra , Josh Poimboeuf , Thomas Garnier , Arnd Bergmann , Matthias Kaehlcke , Boris Ostrovsky , Juergen Gross , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Joerg Roedel , Andy Lutomirski , Borislav Petkov , "Kirill A . Shutemov" , Brian Gerst , Borislav Petkov , Christian Borntraeger , "Rafael J . Wysocki" , Len Brown , Pavel Machek , Tejun Heo , Christoph Lameter , Kees Cook , Paul Gortmaker , Chris Metcalf , "Paul E . McKenney" , Andrew Morton , Christopher Li , Dou Liyang , Masahiro Yamada , Daniel Borkmann , Markus Trippelsdorf , Peter Foley , Steven Rostedt , Tim Chen , Ard Biesheuvel , Catalin Marinas , Matthew Wilcox , Michal Hocko , Rob Landley , Jiri Kosina , "H . J . Lu" , Paul Bolle , Baoquan He , Daniel Micay Date: Tue, 18 Jul 2017 15:33:14 -0700 Message-Id: <20170718223333.110371-4-thgarnie@google.com> X-Mailer: git-send-email 2.13.2.932.g7449e964c-goog In-Reply-To: <20170718223333.110371-1-thgarnie@google.com> References: <20170718223333.110371-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 03/22] 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: