KASAN: use-after-free Write in do_con_write

2018-05-17 Thread Kyungtae Kim
We report the crash:
"KASAN: use-after-free Write in do_con_write"

This crash was found in v4.17-rc3. Specifically, memory access (write
operation) is invalid, and it is detected by KASAN.

C repro code:
 https://kiwi.cs.purdue.edu/static/alexkkid-fuzzer/repro-c4a1f8.c
kernel config:
 https://kiwi.cs.purdue.edu/static/alexkkid-fuzzer/kernel-config-v4.17-rc3

Crash log:

==
BUG: KASAN: use-after-free in do_con_write.part.20+0x1a14/0x1b70
drivers/tty/vt/vt.c:2397
Write of size 2 at addr 88139042 by task getty/2803

CPU: 0 PID: 2803 Comm: getty Not tainted 4.17.0-rc3 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0xc7/0x138 lib/dump_stack.c:113
 print_address_description+0x6a/0x280 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report+0x22f/0x350 mm/kasan/report.c:412
 __asan_report_store2_noabort+0x17/0x20 mm/kasan/report.c:436
 do_con_write.part.20+0x1a14/0x1b70 drivers/tty/vt/vt.c:2397
 do_con_write drivers/tty/vt/vt.c:2790 [inline]
 con_write+0xb2/0xc0 drivers/tty/vt/vt.c:2786
 n_tty_write+0x763/0xea0 drivers/tty/n_tty.c:2331
 do_tty_write drivers/tty/tty_io.c:958 [inline]
 tty_write+0x48c/0x870 drivers/tty/tty_io.c:1042
 __vfs_write+0x10d/0x610 fs/read_write.c:485
 vfs_write+0x187/0x500 fs/read_write.c:549
 ksys_write+0xd4/0x1a0 fs/read_write.c:598
 __do_sys_write fs/read_write.c:610 [inline]
 __se_sys_write fs/read_write.c:607 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:607
 do_syscall_64+0xa4/0x460 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7ffa6267ac00
RSP: 002b:7ffee1ff7538 EFLAGS: 0246 ORIG_RAX: 0001
RAX: ffda RBX: 00607340 RCX: 7ffa6267ac00
RDX: 0002 RSI: 004059fb RDI: 0001
RBP: 0002 R08: 000a R09: 7ffa62944670
R10: 7ffee1ff7620 R11: 0246 R12: 7ffee1ff8090
R13: 7ffa62d65690 R14: 004059fb R15: 

The buggy address belongs to the page:
page:ea004e40 count:0 mapcount:0 mapping: index:0x0
flags: 0x0()
raw:    
raw: ea004e60 ea004e60  
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 88138f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 88138f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>88139000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
   ^
 88139080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 88139100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==

Thanks,
Kyungtae Kim


KASAN: use-after-free Write in do_con_write

2018-05-17 Thread Kyungtae Kim
We report the crash:
"KASAN: use-after-free Write in do_con_write"

This crash was found in v4.17-rc3. Specifically, memory access (write
operation) is invalid, and it is detected by KASAN.

C repro code:
 https://kiwi.cs.purdue.edu/static/alexkkid-fuzzer/repro-c4a1f8.c
kernel config:
 https://kiwi.cs.purdue.edu/static/alexkkid-fuzzer/kernel-config-v4.17-rc3

Crash log:

==
BUG: KASAN: use-after-free in do_con_write.part.20+0x1a14/0x1b70
drivers/tty/vt/vt.c:2397
Write of size 2 at addr 88139042 by task getty/2803

CPU: 0 PID: 2803 Comm: getty Not tainted 4.17.0-rc3 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0xc7/0x138 lib/dump_stack.c:113
 print_address_description+0x6a/0x280 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report+0x22f/0x350 mm/kasan/report.c:412
 __asan_report_store2_noabort+0x17/0x20 mm/kasan/report.c:436
 do_con_write.part.20+0x1a14/0x1b70 drivers/tty/vt/vt.c:2397
 do_con_write drivers/tty/vt/vt.c:2790 [inline]
 con_write+0xb2/0xc0 drivers/tty/vt/vt.c:2786
 n_tty_write+0x763/0xea0 drivers/tty/n_tty.c:2331
 do_tty_write drivers/tty/tty_io.c:958 [inline]
 tty_write+0x48c/0x870 drivers/tty/tty_io.c:1042
 __vfs_write+0x10d/0x610 fs/read_write.c:485
 vfs_write+0x187/0x500 fs/read_write.c:549
 ksys_write+0xd4/0x1a0 fs/read_write.c:598
 __do_sys_write fs/read_write.c:610 [inline]
 __se_sys_write fs/read_write.c:607 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:607
 do_syscall_64+0xa4/0x460 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7ffa6267ac00
RSP: 002b:7ffee1ff7538 EFLAGS: 0246 ORIG_RAX: 0001
RAX: ffda RBX: 00607340 RCX: 7ffa6267ac00
RDX: 0002 RSI: 004059fb RDI: 0001
RBP: 0002 R08: 000a R09: 7ffa62944670
R10: 7ffee1ff7620 R11: 0246 R12: 7ffee1ff8090
R13: 7ffa62d65690 R14: 004059fb R15: 

The buggy address belongs to the page:
page:ea004e40 count:0 mapcount:0 mapping: index:0x0
flags: 0x0()
raw:    
raw: ea004e60 ea004e60  
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 88138f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 88138f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>88139000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
   ^
 88139080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 88139100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==

Thanks,
Kyungtae Kim


Fwd: KASAN: use-after-free Write in do_con_write

2018-05-12 Thread Kyungtae Kim
-- Forwarded message --
From: Kyungtae Kim <kt0...@gmail.com>
Date: Sat, May 12, 2018 at 9:47 AM
Subject: KASAN: use-after-free Write in do_con_write
To: gre...@linuxfoundation.org, jsl...@suse.com, linux-kernel@vger.kernel.org
Cc: Byoungyoung Lee <lifeasag...@gmail.com>, DaeRyong Jeong
<threeear...@gmail.com>


We report the crash:
"KASAN: use-after-free Write in do_con_write"

This crash was found in v4.17-rc3. Specifically, memory access (write
operation) is invalid, and it is detected by KASAN.

C repro code:
 https://kiwi.cs.purdue.edu/static/alexkkid-fuzzer/repro-c4a1f8.c
kernel config:
 https://kiwi.cs.purdue.edu/static/alexkkid-fuzzer/kernel-config-v4.17-rc3

Crash log:

==
BUG: KASAN: use-after-free in do_con_write.part.20+0x1a14/0x1b70
drivers/tty/vt/vt.c:2397
Write of size 2 at addr 88139042 by task getty/2803

CPU: 0 PID: 2803 Comm: getty Not tainted 4.17.0-rc3 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0xc7/0x138 lib/dump_stack.c:113
 print_address_description+0x6a/0x280 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report+0x22f/0x350 mm/kasan/report.c:412
 __asan_report_store2_noabort+0x17/0x20 mm/kasan/report.c:436
 do_con_write.part.20+0x1a14/0x1b70 drivers/tty/vt/vt.c:2397
 do_con_write drivers/tty/vt/vt.c:2790 [inline]
 con_write+0xb2/0xc0 drivers/tty/vt/vt.c:2786
 n_tty_write+0x763/0xea0 drivers/tty/n_tty.c:2331
 do_tty_write drivers/tty/tty_io.c:958 [inline]
 tty_write+0x48c/0x870 drivers/tty/tty_io.c:1042
 __vfs_write+0x10d/0x610 fs/read_write.c:485
 vfs_write+0x187/0x500 fs/read_write.c:549
 ksys_write+0xd4/0x1a0 fs/read_write.c:598
 __do_sys_write fs/read_write.c:610 [inline]
 __se_sys_write fs/read_write.c:607 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:607
 do_syscall_64+0xa4/0x460 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7ffa6267ac00
RSP: 002b:7ffee1ff7538 EFLAGS: 0246 ORIG_RAX: 0001
RAX: ffda RBX: 00607340 RCX: 7ffa6267ac00
RDX: 0002 RSI: 004059fb RDI: 0001
RBP: 0002 R08: 000a R09: 7ffa62944670
R10: 7ffee1ff7620 R11: 0246 R12: 7ffee1ff8090
R13: 7ffa62d65690 R14: 004059fb R15: 

The buggy address belongs to the page:
page:ea004e40 count:0 mapcount:0 mapping: index:0x0
flags: 0x0()
raw:    
raw: ea004e60 ea004e60  
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 88138f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 88138f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>88139000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
   ^
 88139080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 88139100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==

Thanks,
Kyungtae Kim


Fwd: KASAN: use-after-free Write in do_con_write

2018-05-12 Thread Kyungtae Kim
-- Forwarded message --
From: Kyungtae Kim 
Date: Sat, May 12, 2018 at 9:47 AM
Subject: KASAN: use-after-free Write in do_con_write
To: gre...@linuxfoundation.org, jsl...@suse.com, linux-kernel@vger.kernel.org
Cc: Byoungyoung Lee , DaeRyong Jeong



We report the crash:
"KASAN: use-after-free Write in do_con_write"

This crash was found in v4.17-rc3. Specifically, memory access (write
operation) is invalid, and it is detected by KASAN.

C repro code:
 https://kiwi.cs.purdue.edu/static/alexkkid-fuzzer/repro-c4a1f8.c
kernel config:
 https://kiwi.cs.purdue.edu/static/alexkkid-fuzzer/kernel-config-v4.17-rc3

Crash log:

==
BUG: KASAN: use-after-free in do_con_write.part.20+0x1a14/0x1b70
drivers/tty/vt/vt.c:2397
Write of size 2 at addr 88139042 by task getty/2803

CPU: 0 PID: 2803 Comm: getty Not tainted 4.17.0-rc3 #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0xc7/0x138 lib/dump_stack.c:113
 print_address_description+0x6a/0x280 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report+0x22f/0x350 mm/kasan/report.c:412
 __asan_report_store2_noabort+0x17/0x20 mm/kasan/report.c:436
 do_con_write.part.20+0x1a14/0x1b70 drivers/tty/vt/vt.c:2397
 do_con_write drivers/tty/vt/vt.c:2790 [inline]
 con_write+0xb2/0xc0 drivers/tty/vt/vt.c:2786
 n_tty_write+0x763/0xea0 drivers/tty/n_tty.c:2331
 do_tty_write drivers/tty/tty_io.c:958 [inline]
 tty_write+0x48c/0x870 drivers/tty/tty_io.c:1042
 __vfs_write+0x10d/0x610 fs/read_write.c:485
 vfs_write+0x187/0x500 fs/read_write.c:549
 ksys_write+0xd4/0x1a0 fs/read_write.c:598
 __do_sys_write fs/read_write.c:610 [inline]
 __se_sys_write fs/read_write.c:607 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:607
 do_syscall_64+0xa4/0x460 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7ffa6267ac00
RSP: 002b:7ffee1ff7538 EFLAGS: 0246 ORIG_RAX: 0001
RAX: ffda RBX: 00607340 RCX: 7ffa6267ac00
RDX: 0002 RSI: 004059fb RDI: 0001
RBP: 0002 R08: 000a R09: 7ffa62944670
R10: 7ffee1ff7620 R11: 0246 R12: 7ffee1ff8090
R13: 7ffa62d65690 R14: 004059fb R15: 

The buggy address belongs to the page:
page:ea004e40 count:0 mapcount:0 mapping: index:0x0
flags: 0x0()
raw:    
raw: ea004e60 ea004e60  
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 88138f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 88138f80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>88139000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
   ^
 88139080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 88139100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==

Thanks,
Kyungtae Kim