Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3040311imu; Sun, 11 Nov 2018 06:27:51 -0800 (PST) X-Google-Smtp-Source: AJdET5cZnpj3D0I/JpmrdMkLyohCUY/7WnKeLarpxaoNNi95PnJFFGiSGX19owW1ua75C7AqJyD1 X-Received: by 2002:a63:f201:: with SMTP id v1mr6293271pgh.232.1541946471878; Sun, 11 Nov 2018 06:27:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541946471; cv=none; d=google.com; s=arc-20160816; b=DIlsHfoko+Ws2Q/5fIqH7vG/uWWJFlKMGMC/AHMGpUI/jW4ttnEk5UcK22XUhCAGh8 zCV7PwT99m1BzUAPywJ0C7U1CZKq4hBKp66Gt9yO+AdscynR7b2DVHF7bZtLbV7Ifuwx aHPB69JATDyNp2nothbPtbge5VMJut76yTzsfo53fYbBbCFH+w0NXTXgCWnIUNHmlas0 +12RgAwgtjVRDSgGyHr2FwJtqn4v8hodz4TNZTXFcf8tTc4DIcZPRXkHLJ4ZpPObE9Uv 6KfzfbSfBw/LLD9EuYE7EwMGGBGBUREwFJiXjZEb4oq7OkDzcaiSKIu+V/ys6b6F8h38 IJXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=r3lHk6f2BDCJJvvriINBPNWtXObjWl3i/lfDmFpFcN8=; b=IQ1qe9UKe2A8/wih7i0z6iT9rB00g7nZ3dPxej82ktS+qmlQFAfhXBgW+DiKcUncUc ujwec5MZp3Xrt6trpff+abl7b7e/VCbH3lJmnpMiJS03MBnZINFre56V/zfjzNYejjN9 dt8UGBjxSwMurMaz2t/ZCxE1dGjmPtINCN+HHccpHsB4QwuQXz2O2FJiM2SvXFM06vcl UO+wmyAxqgxZMbJuq6wKn5TKttEvupkRMd3n3eqdE9vmr6XFyxWX6pNJahJprGNcTHKL NpT3uMswzHY6qvyTL1JC7N4jmhvSIjvUV3SvHSXXiG1FmrdMEgfNgacI35h6VtqWdDo0 CIZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="n/7jkpnQ"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3-v6si15224808pfl.107.2018.11.11.06.27.36; Sun, 11 Nov 2018 06:27:51 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b="n/7jkpnQ"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728369AbeKLAO1 (ORCPT + 99 others); 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.