lkml.org 
[lkml]   [2022]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subjectio_uring truncating coredumps

    Subject updated to reflect the current discussion.

    > Linus Torvalds <torvalds@linux-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

    \
     
     \ /
      Last update: 2022-01-17 19:47    [W:4.195 / U:0.784 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site