[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v8yi8ajr.fsf_-_@email.froward.int.ebiederm.org>
Date: Mon, 17 Jan 2022 12:46:48 -0600
From: "Eric W. Biederman" <ebiederm@...ssion.com>
To: Olivier Langlois <olivier@...llion01.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Heiko Carstens <hca@...ux.ibm.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"<linux-arch@...r.kernel.org>" <linux-arch@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>,
Alexey Gladkov <legion@...nel.org>,
Kyle Huey <me@...ehuey.com>, Oleg Nesterov <oleg@...hat.com>,
Kees Cook <keescook@...omium.org>,
Al Viro <viro@...iv.linux.org.uk>,
Jens Axboe <axboe@...nel.dk>,
Pavel Begunkov <asml.silence@...il.com>
Subject: io_uring truncating coredumps
Subject updated to reflect the current discussion.
> Linus Torvalds <torvalds@...ux-foundation.org> writes:
> But I really think it's wrong.
>
> You're trying to work around a problem the wrong way around. If a task
> is dead, and is dumping core, then signals just shouldn't matter in
> the first place, and thus the whole "TASK_INTERRUPTIBLE vs
> TASK_UNINTERRUPTIBLE" really shouldn't be an issue. The fact that it
> is an issue means there's something wrong in signaling, not in the
> pipe code.
>
> So I really think that's where the fix should be - on the signal delivery side.
Thinking about it from the perspective of not delivering the wake-ups
fixing io_uring and coredumps in a non-hacky way looks comparatively
simple. The function task_work_add just needs to not wake anything up
after a process has started dying.
Something like the patch below.
The only tricky part I can see is making certain there are not any races
between task_work_add and do_coredump depending on task_work_add not
causing signal_pending to return true.
diff --git a/kernel/task_work.c b/kernel/task_work.c
index fad745c59234..5f941e377268 100644
--- a/kernel/task_work.c
+++ b/kernel/task_work.c
@@ -44,6 +44,9 @@ int task_work_add(struct task_struct *task, struct callback_head *work,
work->next = head;
} while (cmpxchg(&task->task_works, head, work) != head);
+ if (notify && (task->signal->flags & SIGNAL_GROUP_EXIT))
+ return 0;
+
switch (notify) {
case TWA_NONE:
break;
Eric
Powered by blists - more mailing lists