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:   Fri, 16 Oct 2020 12:54:16 +0200
From:   Oleg Nesterov <oleg@...hat.com>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     Jens Axboe <axboe@...nel.dk>, linux-kernel@...r.kernel.org,
        io-uring@...r.kernel.org, peterz@...radead.org
Subject: Re: [PATCH 4/5] x86: wire up TIF_NOTIFY_SIGNAL

On 10/16, Thomas Gleixner wrote:
>
> On Thu, Oct 15 2020 at 16:34, Oleg Nesterov wrote:
> > On 10/15, Thomas Gleixner wrote:
> >> Instead of adding this to every architectures signal magic, we can
> >> handle TIF_NOTIFY_SIGNAL in the core code:
> >>
> >> static void handle_singal_work(ti_work, regs)
> >> {
> >> 	if (ti_work & _TIF_NOTIFY_SIGNAL)
> >>         	tracehook_notify_signal();
> >>
> >>         arch_do_signal(ti_work, regs);
> >> }
> >>
> >>       loop {
> >>       		if (ti_work & (SIGPENDING | NOTIFY_SIGNAL))
> >>                 	handle_signal_work(ti_work, regs);
> >>       }
> >
> > To me this looks like unnecessary complication. We need to change
> > every architecture anyway, how can this helper help?
>
> This is about the generic entry code. For the users of that it makes
> absolutely no sense to have that in architecture code.
>
> Something which every architecture needs to do in the exactly same way
> goes into the common code. If not, you can spare the exercise of having
> common code in the first place.
>
> Also arch_do_signal() becomes a misnomer with this new magic.

Well, to me arch_do_signal() paths should handle the signal_pending() == T
case.

But I won't argue, this is subjective.

> static void handle_signal_work(ti_work, regs)
> {
> 	if (ti_work & _TIF_NOTIFY_SIGNAL)
>         	tracehook_notify_signal();
>
>         arch_do_signal_or_restart(ti_work, regs);
> }
>
> which makes it entirely clear what this is about.

In this case I'd prefer to pass the "(ti_work & _TIF_SIGPENDING)" boolen
to arch_do_signal_or_restart().

But again, I won't argue. And to remind, we do not really need to touch
arch_do_signal() at all. We can just add

	if (test_thread_flag(TIF_NOTIFY_SIGNAL))
		tracehook_notify_signal();

	if (!task_sigpending(current))
		return 0;

at the start of get_signal() and avoid the code duplication automatically.

Oleg.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ