All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@redhat.com>
Cc: Dmitry Vyukov <dvyukov@google.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	jolsa@redhat.com, Namhyung Kim <namhyung@kernel.org>,
	luca abeni <luca.abeni@santannapisa.it>,
	syzkaller <syzkaller@googlegroups.com>
Subject: Re: [PATCH 2/2] signal: Better detection of synchronous signals
Date: Mon, 11 Feb 2019 18:01:39 -0600	[thread overview]
Message-ID: <87va1pj2n0.fsf@xmission.com> (raw)
In-Reply-To: <20190211151840.GB21430@redhat.com> (Oleg Nesterov's message of "Mon, 11 Feb 2019 16:18:40 +0100")

Oleg Nesterov <oleg@redhat.com> writes:

> Eric, I'll try to finally read the whole thread later, probably I missed
> something, but...
>
> On 02/07, Eric W. Biederman wrote:
>>
>> Recently syzkaller was able to create unkillablle processes by
>> creating a timer that is delivered as a thread local signal on SIGHUP,
>> and receiving SIGHUP SA_NODEFERER.  Ultimately causing a loop failing
>> to deliver SIGHUP but always trying.
>>
>> When the stack overflows delivery of SIGHUP fails and force_sigsegv is
>> called.  Unfortunately because SIGSEGV is numerically higher than
>> SIGHUP next_signal tries again to deliver a SIGHUP.
>
> Confused... In this particular case next_signal() should return SIGSEGV
> because it must be pending too and SYNCHRONOUS_MASK doesn't include SIGHUP.
>
> Not that it really matters, the timer can deliver another SYNCHRONOUS_MASK
> signal < SIGSEGV, just I am trying to understand what have I missed...

Bah. It was SIGBUS.  My brain kept thinking SIGHUP. My apologies this
mental error slipped into the patch description.

>> +	/*
>> +	 * Check if there is another siginfo for the same signal.
>> +	 */
>> +	list_for_each_entry_continue(q, &pending->list, list) {
>> +		if (q->info.si_signo == sync->info.si_signo)
>> +			goto still_pending;
>> +	}
>
> But this must not be possible? SYNCHRONOUS_MASK doesn't include real-time
> signals, we can't have 2 siginfo's for the same signal < SIGRTMIN.

Yes for that reason it should be safe to strip that logic out at the
moment.  I overlooked that when writing the code.

However.  I am not certain that is a limit we actually want to honor
with synchronous signals.  As it results in a louzy quality of
implementation.

We start with an instruction in the program being debugged.  In
principle before that instruction starts we know that no signals
are pending because they were not delivered to that process.

If we for some reason send signal A to the process and at the same time
hit a fault that is reported as signal A.  It is currently a race which
one wins.  I think we could legitimately say that the fault happened
before signal A was enqueued, and deliver both. It is a bit murkier if
signal A was blocked.

If we let the enqueued signal A win (as we do today) we have SA_SIGNFO
that is not useful for describing the fault the instruction generated.
Which is a really lousy quality of implementation.

Which is a long way of saying I think that hunk of code is useful as it
allows us the possibility of fixing a lousy quality of implementation in
our code today.

Eric

  reply	other threads:[~2019-02-12  0:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01 16:48 perf_event_open+clone = unkillable process Dmitry Vyukov
2019-02-01 17:06 ` Dmitry Vyukov
2019-02-02 18:30   ` Jiri Olsa
2019-02-03 15:21     ` Jiri Olsa
2019-02-04  9:27   ` Thomas Gleixner
2019-02-04  9:38     ` Dmitry Vyukov
2019-02-04 17:38       ` Thomas Gleixner
2019-02-05  3:00         ` Eric W. Biederman
2019-02-05  4:27           ` Eric W. Biederman
2019-02-05  6:07             ` Eric W. Biederman
2019-02-05 15:26               ` [RFC][PATCH] signal: Store pending signal exit in tsk.jobctl not in tsk.pending Eric W. Biederman
2019-02-06 12:09                 ` Dmitry Vyukov
2019-02-06 21:47                   ` Eric W. Biederman
2019-02-06 18:07                 ` Oleg Nesterov
2019-02-06 22:25                   ` Eric W. Biederman
2019-02-07  6:42                     ` [PATCH 0/2]: Fixing unkillable processes caused by SIGHUP timers Eric W. Biederman
2019-02-07  6:43                       ` [PATCH 1/2] signal: Always notice exiting tasks Eric W. Biederman
2019-02-11 14:13                         ` Oleg Nesterov
2019-02-12  0:42                           ` Eric W. Biederman
2019-02-12  8:18                             ` Eric W. Biederman
2019-02-12 16:50                               ` Oleg Nesterov
2019-02-13  3:58                                 ` Eric W. Biederman
2019-02-13  4:09                                 ` [PATCH] signal: Restore the stop PTRACE_EVENT_EXIT Eric W. Biederman
2019-02-13 13:55                                   ` Oleg Nesterov
2019-02-13 14:38                                   ` Oleg Nesterov
2019-02-13 14:58                                     ` Eric W. Biederman
2019-02-07  6:44                       ` [PATCH 2/2] signal: Better detection of synchronous signals Eric W. Biederman
2019-02-11 15:18                         ` Oleg Nesterov
2019-02-12  0:01                           ` Eric W. Biederman [this message]
2019-02-12 17:21                             ` Oleg Nesterov
2019-02-07 11:46                       ` [PATCH 0/2]: Fixing unkillable processes caused by SIGHUP timers Dmitry Vyukov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87va1pj2n0.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=dvyukov@google.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.abeni@santannapisa.it \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=syzkaller@googlegroups.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.