Message ID | 20170810172615.51965-5-thgarnie@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <xen-devel-bounces@lists.xen.org> 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 277DC60236 for <patchwork-xen-devel@patchwork.kernel.org>; Thu, 10 Aug 2017 17:29:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E8071FF61 for <patchwork-xen-devel@patchwork.kernel.org>; Thu, 10 Aug 2017 17:29:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0252D285F0; Thu, 10 Aug 2017 17:29:16 +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 7ACCB27C05 for <patchwork-xen-devel@patchwork.kernel.org>; Thu, 10 Aug 2017 17:29:15 +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 <xen-devel-bounces@lists.xen.org>) id 1dfrEU-0007Yq-94; Thu, 10 Aug 2017 17:26:54 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from <thgarnie@google.com>) id 1dfrET-0007Xm-50 for xen-devel@lists.xenproject.org; Thu, 10 Aug 2017 17:26:53 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id BF/E1-02176-C579C895; Thu, 10 Aug 2017 17:26:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHIsWRWlGSWpSXmKPExsVyMfTASt3o6T2 RBldmyVl83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBnLLz1kKbjCUbFw9wTWBsbT7F2MXBxCAjMY Jfof/GEFcVgEXrFIHP2xDcyREOhnlfh9cDFbFyMnkBMncWTLJyi7QuLIzd2MILaQgJLE1g1Lm SHsf4wSJ/6AxdkEtCT2NMxnAhkkIrBUUOJk6zVGEIdZoIVJ4sm/bUwgVcICPhJHru4C62ARUJ W4PuEt2CReAQuJpisb2CG2mUg8aZ0EVsMpYCkxbdlMqG0WElN/rWSawCiwgJFhFaNGcWpRWWq RrpGlXlJRZnpGSW5iZo6uoYGxXm5qcXFiempOYlKxXnJ+7iZGYHjVMzAw7mBs2ut3iFGSg0lJ lLf4U3ekEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQle/mk9kUKCRanpqRVpmTnAQIdJS3DwKInwb p0KlOYtLkjMLc5Mh0idYrTkuHJl3RcmjikHtgPJVxP+f2MSYsnLz0uVEue1BpknANKQUZoHNw 4WjZcYZaWEeRkZGBiEeApSi3IzS1DlXzGKczAqCfO6gkzhycwrgdv6CuggJqCDInw7QQ4qSUR ISTUw7kpfJ+Ihu2xeZW37/2D73PkXtLe8VZT4WXTvshvDnaR7HGq194XOTlr45oUm77W6Q1v6 Vupt3v8ua296kV4c77E2o+I5At+O+rH/CzRusEhVaLd0DZv3L/O+SD5fkvOOmIIvkSej2zbfF 5Ctm3DXn7/oeENirYrpm/e+FQbqRxim3O3kENdTYinOSDTUYi4qTgQAXtbi/sECAAA= X-Env-Sender: thgarnie@google.com X-Msg-Ref: server-12.tower-31.messagelabs.com!1502386010!92685336!1 X-Originating-IP: [209.85.192.169] 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 55526 invoked from network); 10 Aug 2017 17:26:51 -0000 Received: from mail-pf0-f169.google.com (HELO mail-pf0-f169.google.com) (209.85.192.169) by server-12.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 10 Aug 2017 17:26:51 -0000 Received: by mail-pf0-f169.google.com with SMTP id c28so5618618pfe.3 for <xen-devel@lists.xenproject.org>; Thu, 10 Aug 2017 10:26:51 -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=zShWk/QxB3u/M1CGcpB4xl1REyHU8cm3b50pMykwbu8=; b=Nq/LQQzt6OAHjlwwqAOtVS9ml0B2TXplt5aCSWAR/mDUkarININkPeM+aXCvj7sQs9 7Zf84huaZzrdq6Ft6dVaWJrmcY/AlAKOiLyuOfBzUcXzWVOQoTOXCNSR+RsopsApzE2T EzM7/09hsq0i/wGRns7Vv76w+7OPC8QrcyljNys6lQ4HL1ilRv6Zr0VYwTIWx6XrXQbo LwJmI74b+wAUSSa+taCkRawCfczWx1AcF6oI2T86+vF2DOs1jlHnol4+wAbD/JuCg6bE kmnaN3XE6+NdWKkJO9N8FgS4jQ66bVT3bZKzPFfSO4LOr0uHPWtUHl88dm/2BlL0GxNg JdFg== 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=zShWk/QxB3u/M1CGcpB4xl1REyHU8cm3b50pMykwbu8=; b=iNqUF22+kzIe0I6HQ4I12VNSmWs1/0gi2tlBpX+ex/UhRCV7BQX2aysozIfEdtApsn lhH4oLYDChBMxLh3OxhU54hXlOc2dNysy8KlAaIuRmNOI+oEkPS4KRV1atYMsXmwHfXb nh1QogHsKrZNiKWBJP6D2l0sq/BZIoPhu4jfK7g8QEGPvo8aDTpwyChupzRPk+nUvinP sOulG/lUCYd7C1+kKZWAhgqRhu6qlyuSHMl8mavf94lDJ0sKJcIxXdLhmjvkb5CVDJk/ HP/qWYGPVjP3LsRBTAIMpUsittvwF8H2Z5HPV845zVsRgC3vmf7DVTZDSQaiIr3ijRUX NRxw== X-Gm-Message-State: AHYfb5g7z9/AeBwGbqxUl6bZMZLv0TRVXQF9ZnVkHZsWBkRx6XJ7kxjY r0YvDkPxqX3D8KP/ X-Received: by 10.84.218.4 with SMTP id q4mr14140309pli.202.1502386009257; Thu, 10 Aug 2017 10:26:49 -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.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Aug 2017 10:26:48 -0700 (PDT) From: Thomas Garnier <thgarnie@google.com> To: Herbert Xu <herbert@gondor.apana.org.au>, "David S . Miller" <davem@davemloft.net>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, "H . Peter Anvin" <hpa@zytor.com>, Peter Zijlstra <peterz@infradead.org>, Josh Poimboeuf <jpoimboe@redhat.com>, Arnd Bergmann <arnd@arndb.de>, Thomas Garnier <thgarnie@google.com>, Matthias Kaehlcke <mka@chromium.org>, Boris Ostrovsky <boris.ostrovsky@oracle.com>, Juergen Gross <jgross@suse.com>, Paolo Bonzini <pbonzini@redhat.com>, =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= <rkrcmar@redhat.com>, Joerg Roedel <joro@8bytes.org>, Tom Lendacky <thomas.lendacky@amd.com>, Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@suse.de>, Brian Gerst <brgerst@gmail.com>, "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>, "Rafael J . Wysocki" <rjw@rjwysocki.net>, Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>, Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@linux.com>, Paul Gortmaker <paul.gortmaker@windriver.com>, Chris Metcalf <cmetcalf@mellanox.com>, Andrew Morton <akpm@linux-foundation.org>, "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>, Nicolas Pitre <nicolas.pitre@linaro.org>, Christopher Li <sparse@chrisli.org>, "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>, Lukas Wunner <lukas@wunner.de>, Mika Westerberg <mika.westerberg@linux.intel.com>, Dou Liyang <douly.fnst@cn.fujitsu.com>, Daniel Borkmann <daniel@iogearbox.net>, Alexei Starovoitov <ast@kernel.org>, Masahiro Yamada <yamada.masahiro@socionext.com>, Markus Trippelsdorf <markus@trippelsdorf.de>, Steven Rostedt <rostedt@goodmis.org>, Kees Cook <keescook@chromium.org>, Rik van Riel <riel@redhat.com>, David Howells <dhowells@redhat.com>, Waiman Long <longman@redhat.com>, Kyle Huey <me@kylehuey.com>, Peter Foley <pefoley2@pefoley.com>, Tim Chen <tim.c.chen@linux.intel.com>, Catalin Marinas <catalin.marinas@arm.com>, Ard Biesheuvel <ard.biesheuvel@linaro.org>, Michal Hocko <mhocko@suse.com>, Matthew Wilcox <mawilcox@microsoft.com>, "H . J . Lu" <hjl.tools@gmail.com>, Paul Bolle <pebolle@tiscali.nl>, Rob Landley <rob@landley.net>, Baoquan He <bhe@redhat.com>, Daniel Micay <danielmicay@gmail.com> Date: Thu, 10 Aug 2017 10:25:56 -0700 Message-Id: <20170810172615.51965-5-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 04/23] x86: Add macro to get symbol address for PIE support X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion <xen-devel.lists.xen.org> List-Unsubscribe: <https://lists.xen.org/cgi-bin/mailman/options/xen-devel>, <mailto:xen-devel-request@lists.xen.org?subject=unsubscribe> List-Post: <mailto:xen-devel@lists.xen.org> List-Help: <mailto:xen-devel-request@lists.xen.org?subject=help> List-Subscribe: <https://lists.xen.org/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xen.org?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" <xen-devel-bounces@lists.xen.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h index 7a9df3beb89b..bf2842cfb583 100644 --- a/arch/x86/include/asm/asm.h +++ b/arch/x86/include/asm/asm.h @@ -55,6 +55,19 @@ # define CC_OUT(c) [_cc_ ## c] "=qm" #endif +/* Macros to get a global variable address with PIE support on 64-bit */ +#ifdef CONFIG_X86_32 +#define __ASM_GET_PTR_PRE(_src) __ASM_FORM_COMMA(movl $##_src) +#else +#ifdef __ASSEMBLY__ +#define __ASM_GET_PTR_PRE(_src) __ASM_FORM_COMMA(leaq (_src)(%rip)) +#else +#define __ASM_GET_PTR_PRE(_src) __ASM_FORM_COMMA(leaq (_src)(%%rip)) +#endif +#endif +#define _ASM_GET_PTR(_src, _dst) \ + __ASM_GET_PTR_PRE(_src) __ASM_FORM(_dst) + /* Exception table entry */ #ifdef __ASSEMBLY__ # define _ASM_EXTABLE_HANDLE(from, to, handler) \
Add a new _ASM_GET_PTR macro to fetch a symbol address. It will be used to replace "_ASM_MOV $<symbol>, %dst" code construct that are not compatible with PIE. Signed-off-by: Thomas Garnier <thgarnie@google.com> --- arch/x86/include/asm/asm.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)