From nobody Sat Feb 7 07:10:29 2026 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02AA5346FBA for ; Wed, 17 Dec 2025 09:55:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765965306; cv=none; b=bhAsBv4BogHbhKPXFHV2zqqdbYQ4pzhkZFQGyzCl+ZV5Ur9tNhjROuD2KXVGI0NInwZKmfVAG0WEqaXMLBbNp405bgasyTiL5zafDFmuxYEfM2UIcRfGN5RdNMmyIYmmYPCdCHI4DTiGY14LgznhWfeAZ8wlzo5F+5jdvwbWs4U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765965306; c=relaxed/simple; bh=NZAPqHbVOTcwHPE6sn3Y0XChweULWb9wb/XUWjx76n4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=J1KjiXNPuUawKqVcwB+qAEgbckoOxRNceyWnuYmhe08FwCnHCJTHOUgxBUJlPaqu5MqsuTCZR1PCVfjvUzNlrWZQKXNarxH/6cdxbVUAAmB4bdmDQIA3EWIgPQQY9sNoUkmLKY4SiUJPlDP93XNkYa8Uc568d/KD1h0ETkXgxKI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HMPfopSh; arc=none smtp.client-ip=209.85.214.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HMPfopSh" Received: by mail-pl1-f193.google.com with SMTP id d9443c01a7336-2a0d5c365ceso43625815ad.3 for ; Wed, 17 Dec 2025 01:55:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765965302; x=1766570102; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TRTW3VF14hn+wwZuXpE8a7nEdyNYwGHHBVH+dg7799E=; b=HMPfopShjwNw1HHh1pyFgzjgkSbMiWTHFw2rO1DH1dzzq1PJ+Mzo2C8FHWC+xMOGP2 1RCiF4ccWrUyhbX4NxspYbH0LcQsey3cnj4ck+7BCPe+gNzIW3OFmIqAn6f8YlW0Ocu+ qZQNVh8XfuOk5+HhXW/6wXQyaXOsmYQ4y1Xxk3h4LgsoNVathaKG1oErm3oRWhatS3ZA jjz10AorecHPws6OBcLo1aZDrGZhYDkNl+dyPN+AB/Zl568ieWzlRYiulZyRzSKhJgXM EnpmLlXd3fZud55fC/lxqW8zD7Lrw9yZQnwHZH8oXezj73SLW/Nd+DlVsMI9xfRRWLY5 ivWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765965302; x=1766570102; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=TRTW3VF14hn+wwZuXpE8a7nEdyNYwGHHBVH+dg7799E=; b=RrULnKxlAzbwOh+hF+9eyMOCd3NLB71UdMlQPVTYCyGuyrVJmWHqWywwCq0d/l7fWa aQrFzJtFPRtPe3DSTA8OK7VWSq/Li+3D5ebLxWZWchMEiYaAZghH/ScgOC1DHbD3ySx4 FGEQ/SnwEHvONg+cQXnShudIhNh75cYxFzxHByBOyppqYekR3WDF9Ec809RtHIg0USBt bHBkn0HSlD9L5TXU+K932Z/arvc+6ELkQqZY/4OY3CTvyzWfjBibzvU28XXB/m+5ZUuU X8Kixv+Xw/rETTpmOT1aCzStVxt+elN//2ILapj01BhdCIGapzpqLQTAxm+iJ8ZglGqV rAzQ== X-Forwarded-Encrypted: i=1; AJvYcCUQfYioMiJAPKN0RtPLxPwgsNL2DYn3U1wnuQaCSNMN+EUirV7ttBTdDvfwEZZHF7fV1ByE9ORSveess6s=@vger.kernel.org X-Gm-Message-State: AOJu0YzG5kDdfANEVn3QxxDfitKHbavhuRe6ZlbxToznE1O3x/0HDq+3 WTCwQmyeg4235d3LJCogafNc5sVFMRRiraUEzr77bamn2/+BVFRs9sFL X-Gm-Gg: AY/fxX53WCcPgdNNaBSYUV8TOHAkv46fcxdoRoLskuw6Ez6j7gTV+0mhIVZd7d7TOl5 NuAgcgImzW1dDPqw25+oBr7VeRO6lu0fHRjImoQCWi1105RuTY5mUMGYVfA3sp0vGQuDi6leKvG fHrTRqNAat4E46PdCXkGxLbw+GMlhNpAf6MpF4WJMx/ZMRjeTSkHqun7wJ9n7r7FU7jiPSKWDjJ C0uieiA3ZszwRVVCTZ8kV/cLhLz6CcUw6WzkyribP9SiR1iuVh9bCfP684DrFxc5kvR5NHtGH86 6P8E/N9YfHymRhnSkQ5rKO9l4Ee7p8FWzg7m0t9+XM6VA3QPxHq4klshrVTUrkHQhMwmg6KD4CS fyyDvBxepNygyDdLcbB+DhIXCefKebC+p2igT5y7n3MSoHupSIZv568eGx+fj6yz2H42dPrv5Wh E1rDEU5+I= X-Google-Smtp-Source: AGHT+IEihOl4ItOzDP1E+DFQ+QN728xz6D3Ivh3seGrvpT7WobWr7xXB58/Hs5Edn/L7SVPsCc92tg== X-Received: by 2002:a17:903:2c9:b0:298:55c8:eb8d with SMTP id d9443c01a7336-29f23c7ba82mr191519725ad.35.1765965302096; Wed, 17 Dec 2025 01:55:02 -0800 (PST) Received: from 7940hx ([43.129.244.20]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a07fa0b1aasm140715945ad.3.2025.12.17.01.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Dec 2025 01:55:01 -0800 (PST) From: Menglong Dong X-Google-Original-From: Menglong Dong To: ast@kernel.org, andrii@kernel.org Cc: davem@davemloft.net, dsahern@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH bpf-next v4 1/9] bpf: add tracing session support Date: Wed, 17 Dec 2025 17:54:37 +0800 Message-ID: <20251217095445.218428-2-dongml2@chinatelecom.cn> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251217095445.218428-1-dongml2@chinatelecom.cn> References: <20251217095445.218428-1-dongml2@chinatelecom.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The tracing session is something that similar to kprobe session. It allow to attach a single BPF program to both the entry and the exit of the target functions. Introduce the struct bpf_fsession_link, which allows to add the link to both the fentry and fexit progs_hlist of the trampoline. Signed-off-by: Menglong Dong Co-developed-by: Leon Hwang Signed-off-by: Leon Hwang --- v4: - instead of adding a new hlist to progs_hlist in trampoline, add the bpf program to both the fentry hlist and the fexit hlist. --- include/linux/bpf.h | 20 +++++++++++ include/uapi/linux/bpf.h | 1 + kernel/bpf/btf.c | 2 ++ kernel/bpf/syscall.c | 18 +++++++++- kernel/bpf/trampoline.c | 36 +++++++++++++++---- kernel/bpf/verifier.c | 12 +++++-- net/bpf/test_run.c | 1 + net/core/bpf_sk_storage.c | 1 + tools/include/uapi/linux/bpf.h | 1 + .../bpf/prog_tests/tracing_failure.c | 2 +- 10 files changed, 83 insertions(+), 11 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 28d8d6b7bb1e..3b2273b110b8 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -1291,6 +1291,7 @@ enum bpf_tramp_prog_type { BPF_TRAMP_MODIFY_RETURN, BPF_TRAMP_MAX, BPF_TRAMP_REPLACE, /* more than MAX */ + BPF_TRAMP_SESSION, }; =20 struct bpf_tramp_image { @@ -1854,6 +1855,11 @@ struct bpf_tracing_link { struct bpf_prog *tgt_prog; }; =20 +struct bpf_fsession_link { + struct bpf_tracing_link link; + struct bpf_tramp_link fexit; +}; + struct bpf_raw_tp_link { struct bpf_link link; struct bpf_raw_event_map *btp; @@ -2114,6 +2120,20 @@ static inline void bpf_struct_ops_desc_release(struc= t bpf_struct_ops_desc *st_op =20 #endif =20 +static inline int bpf_fsession_cnt(struct bpf_tramp_links *links) +{ + struct bpf_tramp_links fentries =3D links[BPF_TRAMP_FENTRY]; + int cnt =3D 0; + + for (int i =3D 0; i < links[BPF_TRAMP_FENTRY].nr_links; i++) { + if (fentries.links[i]->link.prog->expected_attach_type =3D=3D + BPF_TRACE_SESSION) + cnt++; + } + + return cnt; +} + int bpf_prog_ctx_arg_info_init(struct bpf_prog *prog, const struct bpf_ctx_arg_aux *info, u32 cnt); =20 diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 84ced3ed2d21..696a7d37db0e 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -1145,6 +1145,7 @@ enum bpf_attach_type { BPF_NETKIT_PEER, BPF_TRACE_KPROBE_SESSION, BPF_TRACE_UPROBE_SESSION, + BPF_TRACE_SESSION, __MAX_BPF_ATTACH_TYPE }; =20 diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 0de8fc8a0e0b..2c1c3e0caff8 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -6107,6 +6107,7 @@ static int btf_validate_prog_ctx_type(struct bpf_veri= fier_log *log, const struct case BPF_TRACE_FENTRY: case BPF_TRACE_FEXIT: case BPF_MODIFY_RETURN: + case BPF_TRACE_SESSION: /* allow u64* as ctx */ if (btf_is_int(t) && t->size =3D=3D 8) return 0; @@ -6704,6 +6705,7 @@ bool btf_ctx_access(int off, int size, enum bpf_acces= s_type type, fallthrough; case BPF_LSM_CGROUP: case BPF_TRACE_FEXIT: + case BPF_TRACE_SESSION: /* When LSM programs are attached to void LSM hooks * they use FEXIT trampolines and when attached to * int LSM hooks, they use MODIFY_RETURN trampolines. diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 3080cc48bfc3..91c77f63261a 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -3579,6 +3579,7 @@ static int bpf_tracing_prog_attach(struct bpf_prog *p= rog, case BPF_PROG_TYPE_TRACING: if (prog->expected_attach_type !=3D BPF_TRACE_FENTRY && prog->expected_attach_type !=3D BPF_TRACE_FEXIT && + prog->expected_attach_type !=3D BPF_TRACE_SESSION && prog->expected_attach_type !=3D BPF_MODIFY_RETURN) { err =3D -EINVAL; goto out_put_prog; @@ -3628,7 +3629,21 @@ static int bpf_tracing_prog_attach(struct bpf_prog *= prog, key =3D bpf_trampoline_compute_key(tgt_prog, NULL, btf_id); } =20 - link =3D kzalloc(sizeof(*link), GFP_USER); + if (prog->expected_attach_type =3D=3D BPF_TRACE_SESSION) { + struct bpf_fsession_link *fslink; + + fslink =3D kzalloc(sizeof(*fslink), GFP_USER); + if (fslink) { + bpf_link_init(&fslink->fexit.link, BPF_LINK_TYPE_TRACING, + &bpf_tracing_link_lops, prog, attach_type); + fslink->fexit.cookie =3D bpf_cookie; + link =3D &fslink->link; + } else { + link =3D NULL; + } + } else { + link =3D kzalloc(sizeof(*link), GFP_USER); + } if (!link) { err =3D -ENOMEM; goto out_put_prog; @@ -4352,6 +4367,7 @@ attach_type_to_prog_type(enum bpf_attach_type attach_= type) case BPF_TRACE_RAW_TP: case BPF_TRACE_FENTRY: case BPF_TRACE_FEXIT: + case BPF_TRACE_SESSION: case BPF_MODIFY_RETURN: return BPF_PROG_TYPE_TRACING; case BPF_LSM_MAC: diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c index 976d89011b15..3b9fc99e1e89 100644 --- a/kernel/bpf/trampoline.c +++ b/kernel/bpf/trampoline.c @@ -111,7 +111,7 @@ bool bpf_prog_has_trampoline(const struct bpf_prog *pro= g) =20 return (ptype =3D=3D BPF_PROG_TYPE_TRACING && (eatype =3D=3D BPF_TRACE_FENTRY || eatype =3D=3D BPF_TRACE_FEXIT || - eatype =3D=3D BPF_MODIFY_RETURN)) || + eatype =3D=3D BPF_MODIFY_RETURN || eatype =3D=3D BPF_TRACE_SESSION)) || (ptype =3D=3D BPF_PROG_TYPE_LSM && eatype =3D=3D BPF_LSM_MAC); } =20 @@ -559,6 +559,8 @@ static enum bpf_tramp_prog_type bpf_attach_type_to_tram= p(struct bpf_prog *prog) return BPF_TRAMP_MODIFY_RETURN; case BPF_TRACE_FEXIT: return BPF_TRAMP_FEXIT; + case BPF_TRACE_SESSION: + return BPF_TRAMP_SESSION; case BPF_LSM_MAC: if (!prog->aux->attach_func_proto->type) /* The function returns void, we cannot modify its @@ -594,12 +596,13 @@ static int __bpf_trampoline_link_prog(struct bpf_tram= p_link *link, struct bpf_trampoline *tr, struct bpf_prog *tgt_prog) { - enum bpf_tramp_prog_type kind; - struct bpf_tramp_link *link_exiting; + enum bpf_tramp_prog_type kind, okind; + struct bpf_tramp_link *link_existing; + struct bpf_fsession_link *fslink; int err =3D 0; int cnt =3D 0, i; =20 - kind =3D bpf_attach_type_to_tramp(link->link.prog); + okind =3D kind =3D bpf_attach_type_to_tramp(link->link.prog); if (tr->extension_prog) /* cannot attach fentry/fexit if extension prog is attached. * cannot overwrite extension prog either. @@ -621,13 +624,18 @@ static int __bpf_trampoline_link_prog(struct bpf_tram= p_link *link, BPF_MOD_JUMP, NULL, link->link.prog->bpf_func); } + if (kind =3D=3D BPF_TRAMP_SESSION) { + /* deal with fsession as fentry by default */ + kind =3D BPF_TRAMP_FENTRY; + cnt++; + } if (cnt >=3D BPF_MAX_TRAMP_LINKS) return -E2BIG; if (!hlist_unhashed(&link->tramp_hlist)) /* prog already linked */ return -EBUSY; - hlist_for_each_entry(link_exiting, &tr->progs_hlist[kind], tramp_hlist) { - if (link_exiting->link.prog !=3D link->link.prog) + hlist_for_each_entry(link_existing, &tr->progs_hlist[kind], tramp_hlist) { + if (link_existing->link.prog !=3D link->link.prog) continue; /* prog already linked */ return -EBUSY; @@ -635,8 +643,18 @@ static int __bpf_trampoline_link_prog(struct bpf_tramp= _link *link, =20 hlist_add_head(&link->tramp_hlist, &tr->progs_hlist[kind]); tr->progs_cnt[kind]++; + if (okind =3D=3D BPF_TRAMP_SESSION) { + fslink =3D container_of(link, struct bpf_fsession_link, link.link); + hlist_add_head(&fslink->fexit.tramp_hlist, + &tr->progs_hlist[BPF_TRAMP_FEXIT]); + tr->progs_cnt[BPF_TRAMP_FEXIT]++; + } err =3D bpf_trampoline_update(tr, true /* lock_direct_mutex */); if (err) { + if (okind =3D=3D BPF_TRAMP_SESSION) { + hlist_del_init(&fslink->fexit.tramp_hlist); + tr->progs_cnt[BPF_TRAMP_FEXIT]--; + } hlist_del_init(&link->tramp_hlist); tr->progs_cnt[kind]--; } @@ -659,6 +677,7 @@ static int __bpf_trampoline_unlink_prog(struct bpf_tram= p_link *link, struct bpf_trampoline *tr, struct bpf_prog *tgt_prog) { + struct bpf_fsession_link *fslink; enum bpf_tramp_prog_type kind; int err; =20 @@ -672,6 +691,11 @@ static int __bpf_trampoline_unlink_prog(struct bpf_tra= mp_link *link, guard(mutex)(&tgt_prog->aux->ext_mutex); tgt_prog->aux->is_extended =3D false; return err; + } else if (kind =3D=3D BPF_TRAMP_SESSION) { + fslink =3D container_of(link, struct bpf_fsession_link, link.link); + hlist_del_init(&fslink->fexit.tramp_hlist); + tr->progs_cnt[BPF_TRAMP_FEXIT]--; + kind =3D BPF_TRAMP_FENTRY; } hlist_del_init(&link->tramp_hlist); tr->progs_cnt[kind]--; diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index a31c032b2dd6..d399bfd2413f 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -17402,6 +17402,7 @@ static int check_return_code(struct bpf_verifier_en= v *env, int regno, const char switch (env->prog->expected_attach_type) { case BPF_TRACE_FENTRY: case BPF_TRACE_FEXIT: + case BPF_TRACE_SESSION: range =3D retval_range(0, 0); break; case BPF_TRACE_RAW_TP: @@ -23298,6 +23299,7 @@ static int do_misc_fixups(struct bpf_verifier_env *= env) if (prog_type =3D=3D BPF_PROG_TYPE_TRACING && insn->imm =3D=3D BPF_FUNC_get_func_ret) { if (eatype =3D=3D BPF_TRACE_FEXIT || + eatype =3D=3D BPF_TRACE_SESSION || eatype =3D=3D BPF_MODIFY_RETURN) { /* Load nr_args from ctx - 8 */ insn_buf[0] =3D BPF_LDX_MEM(BPF_DW, BPF_REG_0, BPF_REG_1, -8); @@ -24242,7 +24244,8 @@ int bpf_check_attach_target(struct bpf_verifier_log= *log, if (tgt_prog->type =3D=3D BPF_PROG_TYPE_TRACING && prog_extension && (tgt_prog->expected_attach_type =3D=3D BPF_TRACE_FENTRY || - tgt_prog->expected_attach_type =3D=3D BPF_TRACE_FEXIT)) { + tgt_prog->expected_attach_type =3D=3D BPF_TRACE_FEXIT || + tgt_prog->expected_attach_type =3D=3D BPF_TRACE_SESSION)) { /* Program extensions can extend all program types * except fentry/fexit. The reason is the following. * The fentry/fexit programs are used for performance @@ -24257,7 +24260,7 @@ int bpf_check_attach_target(struct bpf_verifier_log= *log, * beyond reasonable stack size. Hence extending fentry * is not allowed. */ - bpf_log(log, "Cannot extend fentry/fexit\n"); + bpf_log(log, "Cannot extend fentry/fexit/session\n"); return -EINVAL; } } else { @@ -24341,6 +24344,7 @@ int bpf_check_attach_target(struct bpf_verifier_log= *log, case BPF_LSM_CGROUP: case BPF_TRACE_FENTRY: case BPF_TRACE_FEXIT: + case BPF_TRACE_SESSION: if (!btf_type_is_func(t)) { bpf_log(log, "attach_btf_id %u is not a function\n", btf_id); @@ -24507,6 +24511,7 @@ static bool can_be_sleepable(struct bpf_prog *prog) case BPF_TRACE_FEXIT: case BPF_MODIFY_RETURN: case BPF_TRACE_ITER: + case BPF_TRACE_SESSION: return true; default: return false; @@ -24588,9 +24593,10 @@ static int check_attach_btf_id(struct bpf_verifier= _env *env) tgt_info.tgt_name); return -EINVAL; } else if ((prog->expected_attach_type =3D=3D BPF_TRACE_FEXIT || + prog->expected_attach_type =3D=3D BPF_TRACE_SESSION || prog->expected_attach_type =3D=3D BPF_MODIFY_RETURN) && btf_id_set_contains(&noreturn_deny, btf_id)) { - verbose(env, "Attaching fexit/fmod_ret to __noreturn function '%s' is re= jected.\n", + verbose(env, "Attaching fexit/session/fmod_ret to __noreturn function '%= s' is rejected.\n", tgt_info.tgt_name); return -EINVAL; } diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c index 655efac6f133..ddec08b696de 100644 --- a/net/bpf/test_run.c +++ b/net/bpf/test_run.c @@ -685,6 +685,7 @@ int bpf_prog_test_run_tracing(struct bpf_prog *prog, switch (prog->expected_attach_type) { case BPF_TRACE_FENTRY: case BPF_TRACE_FEXIT: + case BPF_TRACE_SESSION: if (bpf_fentry_test1(1) !=3D 2 || bpf_fentry_test2(2, 3) !=3D 5 || bpf_fentry_test3(4, 5, 6) !=3D 15 || diff --git a/net/core/bpf_sk_storage.c b/net/core/bpf_sk_storage.c index 850dd736ccd1..afe28b558716 100644 --- a/net/core/bpf_sk_storage.c +++ b/net/core/bpf_sk_storage.c @@ -365,6 +365,7 @@ static bool bpf_sk_storage_tracing_allowed(const struct= bpf_prog *prog) return true; case BPF_TRACE_FENTRY: case BPF_TRACE_FEXIT: + case BPF_TRACE_SESSION: return !!strncmp(prog->aux->attach_func_name, "bpf_sk_storage", strlen("bpf_sk_storage")); default: diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 6b92b0847ec2..f0dec9f8f416 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -1145,6 +1145,7 @@ enum bpf_attach_type { BPF_NETKIT_PEER, BPF_TRACE_KPROBE_SESSION, BPF_TRACE_UPROBE_SESSION, + BPF_TRACE_SESSION, __MAX_BPF_ATTACH_TYPE }; =20 diff --git a/tools/testing/selftests/bpf/prog_tests/tracing_failure.c b/too= ls/testing/selftests/bpf/prog_tests/tracing_failure.c index 10e231965589..58b02552507d 100644 --- a/tools/testing/selftests/bpf/prog_tests/tracing_failure.c +++ b/tools/testing/selftests/bpf/prog_tests/tracing_failure.c @@ -73,7 +73,7 @@ static void test_tracing_deny(void) static void test_fexit_noreturns(void) { test_tracing_fail_prog("fexit_noreturns", - "Attaching fexit/fmod_ret to __noreturn function 'do_exit' is re= jected."); + "Attaching fexit/session/fmod_ret to __noreturn function 'do_exi= t' is rejected."); } =20 void test_tracing_failure(void) --=20 2.52.0