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]
Message-ID: <87zhr1g7ls.fsf@xmission.com>
Date:   Mon, 11 Feb 2019 18:42:39 -0600
From:   ebiederm@...ssion.com (Eric W. Biederman)
To:     Oleg Nesterov <oleg@...hat.com>
Cc:     Dmitry Vyukov <dvyukov@...gle.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        jolsa@...hat.com, Namhyung Kim <namhyung@...nel.org>,
        luca abeni <luca.abeni@...tannapisa.it>,
        syzkaller <syzkaller@...glegroups.com>
Subject: Re: [PATCH 1/2] signal: Always notice exiting tasks

Oleg Nesterov <oleg@...hat.com> writes:

> sorry again for delay...
>
> On 02/07, Eric W. Biederman wrote:
>>
>> --- a/kernel/signal.c
>> +++ b/kernel/signal.c
>> @@ -2393,6 +2393,11 @@ bool get_signal(struct ksignal *ksig)
>>  		goto relock;
>>  	}
>>  
>> +	/* Has this task already been marked for death? */
>> +	ksig->info.si_signo = signr = SIGKILL;
>> +	if (signal_group_exit(signal))
>> +		goto fatal;
>> +
>>  	for (;;) {
>>  		struct k_sigaction *ka;
>>  
>> @@ -2488,6 +2493,7 @@ bool get_signal(struct ksignal *ksig)
>>  			continue;
>>  		}
>>  
>> +	fatal:
>>  		spin_unlock_irq(&sighand->siglock);
>
> Eric, but this is wrong. At least this is the serious user-visible
> change.
>
> Afaics, with this patch the tracee will never stop in PTRACE_EVENT_EXIT in case
> of group_exit/exec, because schedule() in TASK_TRACED state won't block due to
> __fatal_signal_pending().
>
> Yes, yes, as I said many times the semantics of PTRACE_EVENT_EXIT was never really
> defined, it depends on /dev/random, but still I don't think we should break it even
> more.

Well it changes PTRACE_EVENT_EXIT I grant that.  It looks like that
changes makes PTRACE_EVENT_EXIT is less than useful.

The only way to perfectly preserve the previous semantics is probably to
do something like my JOBCTL_TASK_EXIT proposal.

That said I don't think even adding a JOBCTL_TASK_EXIT is enough to have
a reliable stop of ptrace_event_exit after a process has exited.  As any
other pending signal can cause problems there as well.

I have received a report that strace -f in some cases is not noticing
children before they die and it looks like a stop in PTRACE_EVENT_EXIT
would fix that strace behavior.

Sigh.

Here I was trying for the simple minimal change and I hit this landmine.
Which leaves me with the question of what should be semantics of signal
handling after exit.

I think from dim memory of previous conversations the desired semantics
look like:
a) Ignore all signal state except for SIGKILL.
b) Letting SIGKILL wake up the process should be sufficient.

I will see if I can reproduce the strace failure and see if I can cook
up something minimal that addresses just that.  If you have suggestions
I would love to hear them.

As this was a minimal fix for SIGKILL being broken I have already sent
the fix to Linus.  So we are looking at an incremental fix at this point.

Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ