Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2662066rwb; Mon, 15 Aug 2022 09:08:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR5o91XxFeMF+m/8hyuBRAtGstsS7CO+CuZ+zYr+my2jrOJKrNZaYa5YTaFRbr5hyGM4aTis X-Received: by 2002:a17:907:b17:b0:72a:edb8:7529 with SMTP id h23-20020a1709070b1700b0072aedb87529mr10894004ejl.749.1660579731262; Mon, 15 Aug 2022 09:08:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660579731; cv=none; d=google.com; s=arc-20160816; b=dZWeCGY0RMmaKMBQSfGnTNMeTH41ZyqpuU34f7+eTVh091ZvaRnx+2akS4zalGUyR5 Mo8fyxA0HHz6Ep/HFa3AvfUpHRBj84ZfWuFQxB7QT3oJwTRDcrZYaqWOnTC7qOdEpLx8 UH41V3faS0UP6NuGnp1gFp+KaPFZ1O5/tWim/JXOg/NsARQ1277GHFWB+L2C3wuHc9+7 lChdeHdql53xPAHiXK1J78HvpoKaU1flnLL3PBaR9lDLKRL4bSO26Okt/bV5HqrVWRbn 4XCGMliwPiMLRLTBN4U3K2HQO/LVT+HEZaKMMkXfVm3S02I4oz/wizEOGofr+tI/T6fl a0YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RqH1kAkjrnR3j/vdtYu6rW+fESWnaxFrU4NkHAF6vNI=; b=J5qEy8CrejAgVe87ftBnpWl2ujMxVh/NS1FU2Unr6X8LCIcA9AgndNKHfdQxeYldqo vTHw7/mWyKvFr0whqPRf0PLlzM4t5sdjyPcTTs6+0YhCS27F/etc/+ddblQtzDypYIDO u3EfX028BGdrSxj69Hxn1lbvrVV8poJPeu2G7ib0mUeyGFsD6ItzV3fKhq2KIAUUMk8I Sf2VtDGckEuCXc6gbdzIFR0Cnjc/x+In3eEcWWnYqXk/V7uBAJ2HffVGoS73tn0hrmSl F006cWg3u/fKRtqR9uW8h3TliX2A0ZUWR3i0Qe7+D+tAbiy1/H6IJBQrg5egFelHGFiG O7WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uPhfv9XO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020a056402439500b0043d651cf5acsi9250301edc.99.2022.08.15.09.08.24; Mon, 15 Aug 2022 09:08:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=uPhfv9XO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232772AbiHOPl7 (ORCPT + 99 others); Mon, 15 Aug 2022 11:41:59 -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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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