lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 6 Jun 2019 12:22:03 +0200
From:   Oleg Nesterov <oleg@...hat.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Deepa Dinamani <deepa.kernel@...il.com>,
        Linux List Kernel Mailing <linux-kernel@...r.kernel.org>,
        Arnd Bergmann <arnd@...db.de>,
        Davidlohr Bueso <dbueso@...e.de>, Jens Axboe <axboe@...nel.dk>,
        Davidlohr Bueso <dave@...olabs.net>, e@...24.org,
        Jason Baron <jbaron@...mai.com>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        linux-aio@...ck.org, omar.kilani@...il.com,
        Thomas Gleixner <tglx@...utronix.de>,
        stable <stable@...r.kernel.org>,
        Al Viro <viro@...iv.linux.org.uk>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        David Laight <David.Laight@...lab.com>
Subject: Re: [PATCH -mm 0/1] signal: simplify
 set_user_sigmask/restore_user_sigmask

On 06/05, Linus Torvalds wrote:
>
> On Wed, Jun 5, 2019 at 8:58 AM Oleg Nesterov <oleg@...hat.com> wrote:
> >
> > To simplify the review, please see the code with this patch applied.
> > I am using epoll_pwait() as an example because it looks very simple.
>
> I like it.
>
> However.
>
> I think I'd like it even more if we just said "we don't need
> restore_saved_sigmask AT ALL".
  ^^^^^^^^^^^^^^^^^^^^^

Did you mean restore_saved_sigmask_unless() introduced by this patch?

If yes:

> Which would be fairly easy to do with something like the attached...

I don't think so,

> --- a/arch/x86/entry/common.c
> +++ b/arch/x86/entry/common.c
> @@ -160,7 +160,7 @@ static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags)
>  			klp_update_patch_state(current);
>
>  		/* deal with pending signal delivery */
> -		if (cached_flags & _TIF_SIGPENDING)
> +		if (cached_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
>  			do_signal(regs);

...

> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -2877,6 +2877,7 @@ int set_user_sigmask(const sigset_t __user *usigmask, sigset_t *set,
>
>  	*oldset = current->blocked;
>  	set_current_blocked(set);
> +	set_thread_flag(TIF_RESTORE_SIGMASK);

This will re-introduce the problem fixed by the previous patch.

Yes, do_signal() does restore_saved_sigmask() at the end, but only if
get_signal() returns false.

This means that restore_saved_sigmask()->set_current_blocked(saved_mask) should
restore ->blocked (and may be clear TIF_SIGPENDING) before ret-from-syscall.

Or I misunderstood?

Oleg.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ