From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-183.mta1.migadu.com (out-183.mta1.migadu.com [95.215.58.183]) (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 DE944367 for ; Mon, 14 Jul 2025 23:45:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.183 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752536732; cv=none; b=u5FE+CHNlIjS3j5SItsp0tAjlHnYSAbQDPc6FG8weleAviAg8b9I/1BK+JAHKHNAnT91YqHGxOHujoGfsseXgz+XiQgEj9Bvl2ILni0Mz7GBPECKMVYHEFO0jqtr8GeLXv20mPKDl0NHoSOlZoRZPDepdSz2kwvfBB6WaMSNtls= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752536732; c=relaxed/simple; bh=eDaeNRY9d4DwiLpiw4HbMVjhOvgL0gPYNvcfXP5EuFo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=aSDbEmNE/SmQAPbysLOwWgOnvvK+gNRQ+6Tof81mBZODD3TKkWB/TlH8YY3Ru5TX5TDDJoqPICRwm7+xH+hTVJQnr2qwnIQnisI3wEzLJkbZE3BN9xe5rH4DkeYohjcczFv4rImsUf3hYYCLxf+kUQ/7LTEO9ICPhYCsThK6bGw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=aQlHAg9r; arc=none smtp.client-ip=95.215.58.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="aQlHAg9r" Message-ID: <0027bec0-e10f-4c7d-9a56-1c9be7737f6a@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1752536717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pyc9wOVmB/LsVjlEChnyf4WH3KMKL1NswKuvQMdphAo=; b=aQlHAg9riapgF4KgIvqBT8t525wuLfg74cw/uwurQt71PCDpk7WxGLjK4b+qmAwQK7px5Z gaceNa5UK4jpS3B0iT9eZgY8YuDMyOsqhHt17QR9a2c3KLvecYyMvIfWZ1XVMpOchl9UMz 1fZz6nBUm29EaPXcAXD9F/tR6+c9jvI= Date: Tue, 15 Jul 2025 07:45:16 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next v2 06/18] bpf: tracing: add support to record and check the accessed args To: Andrii Nakryiko , Menglong Dong Cc: alexei.starovoitov@gmail.com, rostedt@goodmis.org, jolsa@kernel.org, bpf@vger.kernel.org, Menglong Dong , John Fastabend , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Simon Horman , linux-kernel@vger.kernel.org, netdev@vger.kernel.org References: <20250703121521.1874196-1-dongml2@chinatelecom.cn> <20250703121521.1874196-7-dongml2@chinatelecom.cn> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Menglong Dong In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 2025/7/15 06:07, Andrii Nakryiko wrote: > On Thu, Jul 3, 2025 at 5:20 AM Menglong Dong wrote: >> In this commit, we add the 'accessed_args' field to struct bpf_prog_aux, >> which is used to record the accessed index of the function args in >> btf_ctx_access(). > Do we need to bother giving access to arguments through direct ctx[i] > access for these multi-fentry/fexit programs? We have > bpf_get_func_arg_cnt() and bpf_get_func_arg() which can be used to get > any given argument at runtime. Hi Andrii. This commit is not for that purpose. We remember all the accessed args to bpf_prog_aux->accessed_args. And when we attach the tracing-multi prog to the kernel functions, we will check if the accessed arguments are consistent between all the target functions. The bpf_prog_aux->accessed_args will be used in https://lore.kernel.org/bpf/20250703121521.1874196-12-dongml2@chinatelecom.cn/ in bpf_tracing_check_multi() to do such checking. With such checking, the target functions don't need to have the same prototype, which makes tracing-multi more flexible. Thanks! Menglong Dong > >> Meanwhile, we add the function btf_check_func_part_match() to compare the >> accessed function args of two function prototype. This function will be >> used in the following commit. >> >> Signed-off-by: Menglong Dong >> --- >> include/linux/bpf.h | 4 ++ >> include/linux/btf.h | 3 +- >> kernel/bpf/btf.c | 108 +++++++++++++++++++++++++++++++++++++++++- >> net/sched/bpf_qdisc.c | 2 +- >> 4 files changed, 113 insertions(+), 4 deletions(-) >> > [...] >