2015-11-30 16:21:20

by Sasha Levin

[permalink] [raw]
Subject: WARNING: CPU: 12 PID: 16862 at ./arch/x86/include/asm/thread_info.h:236

Hi all,

I've hit the following while fuzzing with trinity on the latest -next kernel:

[ 587.536319] WARNING: CPU: 12 PID: 16862 at ./arch/x86/include/asm/thread_info.h:236 sigsuspend+0x194/0x1b0()
[ 587.540863] Modules linked in:
[ 587.541742] CPU: 12 PID: 16862 Comm: trinity-c421 Not tainted 4.4.0-rc2-next-20151127-sasha-00011-g1ca161c-dirty #2660
[ 587.543554] 0000000000000000 000000002c914859 ffff8806e3347e38 ffffffff9ea923db
[ 587.545672] 0000000000000000 ffff8800c8032000 ffffffffa64a5120 ffff8806e3347e78
[ 587.547042] ffffffff9d2e00d9 ffffffff9d307334 ffffffffa64a5120 00000000000000ec
[ 587.549585] Call Trace:
[ 587.550261] [<ffffffff9ea923db>] dump_stack+0x72/0xb7
[ 587.551125] [<ffffffff9d2e00d9>] warn_slowpath_common+0x109/0x130
[ 587.553088] [<ffffffff9d2e0329>] warn_slowpath_null+0x29/0x30
[ 587.554164] [<ffffffff9d307334>] sigsuspend+0x194/0x1b0
[ 587.555116] [<ffffffff9d30b47b>] SyS_rt_sigsuspend+0xbb/0x110
[ 587.561511] [<ffffffffa61fbbd5>] entry_SYSCALL_64_fastpath+0x35/0x99
[ 587.563289] ---[ end trace 76d0b7c8c18c2a7d ]---


Thanks,
Sasha


2015-11-30 16:44:11

by Al Viro

[permalink] [raw]
Subject: Re: WARNING: CPU: 12 PID: 16862 at ./arch/x86/include/asm/thread_info.h:236

On Mon, Nov 30, 2015 at 11:20:44AM -0500, Sasha Levin wrote:
> Hi all,
>
> I've hit the following while fuzzing with trinity on the latest -next kernel:

__set_current_state(TASK_INTERRUPTIBLE);
schedule();
set_restore_sigmask();

somehow got out of schedule() without TIF_SIGPENDING being set...

2015-11-30 16:52:48

by Peter Zijlstra

[permalink] [raw]
Subject: Re: WARNING: CPU: 12 PID: 16862 at ./arch/x86/include/asm/thread_info.h:236

On Mon, Nov 30, 2015 at 04:44:05PM +0000, Al Viro wrote:
> On Mon, Nov 30, 2015 at 11:20:44AM -0500, Sasha Levin wrote:
> > Hi all,
> >
> > I've hit the following while fuzzing with trinity on the latest -next kernel:
>
> __set_current_state(TASK_INTERRUPTIBLE);
> schedule();
> set_restore_sigmask();
>
> somehow got out of schedule() without TIF_SIGPENDING being set...

A random wakeup (which are always possible) can make that happen, right?

I'm (as always) a little vague on signals, but who is responsible for
setting that bit?

2015-11-30 18:47:29

by Oleg Nesterov

[permalink] [raw]
Subject: Re: WARNING: CPU: 12 PID: 16862 at ./arch/x86/include/asm/thread_info.h:236

On 11/30, Peter Zijlstra wrote:
>
> On Mon, Nov 30, 2015 at 04:44:05PM +0000, Al Viro wrote:
> > On Mon, Nov 30, 2015 at 11:20:44AM -0500, Sasha Levin wrote:
> > > Hi all,
> > >
> > > I've hit the following while fuzzing with trinity on the latest -next kernel:
> >
> > __set_current_state(TASK_INTERRUPTIBLE);
> > schedule();
> > set_restore_sigmask();
> >
> > somehow got out of schedule() without TIF_SIGPENDING being set...
>
> A random wakeup (which are always possible) can make that happen, right?

Yes, sigsuspend() should do "while (!signal_pending(current))". Like
sys_pause() does, -ERESTARTNOHAND without signal_pending() is equally
wrong.

I'll send the fix unless Sasha wants to do this.

> I'm (as always) a little vague on signals, but who is responsible for
> setting that bit?

See above, TS_RESTORE_SIGMASK doesn't differ from -ERESTART* in that
you can only use it if signal_pending() is true.

Oleg.