Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp341821lqb; Tue, 4 Jun 2024 13:05:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUX0yKwNQmnqykD2M/LawcRK+joR1WkcGQRxPviTxPMLd1p0Ad924vzZWAtrdTov+vn2gLS2+823YYNLK/l7GaUwwazgpukSZDFT9bgGA== X-Google-Smtp-Source: AGHT+IGY3qAWaC8sjHDruqUWWyCrHoReNueJM1JMNsBWLnWFrLNfl6SwtFbqV/hcizYqV7VWbggQ X-Received: by 2002:a67:be0d:0:b0:48a:2b40:ec77 with SMTP id ada2fe7eead31-48c04122ecemr894467137.8.1717531524450; Tue, 04 Jun 2024 13:05:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717531524; cv=pass; d=google.com; s=arc-20160816; b=ocdz7QxLuYRWMb0Xeq1E2zIMX6VHx0gIRalu1sDftm85rO2FaWkYw4vFhr/RaxzzXS /Fb8QTVTrerBBA/f44lneU1QjTrPbp2ZBA/iUfRRUmZof4seeEzP2FaSBeKRddFE8q3W 5HztydC8y5nSmtVyzQlp771HV1SLuqEKi0xfdDG/YJU46SklcpgWxD3rderTFiisojWY 0bSbmTGauuJcXuLu9NwW7kB67WFPeLZNHmkGJL0I+WFFAW9xuVYZRWwbOXWFkhxusVzr 4zvmdnjt/H/s/sXJ961OEJ4Df5OXIp46XD2kxK2ZEWzQwSvbq7FXsFxHkA1i1gJY1/Rs Mxzw== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+kgY8ONow9s7Z1qZKwTCHWJYDYCz4ub0KpydIJkbOes=; fh=u3to46i6vVc15/oqkgIGXd5IRsv1JvYq+fe7qFLhiF8=; b=jAkkAnnz/j8Tkch32jppdSu/6QFVqhl2GHw6qa5N9CqsHyrxYJlV/xw9EcMJ2LrfWT KlMBWSB0GkxfzI0uRuGdMFH4gwhKVRFrOuNZxei0fPKZf6/pcKfwWJ7mqzFL8tHA6L6e dqJVczsQx1bcZewDTBIYsWazaF8kUgCRpkl2gR7P87YgOUp+xpnIriRK5kLxMWOfwTvi l9iqxg5dNmzgu//wZpE831nWyAxvBcTqOqZPKDwfWUKLCcCh3byvvsNGLGW8kDfBhqGC NO8pNgCKnd6hzoRKh+ja+tKrW4NhILdK5m9wikTh/8ecalIpb2P06WUPTJSwdecaJcX4 k90A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="p/+697IZ"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201323-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. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ada2fe7eead31-48bec9c1b59si868507137.366.2024.06.04.13.05.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 13:05:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="p/+697IZ"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201323-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201323-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 2F35E1C22687 for ; Tue, 4 Jun 2024 20:05:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8DAA814D440; Tue, 4 Jun 2024 20:04:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p/+697IZ" 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 AFE6214C591; Tue, 4 Jun 2024 20:04:12 +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=1717531452; cv=none; b=skASpARdZ/hka4NBss1X8O7MCQUdYOhzmDLgPKCjejrphncDnx/q2CHGFHUf7zG49o5At22SZcuW+mf4FIk9iV4ePCyB2iBeKAe80ShRA9ZEp/pFrc2QzmE60f1CXSnuuU9efi17x70iAT3ea5dUroILp5pTuPBi/luwHWZuRWY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717531452; c=relaxed/simple; bh=Eyepo33ZgEJx5F82DIOiokqpWa7VYfHyqJCUfqfW9s4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TGQfO7WIscjK1MrMk6niQIkdtGZPvNeKiN87F8JKDQkTfAaBS2WiG64gJ5UDNbZoWlMpBpMljnS/uxLmfUzSpEYgxyTTw2qzXl3EhLNRqzhuu17dXIXkXdGpo3TvnVOi1p2Yxn+7gCFqEgPhhuDTVqtS5k/hp9YbhaV4FCSkOLk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p/+697IZ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5706AC2BBFC; Tue, 4 Jun 2024 20:04:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717531452; bh=Eyepo33ZgEJx5F82DIOiokqpWa7VYfHyqJCUfqfW9s4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p/+697IZS5yZlx4HkhHOFsu+OT/bcBT6vV/4RBLyz0iaGRrXJGZpr9qJUsPnnnI5m 5//PVnlh6+yuA5/wq5GGAL0oaiRaMYFZEYTzHyRw14Kng85lq4gVuIRpj+zre0UOsF ke//8s7g7KG4w7xLhfvdqXp6J72HK3pQ4za6MelrVWjau/LbK0MT3LpJDLgPlge6sv Rc5vt+I0fIsrYEkh9qWAi76inXpFKGlvBqM2P4vUwJuLjPDeckpFe0mQZis13Pa6z2 02qgRTkXk9g8IzYPGHs0Bgi2a2A4/E6Cjs3y7DfGpKQ1U8szk24d8qysZXNY8a3FiG Z/duCKPOhVGGg== 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 08/10] selftests/bpf: Add uprobe session errors test Date: Tue, 4 Jun 2024 22:02:19 +0200 Message-ID: <20240604200221.377848-9-jolsa@kernel.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240604200221.377848-1-jolsa@kernel.org> References: <20240604200221.377848-1-jolsa@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Adding uprobe session test to check that just single session instance is allowed or single uprobe. Signed-off-by: Jiri Olsa --- .../bpf/prog_tests/uprobe_multi_test.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c b/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c index fddca2597818..4bff681f0d7d 100644 --- a/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c +++ b/tools/testing/selftests/bpf/prog_tests/uprobe_multi_test.c @@ -533,6 +533,31 @@ static void test_session_skel_api(void) uprobe_multi_session__destroy(skel); } +static void test_session_error_multiple_instances(void) +{ + struct uprobe_multi_session *skel_1 = NULL, *skel_2 = NULL; + int err; + + skel_1 = uprobe_multi_session__open_and_load(); + if (!ASSERT_OK_PTR(skel_1, "fentry_raw_skel_load")) + goto cleanup; + + err = uprobe_multi_session__attach(skel_1); + if (!ASSERT_OK(err, " kprobe_multi_session__attach")) + goto cleanup; + + skel_2 = uprobe_multi_session__open_and_load(); + if (!ASSERT_OK_PTR(skel_2, "fentry_raw_skel_load")) + goto cleanup; + + err = uprobe_multi_session__attach(skel_2); + ASSERT_EQ(err, -EBUSY, " kprobe_multi_session__attach"); + +cleanup: + uprobe_multi_session__destroy(skel_1); + uprobe_multi_session__destroy(skel_2); +} + static void test_bench_attach_uprobe(void) { long attach_start_ns = 0, attach_end_ns = 0; @@ -623,4 +648,6 @@ void test_uprobe_multi_test(void) test_attach_api_fails(); if (test__start_subtest("session")) test_session_skel_api(); + if (test__start_subtest("session_errors")) + test_session_error_multiple_instances(); } -- 2.45.1