Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933488AbbDWKQ0 (ORCPT ); Thu, 23 Apr 2015 06:16:26 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:39250 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754528AbbDWKQW (ORCPT ); Thu, 23 Apr 2015 06:16:22 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-eb-5538c67493a2 Message-id: <5538C66F.4050404@samsung.com> Date: Thu, 23 Apr 2015 13:16:15 +0300 From: Andrey Ryabinin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-version: 1.0 To: Al Viro Cc: Linus Torvalds , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [git pull] vfs part 2 References: <20150415181406.GL889@ZenIV.linux.org.uk> In-reply-to: <20150415181406.GL889@ZenIV.linux.org.uk> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHLMWRmVeSWpSXmKPExsVy+t/xa7olxyxCDW7eZrXYs/cki8XlXXPY LB71vWW3OP/3OKsDi8eJGb9ZPD5vkvPY9OQtUwBzFJdNSmpOZllqkb5dAlfGg74DbAX35Crm dDQxNzCekexi5OSQEDCR+L5xFwuELSZx4d56NhBbSGApo8S101ldjFxA9ndGiabr11lBErwC WhKr589kBrFZBFQlln+fANbAJqAn8W/WdiCbg0NUIELi9mVOiHJBiR+T74HNFwEqv3PqDBOI zSxQKPFxdRuYLSygJPF0wTywViEBU4nFT9NAwpwCZhJfj61gBwkzA02/f1ELolNeYvOat8wT GAVmIVkwC6FqFpKqBYzMqxhFU0uTC4qT0nMN9YoTc4tL89L1kvNzNzFCQvXLDsbFx6wOMQpw MCrx8Gb8Ng8VYk0sK67MPcQowcGsJMIrNNUiVIg3JbGyKrUoP76oNCe1+BCjNAeLkjjv3F3v Q4QE0hNLUrNTUwtSi2CyTBycUg2M83fMdl6tf7f7ZZOfmyqD5HSDu8Y1xtF7s01uGIvlZDqt vMXxeIXmpOWLbORi6twUxXr23tZY8et60ZzFn20Orj6Sv78lMnrakifL42MVnqSsNtG+J3a9 09VqT57b4lZDj+/XfbNs1ja+Djy/tXbOUTf2fJ2ghVorFJq7tlVdq69lb5745eNlJZbijERD Leai4kQAGdCXJlECAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4105 Lines: 79 On 04/15/2015 09:14 PM, Al Viro wrote: > 9p: switch p9_client_write() to passing it struct iov_iter * Hi Al, This change caused following: [ 91.637917] ================================================================== [ 91.639252] BUG: KASan: out of bounds on stack in iov_iter_advance+0x3e4/0x4b0 at addr ffff8800ba1efd20 [ 91.640979] Read of size 8 by task trinity-c15/4746 [ 91.641493] page:ffffea0002e87bc0 count:0 mapcount:0 mapping: (null) index:0x0 [ 91.641787] flags: 0x100000000000000() [ 91.641787] page dumped because: kasan: bad access detected [ 91.641787] CPU: 1 PID: 4746 Comm: trinity-c15 Not tainted 4.0.0+ #319 [ 91.641787] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5.1-0-g8936dbb-20141113_115728-nilsson.home.kraxel.org 04/01/2014 [ 91.641787] ffff8800ba1efd08 ffff8800ba1ef918 ffffffff81ab94ed 1ffffd40005d0f7f [ 91.641787] ffff8800ba1ef9b0 ffff8800ba1ef998 ffffffff812bc0f4 ffffffff814901f0 [ 91.641787] ffff8800ba1efa40 0000000000000296 ffff8801f4993490 ffffffff81228fe0 [ 91.641787] Call Trace: [ 91.641787] dump_stack (lib/dump_stack.c:52) [ 91.641787] kasan_report_error (mm/kasan/report.c:132 mm/kasan/report.c:193) [ 91.641787] ? idr_mark_full (lib/idr.c:551) [ 91.641787] ? clear_exceptional_entry (mm/truncate.c:561) [ 91.641787] __asan_report_load8_noabort (mm/kasan/report.c:251) [ 91.641787] ? iov_iter_advance (lib/iov_iter.c:511) [ 91.641787] iov_iter_advance (lib/iov_iter.c:511) [ 91.641787] p9_client_write (net/9p/client.c:1656) [ 91.641787] ? p9_client_readdir (net/9p/client.c:1614) [ 91.641787] ? kasan_kmalloc (mm/kasan/kasan.c:355) [ 91.641787] ? __kmalloc (mm/slub.c:3325) [ 91.641787] ? p9_client_readdir (net/9p/client.c:1614) [ 91.641787] ? v9fs_file_lock_dotl (fs/9p/vfs_file.c:405) [ 91.641787] v9fs_file_write_iter (fs/9p/vfs_file.c:421) [ 91.641787] ? __sb_end_write (fs/super.c:1192) [ 91.641787] ? v9fs_file_lock_dotl (fs/9p/vfs_file.c:405) [ 91.641787] ? do_readv_writev (fs/read_write.c:776) [ 91.641787] ? recalc_sigpending (kernel/signal.c:160) [ 91.641787] ? __set_task_blocked (kernel/signal.c:2514) [ 91.641787] __vfs_write (fs/read_write.c:479 fs/read_write.c:490) [ 91.641787] ? recalc_sigpending (kernel/signal.c:160) [ 91.641787] ? __vfs_read (fs/read_write.c:486) [ 91.641787] ? __sb_end_write (fs/super.c:1192) [ 91.641787] ? signal_setup_done (kernel/signal.c:2556) [ 91.641787] ? hrtimer_start (kernel/time/hrtimer.c:1043) [ 91.641787] ? do_setitimer (kernel/time/itimer.c:222) [ 91.641787] vfs_write (include/linux/fs.h:1984 include/linux/fs.h:2416 fs/read_write.c:543) [ 91.641787] SyS_write (fs/read_write.c:585 fs/read_write.c:576) [ 91.641787] ? SyS_read (fs/read_write.c:576) [ 91.641787] ? init_fpu (arch/x86/kernel/i387.c:231 arch/x86/kernel/i387.c:266) [ 91.641787] ? math_state_restore (arch/x86/kernel/traps.c:869) [ 91.641787] system_call_fastpath (arch/x86/kernel/entry_64.S:261) [ 91.641787] Memory state around the buggy address: [ 91.641787] ffff8800ba1efc00: f2 00 f4 f4 f4 f2 f2 f2 f2 00 f4 f4 f4 f3 f3 f3 [ 91.641787] ffff8800ba1efc80: f3 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 [ 91.641787] >ffff8800ba1efd00: f1 00 00 f4 f4 f2 f2 f2 f2 00 00 00 00 00 f4 f4 [ 91.641787] ^ [ 91.641787] ffff8800ba1efd80: f4 f2 f2 f2 f2 00 00 00 00 00 f4 f4 f4 f3 f3 f3 [ 91.641787] ffff8800ba1efe00: f3 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 91.641787] ================================================================== This could happen when p9pdu_readf() changes 'count' to some value > iov_iter_count(from): p9_client_write(): <...> int count = iov_iter_count(from); <...> *err = p9pdu_readf(req->rc, clnt->proto_version, "d", &count); <...> iov_iter_advance(from, count); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/