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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29030C25B0E for ; Mon, 15 Aug 2022 15:42:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232845AbiHOPmA (ORCPT ); Mon, 15 Aug 2022 11:42:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232877AbiHOPlp (ORCPT ); Mon, 15 Aug 2022 11:41:45 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D47E0A7; Mon, 15 Aug 2022 08:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=RqH1kAkjrnR3j/vdtYu6rW+fESWnaxFrU4NkHAF6vNI=; b=uPhfv9XO1VpipMfVxK4ub8qlnI YOJkBDYjJNJ8qVCd1DM8qS9v+jZjW2dATV/UEF3vWRs3z20nWroKrc5dNMY0KXl+8wZ53mOEL9zYf vZ9AHsP5C/J/W1NHTMpovc3LMAAOBGXuEHAGQ2q5ewW0gWkGzChFXTqwgx1wcL3mQi7NfFrQN1zOm F5XGh34LDqcs69twWpP/d/xPhmHE5ySbAVx2YCps5JJDTVXxVRpg72go1AtSm2Mv2eNRvJ1J3wv/+ SPY5N7MWhQXqXbN/E+X7TUqDwCyR2Xex8CNhCuHyVLhVdKFf4S9DYJt5H6o90vQdc3+4Z+TbYImcR UlD6Vzhg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oNcDZ-005pmp-4T; Mon, 15 Aug 2022 15:41:29 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 528529801D4; Mon, 15 Aug 2022 17:41:27 +0200 (CEST) Date: Mon, 15 Aug 2022 17:41:27 +0200 From: Peter Zijlstra To: Alexei Starovoitov Cc: Jiri Olsa , Steven Rostedt , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Ingo Molnar , bpf , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , LKML , Josh Poimboeuf Subject: Re: [RFC] ftrace: Add support to keep some functions out of ftrace Message-ID: References: <20220813150252.5aa63650@rorschach.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 15, 2022 at 05:28:02PM +0200, Peter Zijlstra wrote: > On Mon, Aug 15, 2022 at 08:17:42AM -0700, Alexei Starovoitov wrote: > > It's hiding a fake function from ftrace, since it's not a function > > and ftrace infra shouldn't show it tracing logs. > > In other words it's a _notrace_ function with nop5. > > Then make it a notrace function with a nop5 in it. That isn't hard. > > The whole problem is that it isn't a notrace function and you're abusing > a __fentry__ site. https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=x86/fineibt&id=8d075bdf11193f1d276bf19fa56b4b8dfe24df9e foo.c: __attribute__((__no_instrument_function__)) __attribute__((patchable_function_entry(5))) void my_func(void) { } void my_foo(void) { } gcc -c foo.c -pg -mfentry -mcmodel=kernel -fno-PIE -O2 foo.o: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 : 0: f3 0f 1e fa endbr64 4: 90 nop 5: 90 nop 6: 90 nop 7: 90 nop 8: 90 nop 9: c3 ret a: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) 0000000000000010 : 10: f3 0f 1e fa endbr64 14: e8 00 00 00 00 call 19 15: R_X86_64_PLT32 __fentry__-0x4 19: c3 ret