Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp339898lqb; Tue, 4 Jun 2024 13:02:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWdR0D+V/8swQB/8K7uf4CWV6KsLp1bol2uyfraBaPThehyTCLrQ1c7ySpeh9q00nNmXrZ9k2T0GhdhFwwV8d8Ig0a7l7Ki7GjYGjG+DA== X-Google-Smtp-Source: AGHT+IGjZyK4hX9/Y5fCBmKqrtCJ3ncR7MtOtievA/dC5Tu0zmyeqeMfMMdd8FlNAuAigMIHiFBN X-Received: by 2002:a05:622a:44d:b0:43e:404a:890c with SMTP id d75a77b69052e-4402b619c97mr3806471cf.19.1717531361897; Tue, 04 Jun 2024 13:02:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717531361; cv=pass; d=google.com; s=arc-20160816; b=lv+BwY4FRqPLDmyqoZeT7N/CowBYxfw3zX/DLyVq/x79eUDAOIr/7eETnuESznOoCA vc6VMGeefzsxyhN8rNloaKwEPEEArJ0Y0lt1ljHBMu9LExdu6P2esHv0PFrk78QVDWhf uf5fkh1ZCStqhTeF2z9Ft0E+mB5B91mDvhgZV8ZiZ9PUu4H2fzy72N2+VJs0jI51rkie xD6CKYkMvMA5nukJpIAojdPjLQA3WUfM8EIpjsZmB2JWofi1WDy3SQZ7sgsyBxQbd2WU JS4d9pMVyrGsTaaAx6tQNWp86Rc+E1yfXzWgftpGhkp/JVkJGq5FzkbheWKaFa2HUtb8 Q4bA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=t1Q+AY5uM5i+iAC5QSzB5mAMX+VCbxYvCdTbT9ZNUN4=; fh=u3to46i6vVc15/oqkgIGXd5IRsv1JvYq+fe7qFLhiF8=; b=gIS5Ua8php2HebyHRMcFNOP0Sv8lYfWZJ6xW6I/l+5GUJr/PHyHJiRlf4RIuPtfe39 bXVmh+Trtye9QCHaSb83DAf6deHNOrFexmz5KOerWHnv09M4WX3DfIMuYp+c2LCPi62q 2CdQygp5DrVDX9Lt+H9zlWH8DKrY6bxZY1G1Hn4Mlf4/a3Q2vXKhXyf8+t9L3WnesJsy 8igp+q6eiBZsfN/SxUPD1Q+HqVsocsWdT+2OFSgqZipkko9SzlPk7mLS6O3Tsn+LLFtW eqCOZgNQXzh0jVGuACQ6UeahVVT8GGa9zNhylaqpY6vpg0ChYWpHSZGErDrolqki43U2 ETQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P2hvvJec; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201313-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201313-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794f318a61dsi1183399885a.494.2024.06.04.13.02.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 13:02:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201313-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P2hvvJec; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201313-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201313-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9F9A31C2184C for ; Tue, 4 Jun 2024 20:02:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0697814B07D; Tue, 4 Jun 2024 20:02:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="P2hvvJec" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2934A2F25; Tue, 4 Jun 2024 20:02:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717531353; cv=none; b=mQqHeyP1hB33Dbcq4JjuxviC5sBKvF79zwZPf/v4x6WAgHF+6Olr9hTo47tFoc/lTMN4UaXDjLkzDHxEHQPVSS34EMuxhIG6JNT4XFyYgSMQHhR6dgHFEYah/N8q9KYfQUO6Cc4JZOFlJQ1Sl5VIjh1uRsFZ3qhHNRb6SXx/Ajs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717531353; c=relaxed/simple; bh=C03j361njVg4JXjPqtmUFvHRfGoTtT0HMO6MWEnBjD4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=nNFjkpocRdVty6MDatZwDBUnqyCGV5bOG5cfdoOFp8UZ02JQj7pEYHiNK434atXOmzxQabTa2GOryijkX0uNUdD4WHv486gDMfh7hDH2x56yyuCaHeLdtuL+bFhyoj4/tHrmxWbEVJsEskottoyJoNsVUtEyqNHREZ3APrLTF+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=P2hvvJec; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69386C2BBFC; Tue, 4 Jun 2024 20:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717531352; bh=C03j361njVg4JXjPqtmUFvHRfGoTtT0HMO6MWEnBjD4=; h=From:To:Cc:Subject:Date:From; b=P2hvvJec59HIjb+GZyxy03zJn2BlxDfq6sbLaCZ5Atpi+j8EaeOZncwNmzFYiywbo UnY8pTupbLpVXDtgOdiTkJDW1qxltXliyK8NwWwHQ+2SGzs0RsHxK5ioCZfNBhR6EZ FiDYoNth9CCsfdZEH8y/r0YnlUyKmo6uu7cy4WKlHEuO9iI3qO4gc7GpP2rvPX88vR T9k1onrmgU2tyWhvQGFzifD1Wgn0wTunq3SxdYstSbHpIuJBq4RbwhXg5Hg5zJStnN fRg+e5GH6yl4gGyp4VsMQ5KIFdnKA3yHUgjzmdv0ouA1DzkusDpFcfHrIXEdltP0JJ Yd8U9vnJp2d6w== From: Jiri Olsa To: Oleg Nesterov , Peter Zijlstra , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: bpf@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Steven Rostedt , Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: [RFC bpf-next 00/10] uprobe, bpf: Add session support Date: Tue, 4 Jun 2024 22:02:11 +0200 Message-ID: <20240604200221.377848-1-jolsa@kernel.org> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit hi, this patchset is adding support for session uprobe attachment and using it through bpf link for bpf programs. The session means that the uprobe consumer is executed on entry and return of probed function with additional control: - entry callback can control execution of the return callback - entry and return callbacks can share data/cookie On more details please see patch #1. thanks, jirka --- Jiri Olsa (10): uprobe: Add session callbacks to uprobe_consumer bpf: Add support for uprobe multi session attach bpf: Add support for uprobe multi session context libbpf: Add support for uprobe multi session attach libbpf: Add uprobe session attach type names to attach_type_name selftests/bpf: Move ARRAY_SIZE to bpf_misc.h selftests/bpf: Add uprobe session test selftests/bpf: Add uprobe session errors test selftests/bpf: Add uprobe session cookie test selftests/bpf: Add uprobe session recursive test include/linux/uprobes.h | 18 ++++++++++ include/uapi/linux/bpf.h | 1 + kernel/bpf/syscall.c | 9 +++-- kernel/events/uprobes.c | 69 +++++++++++++++++++++++++++++++++----- kernel/trace/bpf_trace.c | 72 +++++++++++++++++++++++++++++++--------- tools/include/uapi/linux/bpf.h | 1 + tools/lib/bpf/bpf.c | 1 + tools/lib/bpf/libbpf.c | 51 ++++++++++++++++++++++++++-- tools/lib/bpf/libbpf.h | 4 ++- tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/testing/selftests/bpf/progs/bpf_misc.h | 2 ++ tools/testing/selftests/bpf/progs/iters.c | 2 -- tools/testing/selftests/bpf/progs/kprobe_multi_session.c | 3 +- tools/testing/selftests/bpf/progs/linked_list.c | 5 +-- tools/testing/selftests/bpf/progs/netif_receive_skb.c | 5 +-- tools/testing/selftests/bpf/progs/profiler.inc.h | 5 +-- tools/testing/selftests/bpf/progs/setget_sockopt.c | 5 +-- tools/testing/selftests/bpf/progs/test_bpf_ma.c | 4 --- tools/testing/selftests/bpf/progs/test_sysctl_loop1.c | 5 +-- tools/testing/selftests/bpf/progs/test_sysctl_loop2.c | 5 +-- tools/testing/selftests/bpf/progs/test_sysctl_prog.c | 5 +-- tools/testing/selftests/bpf/progs/test_tcp_custom_syncookie.c | 1 + tools/testing/selftests/bpf/progs/test_tcp_custom_syncookie.h | 2 -- tools/testing/selftests/bpf/progs/uprobe_multi_session.c | 52 +++++++++++++++++++++++++++++ tools/testing/selftests/bpf/progs/uprobe_multi_session_cookie.c | 50 ++++++++++++++++++++++++++++ tools/testing/selftests/bpf/progs/uprobe_multi_session_recursive.c | 44 ++++++++++++++++++++++++ tools/testing/selftests/bpf/progs/verifier_subprog_precision.c | 2 -- 27 files changed, 507 insertions(+), 69 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_session.c create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_session_cookie.c create mode 100644 tools/testing/selftests/bpf/progs/uprobe_multi_session_recursive.c