From: Vegard Nossum <vegard.nossum@oracle.com>
To: Kees Cook <kees@kernel.org>, Andrew Morton <akpm@linux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Allen Pais <apais@linux.microsoft.com>,
Roman Kisel <romank@linux.microsoft.com>,
Xiaoming Ni <nixiaoming@huawei.com>,
Vijay Nag <nagvijay@microsoft.com>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] coredump: Do not lock during 'comm' reporting
Date: Sun, 29 Sep 2024 20:42:24 +0200 [thread overview]
Message-ID: <463aeea5-c24d-41bd-888b-6e0911081aae@oracle.com> (raw)
In-Reply-To: <202409281449.B228D0C1E7@keescook>
On 28/09/2024 23:51, Kees Cook wrote:
> On Sat, Sep 28, 2024 at 02:46:36PM -0700, Andrew Morton wrote:
>> On Sat, 28 Sep 2024 14:39:45 -0700 Kees Cook <kees@kernel.org> wrote:
>>> On Sat, Sep 28, 2024 at 02:35:32PM -0700, Andrew Morton wrote:
>> So why does __get_task_comm() need to take task_lock()?
>
> That was to make sure we didn't end up with garbled results, but
> discussions have determined that we don't care:
> https://lore.kernel.org/all/20240828030321.20688-1-laoar.shao@gmail.com/
>
> But just for safety's sake, I'll change this memcpy to:
>
> memcpy_and_pad(comm, sizeof(comm), current->comm, sizeof(comm) - 1, 0);
>
Reverting Linus's revert, applying the patch in this thread, and then
changing it to that memcpy_and_pad above, everything seems to work well.
Tested-by: Vegard Nossum <vegard.nossum@oracle.com>
(However, I have not looked at the _safety_ of omitting task_lock()...)
I'm also wondering how I could successfully cat /proc/$pid/status before
on one of these hung processes given that it does __get_task_comm(),
which does task_lock(), which should have presumably hung as well?
Finally, I'll add that the comm/pid format is different from some other
messages:
kernel: coredump: 31447(entry-fuzz.1): coredump has not been created,
error -13
kernel: entry-fuzz.1[43396] bad frame in rt_sigreturn
frame:00000000e4ec200e ip:40a6712e sp:40c25f20 orax:f
Vegard
prev parent reply other threads:[~2024-09-29 18:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-28 21:08 Kees Cook
2024-09-28 21:35 ` Andrew Morton
2024-09-28 21:39 ` Kees Cook
2024-09-28 21:46 ` Andrew Morton
2024-09-28 21:51 ` Kees Cook
2024-09-29 18:42 ` Vegard Nossum [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=463aeea5-c24d-41bd-888b-6e0911081aae@oracle.com \
--to=vegard.nossum@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=apais@linux.microsoft.com \
--cc=ebiederm@xmission.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nagvijay@microsoft.com \
--cc=nixiaoming@huawei.com \
--cc=romank@linux.microsoft.com \
/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
all inboxes | Powered by JetHome®