[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <be3a3bd5-0991-480e-8190-010faa5b4727@kernel.dk>
Date: Sun, 1 Dec 2024 14:49:47 -0700
From: Jens Axboe <axboe@...nel.dk>
To: Kees Cook <kees@...nel.org>, Eric Biederman <ebiederm@...ssion.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>,
Mel Gorman <mgorman@...e.de>, Valentin Schneider <vschneid@...hat.com>,
Pavel Begunkov <asml.silence@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, Chen Yu <yu.c.chen@...el.com>,
Shuah Khan <skhan@...uxfoundation.org>, Mickaël Salaün
<mic@...ikod.net>, linux-kernel@...r.kernel.org, io-uring@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] exec: Make sure task->comm is always NUL-terminated
On 11/29/24 9:49 PM, Kees Cook wrote:
> Using strscpy() meant that the final character in task->comm may be
> non-NUL for a moment before the "string too long" truncation happens.
>
> Instead of adding a new use of the ambiguous strncpy(), we'd want to
> use memtostr_pad() which enforces being able to check at compile time
> that sizes are sensible, but this requires being able to see string
> buffer lengths. Instead of trying to inline __set_task_comm() (which
> needs to call trace and perf functions), just open-code it. But to
> make sure we're always safe, add compile-time checking like we already
> do for get_task_comm().
In terms of the io_uring changes, both of those looks fine to me. Feel
free to bundle it with something else. If you're still changing things,
then I do prefer = { }; rather than no space...
--
Jens Axboe
Powered by blists - more mailing lists