From: Pavel Begunkov <[email protected]>
To: Stefan Metzmacher <[email protected]>, Jens Axboe <[email protected]>,
[email protected]
Subject: Re: [PATCH v3 5/6] io-wq: warn about future set_task_comm() overflows.
Date: Sun, 25 Apr 2021 01:08:57 +0100 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <94254f497b59e7fda85503c643ec5a2e25a30c0d.1619306115.git.metze@samba.org>
On 4/25/21 12:26 AM, Stefan Metzmacher wrote:
> Signed-off-by: Stefan Metzmacher <[email protected]>
> ---
> fs/io-wq.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/fs/io-wq.c b/fs/io-wq.c
> index cd1af924c3d1..b80c5d905127 100644
> --- a/fs/io-wq.c
> +++ b/fs/io-wq.c
> @@ -640,7 +640,19 @@ static void create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index)
> return;
> }
>
> - snprintf(tsk_comm, sizeof(tsk_comm), "iou-wrk-%d", wq->task->pid);
> + /*
> + * The limit value of pid_max_max/PID_MAX_LIMIT
> + * is 4 * 1024 * 1024 = 4194304.
> + *
> + * TASK_COMM_LEN is 16, so we have 15 chars to fill.
> + *
> + * With "iou-wrk-4194304" we just fit into 15 chars.
> + * If that ever changes we may better add some special
> + * handling for PF_IO_WORKER in proc_task_name(), as that
> + * allows up to 63 chars.
> + */
> + WARN_ON(snprintf(tsk_comm, sizeof(tsk_comm),
> + "iou-wrk-%d", wq->task->pid) >= sizeof(tsk_comm));
We don't really care, so saner would be to just to leave them and don't
warn. Not see much need but can be something like "iou-wrk-00000*" if
overflowed. Same for 6/6.
> set_task_comm(tsk, tsk_comm);
>
> tsk->pf_io_worker = worker;
>
--
Pavel Begunkov
next prev parent reply other threads:[~2021-04-25 0:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-24 23:26 [PATCH v3 0/6] Complete setup before calling wake_up_new_task() Stefan Metzmacher
2021-04-24 23:26 ` [PATCH v3 1/6] kernel: always initialize task->pf_io_worker to NULL Stefan Metzmacher
2021-04-24 23:26 ` [PATCH v3 2/6] io_uring: io_sq_thread() no longer needs to reset current->pf_io_worker Stefan Metzmacher
2021-04-24 23:26 ` [PATCH v3 3/6] io-wq: call set_task_comm() before wake_up_new_task() Stefan Metzmacher
2021-04-24 23:26 ` [PATCH v3 4/6] io_uring: complete sq_thread setup before calling wake_up_new_task() Stefan Metzmacher
2021-04-24 23:26 ` [PATCH v3 5/6] io-wq: warn about future set_task_comm() overflows Stefan Metzmacher
2021-04-25 0:08 ` Pavel Begunkov [this message]
2021-04-24 23:26 ` [PATCH v3 6/6] io_uring: " Stefan Metzmacher
2021-04-25 16:28 ` [PATCH v3 0/6] Complete setup before calling wake_up_new_task() Jens Axboe
2021-04-26 16:01 ` Stefan Metzmacher
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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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