From: sashiko-bot@kernel.org
To: "André Almeida" <andrealmeid@igalia.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v6 1/6] treewide: Get rid of get_task_comm()
Date: Thu, 10 Sep 2026 16:58:42 +0000 [thread overview]
Message-ID: <20260910165842.B4F961F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260910-tonyk-long_name-v6-1-d70afbf194c5@igalia.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Passing a pointer to `struct task_struct` instead of its `comm` field to `strscpy_pad()` leads to an incompatible pointer cast and a kernel memory info leak.
--
commit 90523a0d5e26d2bcb762f02d00c73857b4ad6c5d
Author: André Almeida <andrealmeid@igalia.com>
treewide: Get rid of get_task_comm()
This commit replaces calls to get_task_comm() with strscpy_pad() across the
tree. It aims to properly handle buffer padding and truncation depending on
buffer sizes.
Link: https://lore.kernel.org/lkml/CAHk-=wi5c=_-FBGo_88CowJd_F-Gi6Ud9d=TALm65ReN7YjrMw@mail.gmail.com/
[ ... ]
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index 8e88ac65fd7fc..0e1aa2bb4a7ca 100644
> --- a/security/smack/smack_lsm.c
> +++ b/security/smack/smack_lsm.c
> @@ -138,6 +138,8 @@ smk_bu_tsk_to_obj(struct task_struct *tsk, const struct task_smack *tsp,
> char acc[SMK_NUM_ACCESS_TYPE + 1];
> char comm[TASK_COMM_LEN];
>
> + strscpy_pad(comm, tsk);
[Severity: High]
Could this lead to a kernel memory info leak by passing the task_struct
pointer instead of the process name string?
strscpy_pad() expects a const char * as its second argument, but it receives
a struct task_struct * here instead of tsk->comm.
If this compiles (e.g., without -Werror), this copies up to 16 bytes starting
at the base of the task_struct into the comm buffer. When this buffer is
later printed via pr_info() during a Smack Bringup log, it dumps raw kernel
memory to dmesg, which could be leveraged to bypass KASLR or read sensitive
struct fields.
> +
> if (rc <= 0)
> return rc;
> if (rc > SMACK_UNCONFINED_OBJECT)
> @@ -147,7 +149,7 @@ smk_bu_tsk_to_obj(struct task_struct *tsk, const struct task_smack *tsp,
>
> pr_info("Smack %s: (%s %s %s) %s %s\n", smk_bu_mess[rc],
> smk_of_task(tsp)->smk_known, oskp->smk_known,
> - acc, get_task_comm(comm, tsk), note);
> + acc, comm, note);
> return 0;
> #else
> return rc;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910-tonyk-long_name-v6-0-d70afbf194c5@igalia.com?part=1
next prev parent reply other threads:[~2026-09-10 16:58 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 [this message]
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
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=20260910165842.B4F961F00893@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