linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf 1/3] selftests/bpf: Fix open-coded gettid syscall in uprobe syscall tests
@ 2025-10-01 12:22 Jiri Olsa
  2025-10-01 12:22 ` [PATCH bpf 2/3] selftests/bpf: Fix typo in subtest_basic_usdt after merge conflict Jiri Olsa
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jiri Olsa @ 2025-10-01 12:22 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, linux-perf-users, Martin KaFai Lau, Eduard Zingerman,
	Song Liu, Yonghong Song, John Fastabend, Hao Luo

Commit 0e2fb011a0ba ("selftests/bpf: Clean up open-coded gettid syscall
invocations") addressed the issue that older libc may not have a gettid()
function call wrapper for the associated syscall.

The uprobe syscall tests got in from tip tree, using sys_gettid in there.

Fixes: 0e2fb011a0ba ("selftests/bpf: Clean up open-coded gettid syscall invocations")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
index 6d75ede16e7c..955a37751b52 100644
--- a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
+++ b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
@@ -661,7 +661,7 @@ static void *worker_trigger(void *arg)
 		rounds++;
 	}
 
-	printf("tid %d trigger rounds: %lu\n", gettid(), rounds);
+	printf("tid %ld trigger rounds: %lu\n", sys_gettid(), rounds);
 	return NULL;
 }
 
@@ -704,7 +704,7 @@ static void *worker_attach(void *arg)
 		rounds++;
 	}
 
-	printf("tid %d attach rounds: %lu hits: %d\n", gettid(), rounds, skel->bss->executed);
+	printf("tid %ld attach rounds: %lu hits: %d\n", sys_gettid(), rounds, skel->bss->executed);
 	uprobe_syscall_executed__destroy(skel);
 	free(ref);
 	return NULL;
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH bpf 2/3] selftests/bpf: Fix typo in subtest_basic_usdt after merge conflict
  2025-10-01 12:22 [PATCH bpf 1/3] selftests/bpf: Fix open-coded gettid syscall in uprobe syscall tests Jiri Olsa
@ 2025-10-01 12:22 ` Jiri Olsa
  2025-10-01 12:22 ` [PATCH bpf 3/3] selftests/bpf: Fix realloc size in bpf_get_addrs Jiri Olsa
  2025-10-01 14:00 ` [PATCH bpf 1/3] selftests/bpf: Fix open-coded gettid syscall in uprobe syscall tests patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2025-10-01 12:22 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, linux-perf-users, Martin KaFai Lau, Eduard Zingerman,
	Song Liu, Yonghong Song, John Fastabend, Hao Luo

Use proper 'called' variable name.

Fixes: ae28ed4578e6 ("Merge tag 'bpf-next-6.18' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/testing/selftests/bpf/prog_tests/usdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/usdt.c b/tools/testing/selftests/bpf/prog_tests/usdt.c
index 4f7f45e69315..f4be5269fa90 100644
--- a/tools/testing/selftests/bpf/prog_tests/usdt.c
+++ b/tools/testing/selftests/bpf/prog_tests/usdt.c
@@ -142,7 +142,7 @@ static void subtest_basic_usdt(bool optimized)
 		goto cleanup;
 #endif
 
-	alled = TRIGGER(1);
+	called = TRIGGER(1);
 
 	ASSERT_EQ(bss->usdt0_called, called, "usdt0_called");
 	ASSERT_EQ(bss->usdt3_called, called, "usdt3_called");
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH bpf 3/3] selftests/bpf: Fix realloc size in bpf_get_addrs
  2025-10-01 12:22 [PATCH bpf 1/3] selftests/bpf: Fix open-coded gettid syscall in uprobe syscall tests Jiri Olsa
  2025-10-01 12:22 ` [PATCH bpf 2/3] selftests/bpf: Fix typo in subtest_basic_usdt after merge conflict Jiri Olsa
@ 2025-10-01 12:22 ` Jiri Olsa
  2025-10-01 14:00 ` [PATCH bpf 1/3] selftests/bpf: Fix open-coded gettid syscall in uprobe syscall tests patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2025-10-01 12:22 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko
  Cc: bpf, linux-perf-users, Martin KaFai Lau, Eduard Zingerman,
	Song Liu, Yonghong Song, John Fastabend, Hao Luo

We will segfault once we call realloc in bpf_get_addrs due to
wrong size argument.

Fixes: 6302bdeb91df ("selftests/bpf: Add a kprobe_multi subtest to use addrs instead of syms")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/testing/selftests/bpf/trace_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
index 171987627f3a..eeaab7013ca2 100644
--- a/tools/testing/selftests/bpf/trace_helpers.c
+++ b/tools/testing/selftests/bpf/trace_helpers.c
@@ -732,7 +732,7 @@ int bpf_get_addrs(unsigned long **addrsp, size_t *cntp, bool kernel)
 
 		if (cnt == max_cnt) {
 			max_cnt += inc_cnt;
-			tmp_addrs = realloc(addrs, max_cnt);
+			tmp_addrs = realloc(addrs, max_cnt * sizeof(long));
 			if (!tmp_addrs) {
 				err = -ENOMEM;
 				goto error;
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH bpf 1/3] selftests/bpf: Fix open-coded gettid syscall in uprobe syscall tests
  2025-10-01 12:22 [PATCH bpf 1/3] selftests/bpf: Fix open-coded gettid syscall in uprobe syscall tests Jiri Olsa
  2025-10-01 12:22 ` [PATCH bpf 2/3] selftests/bpf: Fix typo in subtest_basic_usdt after merge conflict Jiri Olsa
  2025-10-01 12:22 ` [PATCH bpf 3/3] selftests/bpf: Fix realloc size in bpf_get_addrs Jiri Olsa
@ 2025-10-01 14:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-10-01 14:00 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: ast, daniel, andrii, bpf, linux-perf-users, kafai, eddyz87,
	songliubraving, yhs, john.fastabend, haoluo

Hello:

This series was applied to bpf/bpf.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed,  1 Oct 2025 14:22:21 +0200 you wrote:
> Commit 0e2fb011a0ba ("selftests/bpf: Clean up open-coded gettid syscall
> invocations") addressed the issue that older libc may not have a gettid()
> function call wrapper for the associated syscall.
> 
> The uprobe syscall tests got in from tip tree, using sys_gettid in there.
> 
> Fixes: 0e2fb011a0ba ("selftests/bpf: Clean up open-coded gettid syscall invocations")
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> 
> [...]

Here is the summary with links:
  - [bpf,1/3] selftests/bpf: Fix open-coded gettid syscall in uprobe syscall tests
    https://git.kernel.org/bpf/bpf/c/716d7388d3e7
  - [bpf,2/3] selftests/bpf: Fix typo in subtest_basic_usdt after merge conflict
    https://git.kernel.org/bpf/bpf/c/a5f5869dc234
  - [bpf,3/3] selftests/bpf: Fix realloc size in bpf_get_addrs
    https://git.kernel.org/bpf/bpf/c/4b946f6bb7d6

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-10-01 14:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-01 12:22 [PATCH bpf 1/3] selftests/bpf: Fix open-coded gettid syscall in uprobe syscall tests Jiri Olsa
2025-10-01 12:22 ` [PATCH bpf 2/3] selftests/bpf: Fix typo in subtest_basic_usdt after merge conflict Jiri Olsa
2025-10-01 12:22 ` [PATCH bpf 3/3] selftests/bpf: Fix realloc size in bpf_get_addrs Jiri Olsa
2025-10-01 14:00 ` [PATCH bpf 1/3] selftests/bpf: Fix open-coded gettid syscall in uprobe syscall tests patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).