Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2149389imm; Sat, 12 May 2018 06:45:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrhuwkAtnQB4YpWjypezjWpBBk6lp7KADsj2nct9j5JtnjTPCuLOmLRmYVvP1PpMUiRl77h X-Received: by 2002:a17:902:c5:: with SMTP id a63-v6mr2516412pla.149.1526132754410; Sat, 12 May 2018 06:45:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526132754; cv=none; d=google.com; s=arc-20160816; b=CInY3BIRpISmtU/1OllKTGmo5EhW3wDnSkFvghWs/hSTRq6DS3/6CAo0CNdswI8Xxk VDQ7UHM31GJ0uK8crH2T7oOGGl12N1bjJ+JolrVccLE8yJfYMlxPM37zFrH8eARRkHQ5 oDYdq2T7NmcCY0sJ0YvDMzEhbG/sOq55Ib6CG4wJDKNgoBauQgRIwgqcgIuyod+Uhi5/ mTjVXz14Hkj0AUXoOKekT9g90SUTcTVMyWmHEZHPv/hiPXn/CCHPqyxHxbrG+OXog8sH q55MzyfXVbAFONtVjDrFREzDvChcpFD7ivWNu7Js/+oU4jRIozMIq1qrS0kq/8/bZ9KC XJfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Jpzqx1xCrFoMSXAYKCDKO0ciItW8CpyC0NZFlY5ybHw=; b=P/M4GXG7cK0ANOzjsfU1ccyk+dvhFD+0gi3cbEjxPqxQ1d9JoE+Khcj0aTAZf09mMC GMWuRdbWwbBgfyC45wGhP42zbPYJLjFtE3fjrHWA7yraKaot1lmMGmyZEMHG7hhYAMxJ xUG/hYdFanC4KlNUB8lxfoZmxpDb4x4nEKMcywQaaL4FRO2J1627daNO8x6xBdpmbFKW peJTZO8OQSjo4Im2fYEa8ETd6n5KrNxtIespKWjignwVhy/Tjb07c0HzZQMUZgwz0IP1 gtuRwG0q7oB/XhhjRMKw949t0jdAguwuN2oLHRLga5QPwfWskQ8Gx9AsMRVbaQyh/kHL b6iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VSoYjKVm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k90-v6si5879539pfh.50.2018.05.12.06.45.39; Sat, 12 May 2018 06:45:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VSoYjKVm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751533AbeELNpb (ORCPT + 99 others); Sat, 12 May 2018 09:45:31 -0400 Received: from mail-io0-f181.google.com ([209.85.223.181]:39096 "EHLO mail-io0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750854AbeELNpa (ORCPT ); Sat, 12 May 2018 09:45:30 -0400 Received: by mail-io0-f181.google.com with SMTP id r9-v6so10205962iod.6; Sat, 12 May 2018 06:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=Jpzqx1xCrFoMSXAYKCDKO0ciItW8CpyC0NZFlY5ybHw=; b=VSoYjKVmu71RW4DeG4amb4tAaf2LmtPHRl+EhQL7kI2wImyPiyZisiv+x+mzwavMHq 2iVyWV2lKQdHwloZ16CYEHoxwUwEUocvxnaO3LTAbl8SV7PFb7brHeuT+xQeAyDv1m2r 7IDK24CZY6CcBcEI38LTcHg2yhEIeOvx/7uh6qA98IEziuLifdv3W/WZSMoTarsEE5p/ KepvAEvbK4Po1AV8IqsMZxhskXIcKXmkGO+7QteZNhnxMxThIFgydSUrhWnpuzFIwHN3 LvGb0rGREZqo+/wqqVRvmQnooj8Rb4YmPQrM5iDgawbduyBk/hAMWfSwu2cISSQqaUbD HilA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=Jpzqx1xCrFoMSXAYKCDKO0ciItW8CpyC0NZFlY5ybHw=; b=rJO1ZQ6K3nW8HAGnYJRCZJun8BRUc8CB3AxqmbyamEOTZd0TKH1/fyxSV6de6lJNYj L9Q+ZHAsih7+Loz8vh9BcizNRYsuqC3XjHNn7LlDXrL+Nn7z8KESu561KWfjXBz1T4aO IehjJ6J/5ZBHPWBzCXnwEUj/XcQcvJSuld8lrsTEQfnGqFnLRLcYhiz3NH4czmLMQpmm Ix2SJz7TFTT9N/UyJsZQi3cfmiBg8Bp9lGTcfdaeLdbWGAHscq+GBmOss5j+y7XjrbNW FLkFoi0SSsSpTKZRViwF381eJvl2T1TgfFZ/PibrcsODVcPsIzbqWGfBDcvzEEu2SSyM p8PQ== X-Gm-Message-State: ALKqPwcSC2WngMlTahm7uq6iLSoj3Wl+odBanOJj0wN/zIMB9yR76hhL WFTHY8Fs3E+eD0dLiKLOGFoxss+W1YbnoRsjRXAkHw== X-Received: by 2002:a6b:268b:: with SMTP id m133-v6mr3083578iom.107.1526132729295; Sat, 12 May 2018 06:45:29 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:a157:0:0:0:0:0 with HTTP; Sat, 12 May 2018 06:45:28 -0700 (PDT) In-Reply-To: References: From: Kyungtae Kim Date: Sat, 12 May 2018 09:45:28 -0400 Message-ID: Subject: Fwd: KASAN: use-after-free Write in vgacon_scroll To: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ---------- Forwarded message ---------- From: Kyungtae Kim Date: Sat, May 12, 2018 at 9:44 AM Subject: KASAN: use-after-free Write in vgacon_scroll To: b.zolnierkie@samsung.com, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Byoungyoung Lee , DaeRyong Jeong We report the crash: "KASAN: use-after-free Write in vgacon_scroll" 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-bd11a.c kernel config: https://kiwi.cs.purdue.edu/static/alexkkid-fuzzer/kernel-config-v4.17-rc3 Crash log: ============================================================== BUG: KASAN: use-after-free in memcpy include/linux/string.h:345 [inline] BUG: KASAN: use-after-free in scr_memcpyw include/linux/vt_buffer.h:49 [inline] BUG: KASAN: use-after-free in vgacon_scrollback_update drivers/video/console/vgacon.c:249 [inline] BUG: KASAN: use-after-free in vgacon_scroll+0x684/0x890 drivers/video/console/vgacon.c:1374 Write of size 3758 at addr ffff88011a8bf98e by task syz-executor1/3226 CPU: 0 PID: 3226 Comm: syz-executor1 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 check_memory_region_inline mm/kasan/kasan.c:260 [inline] check_memory_region+0x13b/0x1a0 mm/kasan/kasan.c:267 memcpy+0x37/0x50 mm/kasan/kasan.c:303 memcpy include/linux/string.h:345 [inline] scr_memcpyw include/linux/vt_buffer.h:49 [inline] vgacon_scrollback_update drivers/video/console/vgacon.c:249 [inline] vgacon_scroll+0x684/0x890 drivers/video/console/vgacon.c:1374 con_scroll+0x2cc/0x330 drivers/tty/vt/vt.c:329 lf+0x247/0x290 drivers/tty/vt/vt.c:1122 do_con_trol+0x14f/0x5310 drivers/tty/vt/vt.c:1785 do_con_write.part.20+0x597/0x1b70 drivers/tty/vt/vt.c:2433 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 redirected_tty_write+0xaf/0xc0 drivers/tty/tty_io.c:1063 __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:0x4497b9 RSP: 002b:00007fc0af9acc68 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fc0af9ad6cc RCX: 00000000004497b9 RDX: 0000000000001000 RSI: 0000000020000080 RDI: 0000000000000013 RBP: 000000000071bf58 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 0000000000009ee8 R14: 00000000006f0f88 R15: 00007fc0af9ad700 The buggy address belongs to the page: page:ffffea00046a2c00 count:1 mapcount:0 mapping:0000000000000000 index:0x0 compound_mapcount: 0 flags: 0x200000000008000(head) raw: 0200000000008000 0000000000000000 0000000000000000 00000001ffffffff raw: dead000000000100 dead000000000200 0000000000000000 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88011a8bff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88011a8bff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88011a8c0000: fb fb fb fc fc fb fb fb fc fc 00 00 00 fc fc fc ^ ffff88011a8c0080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88011a8c0100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ============================================================== Thanks, Kyungtae Kim