Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp606124imj; Thu, 7 Feb 2019 09:05:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IbR4rIxEBy75vbkaHKVdAeK5lnHx9n7lgicbwB9/7TscH4rJN0yGOPAPT37h76vHp83b++H X-Received: by 2002:a63:2406:: with SMTP id k6mr15183976pgk.229.1549559129429; Thu, 07 Feb 2019 09:05:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549559129; cv=none; d=google.com; s=arc-20160816; b=YXgtTLl7uxq0s38alR3/oDze4BZ6cm99FLvCKW3m/nS+cs1qXIljTZFHkI/5WExZFx V6/C1NY7I7AyVNGS/mgnaJhIC6+oYeEKXXi4yS+hPXuW5dK/n4LUwSwBJ6yRjNH1hpAK YmCwZXaXXvxWgmgTyUSdJ6skmtinjXf2vbeNg1fyO2S/9ETbn8k7VbVqMM31+9rDK7Na ZC24nj8dUw2SF2kiIxcDXyvsi3IykEP92aLjI/xoL9M+S1oUS8KLZgM1k3hzafuIuGA9 5q+9HoJmi+d2ohNPc5lhem4oXR9RfRPlIfumw3qEfCALWF3ShwLitfUeJXr/SI7jMtSO 23yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+UungPTGvNyXucoF8vGb02MG0uot3poQft8jVKChgKA=; b=bft5nlVyQX+YN4QjKhMjKnrBnx6FHL8eMFxDNgREUqo9mkdIzTJdDEiHojJjF6lHAo DEZhZGda/ktBSaTF2peKDgZiVbHFeSG1ehRtnVaGLLj5DL+5bAnB0iWHzBEBkM17VQgZ iyuZxFdlNOWJmjiEFFO1IB35LgkA2DSA3les7E37PBD7anqqrQviJCMcntQbxa1iU11j It962BF0x0UCcHTGJyTv02+SO1XomfIUlG8LS6YHnxe8LSZyvUCTmOUtwZJ1qjjM6WqU rMnYqY47pz7zooNcwNZ/dgcvxz756X3l10OtNo7L0ybnkNcJxq0rV3IGOFwJvvD1OsAc rl7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Kv/OBBi8"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 145si8988016pga.396.2019.02.07.09.05.10; Thu, 07 Feb 2019 09:05:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Kv/OBBi8"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726883AbfBGRE7 (ORCPT + 99 others); Thu, 7 Feb 2019 12:04:59 -0500 Received: from mail-it1-f196.google.com ([209.85.166.196]:55673 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726270AbfBGRE6 (ORCPT ); Thu, 7 Feb 2019 12:04:58 -0500 Received: by mail-it1-f196.google.com with SMTP id m62so1434087ith.5 for ; Thu, 07 Feb 2019 09:04:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+UungPTGvNyXucoF8vGb02MG0uot3poQft8jVKChgKA=; b=Kv/OBBi8WLCbPKXTO32dfKZ+CeQh7Um1B/LmLHcz5YZcFmJaF4hxn53RjsprzUlORo 7V31blyjal2dqJmC2srAEqdbzuXEuK2Dh9A5pOtzO0tIaPn8C6ySP0CUyfryxXBfPuIj uRWM3y4PNBOh8MKmfZ+cqOS9XCjjLFRV3bOAw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+UungPTGvNyXucoF8vGb02MG0uot3poQft8jVKChgKA=; b=E7R08gUgO/snmD/ac4udqR6A/J19c3uDyZjW1tA8GhhAYqBB1WJaCxPdrfHGHWxXM3 xpxSUPyod/gDqvZf0xyZs+lWg3JkAFiPqGMfN1+l7StLus3cV7l3zpjecDNOLuLqPXHh 67A4HSVzHPGEwg99eftdpJuDR7NAg9yJZ4DdVUyqatzhndPZLiuMQeMIw2zQQiGz/6E+ v2o2XgxoQF/q8369cEL5vJH8+crqbyKCywn9rlAGdv9z8ZinYG96zG248o8oedf3upqM /+CgNMQaC63jD3KIBevQnSydZID4hGGDRQBXDtgEivMvgkp9AYoNtSDuueHTuJ6LYZX5 PzmQ== X-Gm-Message-State: AHQUAubQ9Xr79SuiJj6Z4rj2YcSlNCwTXIdZBqOqgmCTBGFC+k82I23D B37mFmI73BYAFwlDF7P4WOXp2fd5pqE= X-Received: by 2002:a6b:c386:: with SMTP id t128mr9035108iof.304.1549559098125; Thu, 07 Feb 2019 09:04:58 -0800 (PST) Received: from mail-it1-f178.google.com (mail-it1-f178.google.com. [209.85.166.178]) by smtp.gmail.com with ESMTPSA id 197sm5802364itx.21.2019.02.07.09.04.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Feb 2019 09:04:56 -0800 (PST) Received: by mail-it1-f178.google.com with SMTP id h193so1434067ita.5 for ; Thu, 07 Feb 2019 09:04:56 -0800 (PST) X-Received: by 2002:a24:3987:: with SMTP id l129mr5488578ita.45.1549559096311; Thu, 07 Feb 2019 09:04:56 -0800 (PST) MIME-Version: 1.0 References: <20190131192533.34130-1-thgarnie@chromium.org> <20190131192533.34130-3-thgarnie@chromium.org> <20190207121729.GE2414@zn.tnic> In-Reply-To: <20190207121729.GE2414@zn.tnic> From: Thomas Garnier Date: Thu, 7 Feb 2019 09:04:45 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 02/27] x86: Use symbol name in jump table for PIE support To: Borislav Petkov Cc: Kernel Hardening , Kristen Carlson Accardi , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , "the arch/x86 maintainers" , "Peter Zijlstra (Intel)" , Ard Biesheuvel , Nadav Amit , Masahiro Yamada , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 7, 2019 at 4:17 AM Borislav Petkov wrote: > > On Thu, Jan 31, 2019 at 11:24:09AM -0800, Thomas Garnier wrote: > > Replace the %c constraint with %P. The %c is incompatible with PIE > > because it implies an immediate value whereas %P reference a symbol. > > How so? > > AFAIK, %c requires a constant operand and if %P is used to print a > constant, it simply drops syntax-specific prefixes and does a bare > constant. > > I guess that here > > https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#x86Operandmodifiers > > is not entirely correct as it should not say "If used for a constant" > for %P but say "symbol or constant". > > But before/after asm doesn't show any difference. So what gives? I assume that's an optimisation done by gcc later. The P modifier in the documentation does state that it is used to generate PIC code. > > before: > # 39 "./arch/x86/include/asm/jump_label.h" 1 > 1: > .byte 0xe9 > .long .L241 - 2f # > 2: > .pushsection __jump_table, "aw" > .balign 8 > .long 1b - ., .L241 - . # > .quad __use_tsc + 1 - . #, > .popsection > > after: > # 39 "./arch/x86/include/asm/jump_label.h" 1 > 1: > .byte 0xe9 > .long .L241 - 2f # > 2: > .pushsection __jump_table, "aw" > .balign 8 > .long 1b - ., .L241 - . # > .quad __use_tsc+1 - . # > .popsection > > -- > Regards/Gruss, > Boris. > > Good mailing practices for 400: avoid top-posting and trim the reply.