Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "André Almeida" <andrealmeid@igalia.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v6 6/6] selftests: prctl: Add test for long thread names
Date: Thu, 10 Sep 2026 17:00:50 +0000	[thread overview]
Message-ID: <20260910170050.BC77D1F0089A@smtp.kernel.org> (raw)
In-Reply-To: <20260910-tonyk-long_name-v6-6-d70afbf194c5@igalia.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The `check_name()` function evaluates negative error codes as test successes due to `EXPECT_TRUE()` behavior.
- [Medium] The test fails rather than gracefully skipping on older kernels lacking `PR_SET_EXT_NAME` support.
--

commit 56060d6784146397018fe8a302145c26fb029757
Author: André Almeida <andrealmeid@igalia.com>
Subject: selftests: prctl: Add test for long thread names

This commit adds tests for setting and getting long thread names using
the new extended PR_SET_EXT_NAME and PR_GET_EXT_NAME prctl interfaces. It
also adjusts the check_is_name_correct() function to prevent negative error
codes from being evaluated as successes by EXPECT_TRUE().

> diff --git a/tools/testing/selftests/prctl/set-process-name.c b/tools/testing/selftests/prctl/set-process-name.c
> --- a/tools/testing/selftests/prctl/set-process-name.c
> +++ b/tools/testing/selftests/prctl/set-process-name.c
[ ... ]
> @@ -80,10 +118,15 @@ int check_name(void)
>  TEST(rename_process) {
>  
>  	EXPECT_GE(set_name(CHANGE_NAME), 0);
> -	EXPECT_TRUE(check_is_name_correct(CHANGE_NAME));
> +	EXPECT_FALSE(check_is_name_correct(CHANGE_NAME));
> +
> +	EXPECT_GE(set_ext_name(LONG_NAME), 0);

[Severity: Medium]
Will this test cause a failure rather than gracefully skipping on older
kernels?

If the test runs on a kernel where the PR_SET_EXT_NAME interface is
unsupported, set_ext_name() returns a negative error code like -EINVAL.
The EXPECT_GE assertion will fail the test entirely.

Should this test gracefully skip when run on kernels lacking support for
these new extensions?

> +	EXPECT_FALSE(check_is_ext_name_correct(LONG_NAME));
> +	EXPECT_FALSE(check_is_name_correct(LONG_NAME_CAP));
> +	EXPECT_TRUE(check_name());

[Severity: Medium]
Does this new test invocation suffer from the same logic error being fixed
in check_is_name_correct()?

The commit message explicitly mentions fixing check_is_name_correct() because
EXPECT_TRUE() evaluates negative error codes as success.

While the flawed logic in the check_name() function is a pre-existing issue,
it returns -EIO on file open failure and -errno on prctl failure:

tools/testing/selftests/prctl/set-process-name.c:check_name() {
    ...
    if (!fptr)
        return -EIO;
    ...
    if (res < 0)
        return -errno;
    ...
}

Since this patch introduces a new EXPECT_TRUE(check_name()) call here, won't
any file open or prctl failure be falsely evaluated as a test success? Could
we update check_name() as well to prevent this flaw from propagating?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260910-tonyk-long_name-v6-0-d70afbf194c5@igalia.com?part=6

      reply	other threads:[~2026-09-10 17:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 16:49 [PATCH v6 0/6] sched: Add support for long task name André Almeida
2026-09-10 16:49 ` [PATCH v6 1/6] treewide: Get rid of get_task_comm() André Almeida
2026-09-10 16:58   ` sashiko-bot
2026-09-10 16:49 ` [PATCH v6 2/6] treewide: Replace memcpy(..., current->comm) with copy_task_comm() André Almeida
2026-09-10 16:58   ` sashiko-bot
2026-09-10 16:49 ` [PATCH v6 3/6] lib/string_kunit: Add test for copy_task_comm() André Almeida
2026-09-10 16:49 ` [PATCH v6 4/6] sched: Extend task command name with TASK_COMM_EXT_LEN André Almeida
2026-09-10 16:49 ` [PATCH v6 5/6] prctl: Add support for long user thread names André Almeida
2026-09-10 17:12   ` sashiko-bot
2026-09-10 16:49 ` [PATCH v6 6/6] selftests: prctl: Add test for long " André Almeida
2026-09-10 17:00   ` sashiko-bot [this message]

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=20260910170050.BC77D1F0089A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox