From nobody Mon Dec 1 23:35:37 2025 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [160.30.148.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7962331A577; Wed, 26 Nov 2025 09:29:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=160.30.148.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764149383; cv=none; b=ETcgNPkV0xg4RiUbTpMlQaCG8Sud22m0r4Ms+vQ9DoE4wTVZCAuY/9HQyjWCwBUKFAIUeMKGCINZX8BwcrWqEFYbfB8qKpNF91ZoekqhMJ7BWuKtmiUJSk2tw+Pj7Q93zB8Np9bmf2qMU6fKZQHD3Okxo5ggyNexwMAZZj16Oq8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764149383; c=relaxed/simple; bh=0xoq5tjYfMPR4AF4PzDf0qfT+wVcOjr0Qat7Og+gRIY=; h=Date:Message-ID:In-Reply-To:References:Mime-Version:From:To:Cc: Subject:Content-Type; b=eXBf0KmCLWWhy3K6LYXxkArAr5lkIv+u62tqfBhNlwowepUvRCH21HYhQLfXJRn06AwG5xWS3mm2cBH5ObGP2i4NRyS7WPNGq/jE22jVSioZ1hGulMI740nDJlEzf/I12PNVE+9VPt5ZhWZL0VPwikOXAJUuL8QLJwIXpYY7QEA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; arc=none smtp.client-ip=160.30.148.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4dGZ5b2lFmz8Xs7F; Wed, 26 Nov 2025 17:29:39 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.99.176]) by mse-fl1.zte.com.cn with SMTP id 5AQ9TN88099351; Wed, 26 Nov 2025 17:29:23 +0800 (+08) (envelope-from wang.yaxin@zte.com.cn) Received: from mapi (xaxapp04[null]) by mapi (Zmail) with MAPI id mid32; Wed, 26 Nov 2025 17:29:26 +0800 (CST) Date: Wed, 26 Nov 2025 17:29:26 +0800 (CST) X-Zmail-TransId: 2afb6926c87655e-e1a95 X-Mailer: Zmail v1.0 Message-ID: <20251126172926004y3hC8QyU4WFOjBkU_UxLC@zte.com.cn> In-Reply-To: <20251126172445319I7DWJm-KEEuCmqtLupteE@zte.com.cn> References: 20251126172445319I7DWJm-KEEuCmqtLupteE@zte.com.cn Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 From: To: Cc: , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIHYyIDEvM10gZmdyYXBoOiBJbml0aWFsaXplIGZ0cmFjZV9vcHMtPnByaXZhdGUgZm9yIGZ1bmN0aW9uIGdyYXBoIG9wcw==?= X-MAIL: mse-fl1.zte.com.cn 5AQ9TN88099351 X-TLS: YES X-SPF-DOMAIN: zte.com.cn X-ENVELOPE-SENDER: wang.yaxin@zte.com.cn X-SPF: None X-SOURCE-IP: 10.5.228.132 unknown Wed, 26 Nov 2025 17:29:39 +0800 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6926C883.000/4dGZ5b2lFmz8Xs7F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Shengming Hu The ftrace_pids_enabled(op) check relies on op->private being properly initialized, but fgraph_ops's underlying ftrace_ops->private was left uninitialized. This caused ftrace_pids_enabled() to always return false, effectively disabling PID filtering for function graph tracing. Fix this by copying src_ops->private to dst_ops->private in fgraph_init_ops(), ensuring PID filter state is correctly propagated. Signed-off-by: Shengming Hu --- kernel/trace/fgraph.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index 7fb9b169d..f6f25d81a 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trace/fgraph.c @@ -1016,6 +1016,7 @@ void fgraph_init_ops(struct ftrace_ops *dst_ops, mutex_init(&dst_ops->local_hash.regex_lock); INIT_LIST_HEAD(&dst_ops->subop_list); dst_ops->flags |=3D FTRACE_OPS_FL_INITIALIZED; + dst_ops->private =3D src_ops->private; } #endif } --=20 2.25.1 From nobody Mon Dec 1 23:35:37 2025 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [160.30.148.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA2AF2DA75B; Wed, 26 Nov 2025 09:33:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=160.30.148.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764149634; cv=none; b=elIdG72wpK78OhPOIZ1N4eHqUcZoF86c4IH1DoUPCcAoZhLVRco1NjJ7Yf53RLk4+9w8bWG5Vy351x1E12GPj8JMjsZ9KJTmpxkq2NDg4dSXY+OgCnnAV8MfqxzNpCZEtH3NxZOBYyoD2koZTdhAqQ0qIhZgrKWLATNxxSen03U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764149634; c=relaxed/simple; bh=emByY0jXGzK1DSZ8USjnXnQUHRpmt/3rerWz7U+qx5A=; h=Date:Message-ID:In-Reply-To:References:Mime-Version:From:To:Cc: Subject:Content-Type; b=AL1Qtwl4+A6mywKjHKb/d26WcudLCHAGEYIzU04D1xH6tqoiRYFoe+Ty4NfUg5jXPRMhKNeAL/c4eTVlDw1DOeo6NI9OvrVikSEJB8VG6UOa+DWKu8AamD6ZEEoG19uCMISuly/p361CpXcpYlDdtrnej1qx506zXajjaPSkMBQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; arc=none smtp.client-ip=160.30.148.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Received: from mxct.zte.com.cn (unknown [192.168.251.13]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4dGZBP6vKzz8Xs7M; Wed, 26 Nov 2025 17:33:49 +0800 (CST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4dGZBJ0pZWz501bP; Wed, 26 Nov 2025 17:33:44 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.99.176]) by mse-fl1.zte.com.cn with SMTP id 5AQ9XTjq008452; Wed, 26 Nov 2025 17:33:29 +0800 (+08) (envelope-from wang.yaxin@zte.com.cn) Received: from mapi (xaxapp02[null]) by mapi (Zmail) with MAPI id mid32; Wed, 26 Nov 2025 17:33:31 +0800 (CST) Date: Wed, 26 Nov 2025 17:33:31 +0800 (CST) X-Zmail-TransId: 2afa6926c96bb45-1a045 X-Mailer: Zmail v1.0 Message-ID: <20251126173331679XGVF98NLhyLJRdtNkVZ6w@zte.com.cn> In-Reply-To: <20251126172445319I7DWJm-KEEuCmqtLupteE@zte.com.cn> References: 20251126172445319I7DWJm-KEEuCmqtLupteE@zte.com.cn Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 From: To: Cc: , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIHYyIDIvM10gZmdyYXBoOiBDaGVjayBmdHJhY2VfcGlkc19lbmFibGVkIG9uIHJlZ2lzdHJhdGlvbiBmb3IgZWFybHkgZmlsdGVyaW5n?= X-MAIL: mse-fl1.zte.com.cn 5AQ9XTjq008452 X-TLS: YES X-SPF-DOMAIN: zte.com.cn X-ENVELOPE-SENDER: wang.yaxin@zte.com.cn X-SPF: None X-SOURCE-IP: 192.168.251.13 unknown Wed, 26 Nov 2025 17:33:49 +0800 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6926C97D.006/4dGZBP6vKzz8Xs7M Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Shengming Hu When registering ftrace_graph, check if ftrace_pids_enabled is active. If enabled, assign entryfunc to fgraph_pid_func to ensure filtering is performed before executing the saved original entry function. Signed-off-by: Shengming Hu --- kernel/trace/fgraph.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/trace/fgraph.c b/kernel/trace/fgraph.c index f6f25d81a..65ac0f04a 100644 --- a/kernel/trace/fgraph.c +++ b/kernel/trace/fgraph.c @@ -1369,6 +1369,13 @@ int register_ftrace_graph(struct fgraph_ops *gops) ftrace_graph_active++; + /* Always save the function, and reset at unregistering */ + gops->saved_func =3D gops->entryfunc; +#ifdef CONFIG_DYNAMIC_FTRACE + if (ftrace_pids_enabled(&gops->ops)) + gops->entryfunc =3D fgraph_pid_func; +#endif + if (ftrace_graph_active =3D=3D 2) ftrace_graph_disable_direct(true); @@ -1388,8 +1395,6 @@ int register_ftrace_graph(struct fgraph_ops *gops) } else { init_task_vars(gops->idx); } - /* Always save the function, and reset at unregistering */ - gops->saved_func =3D gops->entryfunc; gops->ops.flags |=3D FTRACE_OPS_FL_GRAPH; --=20 2.25.1 From nobody Mon Dec 1 23:35:37 2025 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [160.30.148.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 38BEECA4E; Wed, 26 Nov 2025 09:36:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=160.30.148.34 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764149772; cv=none; b=PFNCdsRhZ3qmI3qVMF68IjzUC+7VhFoHwG89BhgH/E09gTXt303exOcXnI8ONdYJYgKhtd9vVc/TunjgO3RZD/zcCdCXRhdl4DWMWUZ//6NVeWP6qwLXWrxD3rpOEAepzqutQWEDFONLFasjg0cQOp+Gk/9xGsn6XAFny5KLXk0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764149772; c=relaxed/simple; bh=4LAMaG47gRXDPCLwrq5B6EQpVTnMgHX8SMFuApNYACI=; h=Date:Message-ID:In-Reply-To:References:Mime-Version:From:To:Cc: Subject:Content-Type; b=B4I4LUx3QJCiMK+2IqwhGRdoDkqodSQJ5zDO7ZsqkhBUpDihwS4mlhlVeXHE7DVbb6ZBC3jAMjFTIJnwxuB3r5wXaHEX0mU2XU/xyj16n+sE87AHg0SFd5DWV5yeNOO69QHs1IcuYsszMzzfxbWaH5YI6ORyc3Yeg4MRYK3sTig= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; arc=none smtp.client-ip=160.30.148.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4dGZF317yBz6Fy6K; Wed, 26 Nov 2025 17:36:07 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.99.176]) by mse-fl2.zte.com.cn with SMTP id 5AQ9Znur087149; Wed, 26 Nov 2025 17:35:50 +0800 (+08) (envelope-from wang.yaxin@zte.com.cn) Received: from mapi (xaxapp02[null]) by mapi (Zmail) with MAPI id mid32; Wed, 26 Nov 2025 17:35:52 +0800 (CST) Date: Wed, 26 Nov 2025 17:35:52 +0800 (CST) X-Zmail-TransId: 2afa6926c9f8bf4-1e0f0 X-Mailer: Zmail v1.0 Message-ID: <20251126173552333XoJZN20143fWbsdTEtWoU@zte.com.cn> In-Reply-To: <20251126172445319I7DWJm-KEEuCmqtLupteE@zte.com.cn> References: 20251126172445319I7DWJm-KEEuCmqtLupteE@zte.com.cn Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 From: To: Cc: , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIHYyIDMvM10gZmdyYXBoOiBSZW1vdmUgY29hcnNlIFBJRCBmaWx0ZXJpbmcgZnJvbSBncmFwaF9lbnRyeSgp?= X-MAIL: mse-fl2.zte.com.cn 5AQ9Znur087149 X-TLS: YES X-SPF-DOMAIN: zte.com.cn X-ENVELOPE-SENDER: wang.yaxin@zte.com.cn X-SPF: None X-SOURCE-IP: 10.5.228.133 unknown Wed, 26 Nov 2025 17:36:07 +0800 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6926CA07.000/4dGZF317yBz6Fy6K Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Shengming Hu With PID filtering working via ftrace_pids_enabled() and fgraph_pid_func, the coarse-grained ftrace_trace_task() check in graph_entry() is obsolete. It was only a fallback for uninitialized op->private (now fixed), and its removal ensures consistent PID filtering with standard function tracing. Also remove unused ftrace_trace_task() definition from trace.h. Signed-off-by: Shengming Hu --- kernel/trace/trace.h | 9 --------- kernel/trace/trace_functions_graph.c | 3 --- 2 files changed, 12 deletions(-) diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 58be6d741..2bc985739 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -1159,11 +1159,6 @@ struct ftrace_func_command { char *params, int enable); }; extern bool ftrace_filter_param __initdata; -static inline int ftrace_trace_task(struct trace_array *tr) -{ - return this_cpu_read(tr->array_buffer.data->ftrace_ignore_pid) !=3D - FTRACE_PID_IGNORE; -} extern int ftrace_is_dead(void); int ftrace_create_function_files(struct trace_array *tr, struct dentry *parent); @@ -1181,10 +1176,6 @@ void ftrace_clear_pids(struct trace_array *tr); int init_function_trace(void); void ftrace_pid_follow_fork(struct trace_array *tr, bool enable); #else -static inline int ftrace_trace_task(struct trace_array *tr) -{ - return 1; -} static inline int ftrace_is_dead(void) { return 0; } static inline int ftrace_create_function_files(struct trace_array *tr, diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_func= tions_graph.c index 44d5dc503..cb9aef060 100644 --- a/kernel/trace/trace_functions_graph.c +++ b/kernel/trace/trace_functions_graph.c @@ -233,9 +233,6 @@ static int graph_entry(struct ftrace_graph_ent *trace, return 1; } - if (!ftrace_trace_task(tr)) - return 0; - if (ftrace_graph_ignore_func(gops, trace)) return 0; --=20 2.25.1