From: sashiko-bot@kernel.org
To: "André Almeida" <andrealmeid@igalia.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v5 6/6] selftests: prctl: Add test for long thread names
Date: Thu, 27 Aug 2026 19:14:28 +0000 [thread overview]
Message-ID: <20260827191428.94F711F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260827-tonyk-long_name-v5-6-5fa843782a00@igalia.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Stack buffer overflow in selftest when reading long thread names.
- [Medium] Helper functions return negative error codes on prctl failures, but the test framework incorrectly evaluates these as success.
--
commit fe809367165b80380a7910f0d6bf3371b37e1de5
Author: André Almeida <andrealmeid@igalia.com>
selftests: prctl: Add test for long thread names
Add tests for the new interface to set and get long thread names. The
kernel should accept the LONG_NAME and returning it accordingly. For the
old PR_GET_NAME interface, the kernel should truncate the name up to 16
chars. /proc/<task>/comm should return the same string ad PR_GET_NAME.
> diff --git a/tools/testing/selftests/prctl/set-process-name.c b/tools/testing/selftests/prctl/set-process-name.c
> index 3f7b146d36dfe..951319d606561 100644
> --- a/tools/testing/selftests/prctl/set-process-name.c
> +++ b/tools/testing/selftests/prctl/set-process-name.c
[ ... ]
> @@ -82,6 +114,11 @@ TEST(rename_process) {
> EXPECT_GE(set_name(CHANGE_NAME), 0);
> EXPECT_TRUE(check_is_name_correct(CHANGE_NAME));
>
> + EXPECT_GE(set_ext_name(LONG_NAME), 0);
> + EXPECT_TRUE(check_is_ext_name_correct(LONG_NAME));
[Severity: Medium]
If prctl() fails in check_is_ext_name_correct(), it returns a negative error
code. Since EXPECT_TRUE() evaluates any non-zero value as true, won't this
cause the test to incorrectly pass on failure?
Should the helper function return 0 on failure, or should the test use
EXPECT_EQ(1, check_is_ext_name_correct(LONG_NAME)) instead?
> + EXPECT_TRUE(check_is_name_correct(LONG_NAME_CAP));
> + EXPECT_TRUE(check_name());
[Severity: Medium]
When this test runs, it calls check_name() while the thread name is set to a
33-character string.
If the kernel incorrectly fails to truncate the long process name when reading
/proc/self/task/.../comm, could this cause a stack buffer overflow?
tools/testing/selftests/prctl/set-process-name.c:check_name() {
char output[TASK_COMM_LEN] = {};
...
fscanf(fptr, "%s", output);
...
}
Since fscanf with "%s" is unbounded, a long name surfaced by the kernel will
overflow the 16-byte output buffer and crash the test. Should we add a width
limit like "%15s" to the fscanf call to prevent this?
> +
> EXPECT_GE(set_name(EMPTY_NAME), 0);
> EXPECT_TRUE(check_is_name_correct(EMPTY_NAME));
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260827-tonyk-long_name-v5-0-5fa843782a00@igalia.com?part=6
next prev parent reply other threads:[~2026-08-27 19:14 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 18:22 [PATCH v5 0/6] sched: Add support for long task name André Almeida
2026-08-27 18:23 ` [PATCH v5 1/6] treewide: Get rid of get_task_comm() André Almeida
2026-08-27 18:40 ` sashiko-bot
2026-08-27 18:23 ` [PATCH v5 2/6] treewide: Replace memcpy(..., current->comm) with copy_task_comm() André Almeida
2026-08-27 18:35 ` sashiko-bot
2026-08-27 18:23 ` [PATCH v5 3/6] lib/string_kunit: Add test for copy_task_comm() André Almeida
2026-08-27 18:47 ` sashiko-bot
2026-08-27 18:23 ` [PATCH v5 4/6] sched: Extend task command name with TASK_COMM_EXT_LEN André Almeida
2026-08-27 19:05 ` sashiko-bot
2026-08-27 18:23 ` [PATCH v5 5/6] prctl: Add support for long user thread names André Almeida
2026-08-27 19:08 ` sashiko-bot
2026-08-27 18:23 ` [PATCH v5 6/6] selftests: prctl: Add test for long " André Almeida
2026-08-27 19:14 ` sashiko-bot [this message]
2026-08-30 21:24 ` kernel test robot
2026-08-30 22:55 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260827191428.94F711F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=andrealmeid@igalia.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.