Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1244412imm; Wed, 10 Oct 2018 11:20:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV62LC3icI1DJI32pAIzxtmJWjwKvj+/WN8/sK4GnD/9KcE+cw1DzLLj+Bks02iwWJte8/lke X-Received: by 2002:a17:902:bc49:: with SMTP id t9-v6mr409040plz.210.1539195626898; Wed, 10 Oct 2018 11:20:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539195626; cv=none; d=google.com; s=arc-20160816; b=V3P+1lXTvA2SWGzf0+gbWrPiLS22yZvJ88Z8N7TYLP7RQoL2/qvqYFEu7ZkFf2rftR cSbnY315o+lmCftNGR2T0Ohw1qiDY8OQU2+w5RWk8WLf65N6xrmUFaYPi5d3StFZHh4W Np8nrbaI3/8mNJWJxeE7o637/QI1wF840QFy8CMY6uoGFuhxTLfQxewUlSURWoYT57oX +jLGA7WTm27sVoPmpdjU3yqjIAE0EjgrdR0/kuYG4VSbE5KR+J+rn5YBfC+OgRIr/2YU G4mh9vnMAvEUmGmzYnCTRD3g1oXTnWtlQraDmmsYG3WVdgXLXzANg15raE7YoyQsVf8R 8c4Q== 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; bh=TlB42OT78Mb0AAwPmXWtkSx1Bw7m2G2iCY7zlExU0v4=; b=iyB2J7r0rrFcQzDnjb8XrTYE21sudO3w1Ldcca/chPGxqQFzRaJVP8yEvsYqjfWne5 KATzUGTbfnE9ItaGXmjoNsUjNCUKDPOVF0wjzUipNPgCiY1KkK/oWO03RXXlr+qyJaat w/6ALKby50u2AUu/6su32OPfLIuQRmQME8GvAccN2nYqXqkdQVk5cUuvOxpdQDiMJj/6 nnOZMGL/x0fdbRbn9UMjsxyF+OB7yIWuOQBWb41nWSy9BAEXOALlLkOkV+aLon3ObDab WrRjz21yq/Yx3VfM0xCXH67mnpBpez8IaJnudrlDdIUMlW/T4S9vzH08o6vfnJQHfj+V c39w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e193-v6si26146006pfc.131.2018.10.10.11.20.12; Wed, 10 Oct 2018 11:20:26 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726910AbeJKBlI (ORCPT + 99 others); Wed, 10 Oct 2018 21:41:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53276 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726663AbeJKBlI (ORCPT ); Wed, 10 Oct 2018 21:41:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3774F88E50; Wed, 10 Oct 2018 18:17:50 +0000 (UTC) Received: from treble (ovpn-124-83.rdu2.redhat.com [10.10.124.83]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A992488880; Wed, 10 Oct 2018 18:17:43 +0000 (UTC) Date: Wed, 10 Oct 2018 13:17:41 -0500 From: Josh Poimboeuf To: Andy Lutomirski Cc: Steven Rostedt , Peter Zijlstra , LKML , Linus Torvalds , Ingo Molnar , Andrew Morton , Thomas Gleixner , Masami Hiramatsu , Mathieu Desnoyers , Matthew Helsley , "Rafael J. Wysocki" , David Woodhouse , Paolo Bonzini , Jason Baron , Jiri Kosina , Ard Biesheuvel , Andrew Lutomirski Subject: Re: [POC][RFC][PATCH 1/2] jump_function: Addition of new feature "jump_function" Message-ID: <20181010181741.lc4l7kjvcmoxrw5b@treble> References: <20181006093905.46276505@vmware.local.home> <20181008072134.GB5663@hirez.programming.kicks-ass.net> <20181008155757.GC5663@hirez.programming.kicks-ass.net> <20181009021710.qwt5hpntyeps44h3@treble> <20181008235750.59da83ae@gandalf.local.home> <20181010175237.e7m3sldcu2maoqcq@treble> <20181010181605.arsyjxwdztztrjih@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181010181605.arsyjxwdztztrjih@treble> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 10 Oct 2018 18:17:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 10, 2018 at 01:16:05PM -0500, Josh Poimboeuf wrote: > On Wed, Oct 10, 2018 at 11:03:43AM -0700, Andy Lutomirski wrote: > > > +#define DECLARE_STATIC_CALL(tramp, func) \ > > > + extern typeof(func) tramp; \ > > > + static void __used __section(.discard.static_call_tramps) \ > > > + *__static_call_tramp_##tramp = tramp > > > + > > > > Confused. What's the __static_call_tramp_##tramp variable for? And > > why is a DECLARE_ macro defining a variable? > > This is the magic needed for objtool to find all the call sites. > > The variable itself isn't needed, but the .discard.static_call_tramps > entry is. Objtool reads that section to find out which function call > sites are targeted to a static call trampoline. To clarify: objtool reads that section to find out which functions are really static call trampolines. Then it annotates all the instructions which call/jmp to those trampolines. Those annotations are then read by the kernel. -- Josh