Re: WARNING in ptrace_stop

2020-07-23 Thread Oleg Nesterov
On 07/23, syzbot wrote:
>
> do not call blocking ops when !TASK_RUNNING; state=8 set at 
> [<076362f5>] ptrace_stop+0x0/0x9e0 kernel/signal.c:2054
> WARNING: CPU: 1 PID: 17054 at kernel/sched/core.c:6883 
> __might_sleep+0x135/0x190 kernel/sched/core.c:6883

#syz fix: sched: Fix race against ptrace_freeze_trace()



WARNING in ptrace_stop

2020-07-23 Thread syzbot
Hello,

syzbot found the following issue on:

HEAD commit:92188b41 Merge tag 'perf-tools-fixes-2020-07-19' of git://..
git tree:   upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=173963eb10
kernel config:  https://syzkaller.appspot.com/x/.config?x=a160d1053fc89af5
dashboard link: https://syzkaller.appspot.com/bug?extid=e7a125aff38791d8cb65
compiler:   gcc (GCC) 10.1.0-syz 20200507
syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=178d601710
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1688add710

The issue was bisected to:

commit dbfb089d360b1cc623c51a2c7cf9b99eff78e0e7
Author: Peter Zijlstra 
Date:   Fri Jul 3 10:40:33 2020 +

sched: Fix loadavg accounting race

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=14e3af6f10
final oops: https://syzkaller.appspot.com/x/report.txt?x=16e3af6f10
console output: https://syzkaller.appspot.com/x/log.txt?x=12e3af6f10

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+e7a125aff38791d8c...@syzkaller.appspotmail.com
Fixes: dbfb089d360b ("sched: Fix loadavg accounting race")

[ cut here ]
do not call blocking ops when !TASK_RUNNING; state=8 set at 
[<076362f5>] ptrace_stop+0x0/0x9e0 kernel/signal.c:2054
WARNING: CPU: 1 PID: 17054 at kernel/sched/core.c:6883 
__might_sleep+0x135/0x190 kernel/sched/core.c:6883
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 17054 Comm: syz-executor692 Not tainted 5.8.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 
01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18f/0x20d lib/dump_stack.c:118
 panic+0x2e3/0x75c kernel/panic.c:231
 __warn.cold+0x20/0x45 kernel/panic.c:600
 report_bug+0x1bd/0x210 lib/bug.c:198
 handle_bug+0x38/0x90 arch/x86/kernel/traps.c:235
 exc_invalid_op+0x13/0x40 arch/x86/kernel/traps.c:255
 asm_exc_invalid_op+0x12/0x20 arch/x86/include/asm/idtentry.h:540
RIP: 0010:__might_sleep+0x135/0x190 kernel/sched/core.c:6883
Code: 65 48 8b 1c 25 00 ff 01 00 48 8d 7b 10 48 89 fe 48 c1 ee 03 80 3c 06 00 
75 2b 48 8b 73 10 48 c7 c7 a0 3f 4b 88 e8 2d 1a f5 ff <0f> 0b e9 46 ff ff ff e8 
3f 40 63 00 e9 29 ff ff ff e8 35 40 63 00
RSP: 0018:c9000df87c78 EFLAGS: 00010282
RAX:  RBX: 888095b3 RCX: 
RDX: 888095b3 RSI: 815d4eb7 RDI: f52001bf0f81
RBP: 884ab220 R08: 0001 R09: 8880ae7318e7
R10:  R11:  R12: 0039
R13:  R14:  R15: 888095b30488
 try_to_freeze_unsafe include/linux/freezer.h:57 [inline]
 try_to_freeze include/linux/freezer.h:67 [inline]
 freezer_count include/linux/freezer.h:128 [inline]
 freezable_schedule include/linux/freezer.h:173 [inline]
 ptrace_stop+0x4e2/0x9e0 kernel/signal.c:2215
 ptrace_signal kernel/signal.c:2490 [inline]
 get_signal+0xddc/0x1ee0 kernel/signal.c:2639
 do_signal+0x82/0x2520 arch/x86/kernel/signal.c:810
 exit_to_usermode_loop arch/x86/entry/common.c:235 [inline]
 __prepare_exit_to_usermode+0x156/0x1f0 arch/x86/entry/common.c:269
 do_syscall_64+0x6c/0xe0 arch/x86/entry/common.c:393
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x441729
Code: Bad RIP value.
RSP: 002b:7ffd1cbad2b8 EFLAGS: 0246 ORIG_RAX: 003d
RAX: fe00 RBX:  RCX: 00441729
RDX: 8000 RSI:  RDI: 
RBP: 0017df84 R08:  R09: 
R10:  R11: 0246 R12: 00402420
R13: 004024b0 R14:  R15: 
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkal...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches