lkml.org 
[lkml]   [2019]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] signal: remove the wrong signal_pending() check in restore_user_sigmask()
    Oleg Nesterov <oleg@redhat.com> wrote:
    > This is the minimal fix for stable, I'll send cleanups later.
    >
    > The commit 854a6ed56839a40f6b5d02a2962f48841482eec4 ("signal: Add
    > restore_user_sigmask()") introduced the visible change which breaks
    > user-space: a signal temporary unblocked by set_user_sigmask() can
    > be delivered even if the caller returns success or timeout.
    >
    > Change restore_user_sigmask() to accept the additional "interrupted"
    > argument which should be used instead of signal_pending() check, and
    > update the callers.
    >
    > Reported-by: Eric Wong <e@80x24.org>
    > Fixes: 854a6ed56839a40f6b5d02a2962f48841482eec4 ("signal: Add restore_user_sigmask()")
    > cc: stable@vger.kernel.org (v5.0+)
    > Signed-off-by: Oleg Nesterov <oleg@redhat.com>

    Thanks, for epoll_pwait on top of Linux v5.1.7 and cmogstored v1.7.0:

    Tested-by: Eric Wong <e@80x24.org>

    (cmogstored v1.7.1 already works around this when it sees a 0
    return value (but not >0, yet...))

    > diff --git a/fs/io_uring.c b/fs/io_uring.c
    > index 0fbb486..1147c5d 100644
    > --- a/fs/io_uring.c
    > +++ b/fs/io_uring.c
    > @@ -2201,11 +2201,12 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
    > }
    >
    > ret = wait_event_interruptible(ctx->wait, io_cqring_events(ring) >= min_events);
    > - if (ret == -ERESTARTSYS)
    > - ret = -EINTR;
    >
    > if (sig)
    > - restore_user_sigmask(sig, &sigsaved);
    > + restore_user_sigmask(sig, &sigsaved, ret == -ERESTARTSYS);
    > +
    > + if (ret == -ERESTARTSYS)
    > + ret = -EINTR;
    >
    > return READ_ONCE(ring->r.head) == READ_ONCE(ring->r.tail) ? ret : 0;
    > }

    That io_uring bit didn't apply cleanly to stable,
    since stable is missing fdb288a679cdf6a71f3c1ae6f348ba4dae742681
    ("io_uring: use wait_event_interruptible for cq_wait conditional wait")
    and related commits.

    In any case, I'm not using io_uring anywhere, yet (and probably
    won't, since I'll still need threads to deal with open/unlink/rename
    on slow JBOD HDDs).

    \
     
     \ /
      Last update: 2019-06-04 20:36    [W:4.067 / U:0.060 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site