From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08CEBC43441 for ; Sun, 11 Nov 2018 14:25:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C4DF6208A3 for ; Sun, 11 Nov 2018 14:25:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="n/7jkpnQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4DF6208A3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728403AbeKLAO1 (ORCPT ); Sun, 11 Nov 2018 19:14:27 -0500 Received: from merlin.infradead.org ([205.233.59.134]:56070 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727817AbeKLAO1 (ORCPT ); Sun, 11 Nov 2018 19:14:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=r3lHk6f2BDCJJvvriINBPNWtXObjWl3i/lfDmFpFcN8=; b=n/7jkpnQofBZghCSP/CgNlBsq NTy86ayMb+66/hY9vTYDzQhsDbtKh+U2JxEPhkEtVRBFGxvW2j5qoHmIFmBZV7o3+/LHmn1O9DZSY HQjvJS/6moiTn3BETLG7c8oKJEDEf4UlHhrk7hyZcM9jX5M/eHbStyjx34YxMlB4l6cJSCfgJrLjP wWG3oomlRbPy8KXZGqsFxadObfY/jxN6j7/JpbVl4fGEsN1BaWqgAH7OMT/6Dd1H/Lt7D/WO/tUPV 948ct6YSE86l/FwgQG5/7nH/YacImZknwxgZQrYcoPFn/cIypcg8bYM50zBpjErlO5FrSX+NvBJMk DBvX1/DIA==; Received: from [64.114.255.114] (helo=worktop) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gLqg2-0008Ai-5x; Sun, 11 Nov 2018 14:25:26 +0000 Received: by worktop (Postfix, from userid 1000) id A6C5B6E07F4; Sun, 11 Nov 2018 15:25:25 +0100 (CET) Date: Sun, 11 Nov 2018 15:25:25 +0100 From: Peter Zijlstra To: Ard Biesheuvel Cc: Ingo Molnar , Josh Poimboeuf , Linux Kernel Mailing List , the arch/x86 maintainers , Andy Lutomirski , Steven Rostedt , Thomas Gleixner , Linus Torvalds , Masami Hiramatsu , Jason Baron , Jiri Kosina , David Laight , Borislav Petkov Subject: Re: [PATCH RFC 0/3] Static calls Message-ID: <20181111142525.GF12766@worktop.psav.com> References: <20181109072811.GB86700@gmail.com> <20181110232059.GA12766@worktop.psav.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Nov 11, 2018 at 02:42:55PM +0100, Ard Biesheuvel wrote: > On 11 November 2018 at 00:20, Peter Zijlstra wrote: > > On Fri, Nov 09, 2018 at 02:50:27PM +0100, Ard Biesheuvel wrote: > >> On 9 November 2018 at 08:28, Ingo Molnar wrote: > >> >> - I'm not sure about the objtool approach. Objtool is (currently) > >> >> x86-64 only, which means we have to use the "unoptimized" version > >> >> everywhere else. I may experiment with a GCC plugin instead. > >> > > >> > I'd prefer the objtool approach. It's a pretty reliable first-principles > >> > approach while GCC plugin would have to be replicated for Clang and any > >> > other compilers, etc. > >> > > >> > >> I implemented the GCC plugin approach here for arm64 > > > > I'm confused; I though we only needed objtool for variable instruction > > length architectures, because we can't reliably decode our instruction > > stream. Otherwise we can fairly trivially use the DWARF relocation data, > > no? > > How would that work? We could build vmlinux with --emit-relocs, filter > out the static jump/call relocations and resolve the symbol names to > filter the ones associated with calls to trampolines. But then, we > have to build the static_call_sites section and reinject it back into > the image in some way, which is essentially objtool, no? It's a _much_ simpler tool than objtool, but yes, we need a tool that reads the relocation stuff and (re)injects it in a new section -- we don't need it on a vmlinux level, it can be done per TU. Anyway, a GCC plugin (I still have to have a peek at your thing) sounds like it should work just fine too.