Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp443695imm; Thu, 30 Aug 2018 02:53:43 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaAueHXQ0YCTF4opZoep4++dvDFwz4JJYXwZq8kZKrqM1m2aZG73WHiDhmXszZ+4rdUDJVR X-Received: by 2002:a63:1204:: with SMTP id h4-v6mr9223465pgl.115.1535622823285; Thu, 30 Aug 2018 02:53:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535622823; cv=none; d=google.com; s=arc-20160816; b=a54jQQLSXN84zqruCHpTr/bD4H5TsSuIpremY1X0QCta9JRjXSSUV8CH0aPyLkZiJy BIhuiuEv9+SNilRkYNMBEghso5F75bj63kvy9W7XKNecmUUM5jPjOIfDLG02mmmT9yqi xPzFtHmaAfpggtBUL+Lbjl0vHz1qMBBdq1VXVYnroo+WrYug7YxT3eI32dstFB3ngba3 ShUMq3Lkz6nM8AhvwNf0JxBOva10vwvqtVeT77hJDP4MuMNUJfltFJOcA7mrF9yjzL0H aXeY/DsxUYEPKRvuHsHGrkLZy1puOdbwo6M8Uwl6uIjDk8quq0OmCTNfhS/mpHcJGIWe rxFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=0aMKOINaC6wVJPvSbgbcEh3KZDbFiieBanMGq5bxeKM=; b=mW7xkB1FzmFMG6z9af9jT4t23su9ci6KdlKOJh5ASdSc8AvaoKf3Bc1Gvxgpkol8l/ aNmKyH5+MAz2SHloSoKF471LdcucYRsvYCnhWSo3EXNGMQSsoPJw8GOb0Kdmqx+JZU7/ hm9HkTJJDxcajOvBHNuIjnZKHhP762SUvCxh3HL+U/2mbA8/5wxOBvUsT70hh1VJOpKN lX+bfWY3eAG3nM9rAlmCu7v3RS6h+Fl+N7pWLHMzu5ByJ+ToCr72lBkhcw/76o3yOJx3 wVwgro5qS+mnn4ikMF3rhlDO4+Du7+VMErIA6gO8v9NA3qtnq/UY6PIrsvvLmVGnpdZ6 hPZQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u29-v6si5916014pga.29.2018.08.30.02.53.28; Thu, 30 Aug 2018 02:53:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728253AbeH3Nxl (ORCPT + 99 others); Thu, 30 Aug 2018 09:53:41 -0400 Received: from www62.your-server.de ([213.133.104.62]:57241 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727988AbeH3Nxl (ORCPT ); Thu, 30 Aug 2018 09:53:41 -0400 Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1fvJcf-0004Nf-MN; Thu, 30 Aug 2018 11:52:17 +0200 Received: from [2a02:120b:c3f4:b8b0:b5ea:3969:d380:aafd] (helo=linux.home) by sslproxy01.your-server.de with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1fvJcf-0002d0-Dm; Thu, 30 Aug 2018 11:52:17 +0200 Subject: Re: KASAN: stack-out-of-bounds Read in __schedule To: Dmitry Vyukov , Alexander Potapenko , Alexei Starovoitov , netdev Cc: Jan Kara , syzbot+45a34334c61a8ecf661d@syzkaller.appspotmail.com, Jan Kara , linux-ext4@vger.kernel.org, LKML , syzkaller-bugs , Theodore Ts'o References: <000000000000fef39305748083ae@google.com> <20180829134620.GD7369@quack2.suse.cz> From: Daniel Borkmann Message-ID: <279041ab-d449-1bfb-a05d-2d8b0d5c601b@iogearbox.net> Date: Thu, 30 Aug 2018 11:52:16 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.100.1/24886/Thu Aug 30 06:46:17 2018) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/30/2018 06:11 AM, Dmitry Vyukov wrote: > On Wed, Aug 29, 2018 at 7:03 AM, 'Alexander Potapenko' via > syzkaller-bugs wrote: >> On Wed, Aug 29, 2018 at 3:46 PM Jan Kara wrote: >>> On Tue 28-08-18 08:30:02, syzbot wrote: >>>> Hello, >>>> >>>> syzbot found the following crash on: >>>> >>>> HEAD commit: 5b394b2ddf03 Linux 4.19-rc1 >>>> git tree: upstream >>>> console output: https://syzkaller.appspot.com/x/log.txt?x=14f4d8e1400000 >>>> kernel config: https://syzkaller.appspot.com/x/.config?x=49927b422dcf0b29 >>>> dashboard link: https://syzkaller.appspot.com/bug?extid=45a34334c61a8ecf661d >>>> compiler: gcc (GCC) 8.0.1 20180413 (experimental) >>>> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13127e5a400000 >>>> >>>> IMPORTANT: if you fix the bug, please add the following tag to the commit: >>>> Reported-by: syzbot+45a34334c61a8ecf661d@syzkaller.appspotmail.com >>>> >>>> IPv6: ADDRCONF(NETDEV_UP): veth1: link is not ready >>>> IPv6: ADDRCONF(NETDEV_CHANGE): veth1: link becomes ready >>>> IPv6: ADDRCONF(NETDEV_CHANGE): veth0: link becomes ready >>>> 8021q: adding VLAN 0 to HW filter on device team0 >>>> ================================================================== >>>> BUG: KASAN: stack-out-of-bounds in schedule_debug kernel/sched/core.c:3285 >>>> [inline] >>>> BUG: KASAN: stack-out-of-bounds in __schedule+0x1977/0x1df0 >>>> kernel/sched/core.c:3395 >>>> Read of size 8 at addr ffff8801ad090000 by task syz-executor0/4718 >>> >>> Weird, can you please help me decipher this? So here KASAN complains about >>> wrong memory access in the scheduler. > > This looks like a result of a previous bad silent memory corruption. > > The KASAN report says there is a stack out-of-bounds in scheduler. And > that if followed by slab corruption report in another task. > > fs/jbd2/transaction.c happens to be the first meaningful file in this > crash, and so that's where it is attributed to. > > Rerunning the reproducer several times can maybe give some better > glues, or maybe not, maybe they all will look equally puzzling. > > This part of the repro looks familiar: > > r1 = bpf$MAP_CREATE(0x0, &(0x7f0000002e40)={0x12, 0x0, 0x4, 0x6e, 0x0, > 0x1}, 0x68) > bpf$MAP_UPDATE_ELEM(0x2, &(0x7f0000000180)={r1, &(0x7f0000000000), > &(0x7f0000000140)}, 0x20) > > We had exactly such consequences of a bug in bpf map very recently, > but that was claimed to be fixed. Maybe not completely? > +bpf maintainers Looks like syzbot found this in Linus tree with HEAD commit 5b394b2ddf03 ("Linux 4.19-rc1") one day later net PR got merged via 050cdc6c9501 ("Merge git://git.kernel.org/pub/..."). This PR contained a couple of fixes I did on sockmap code during audit such as: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b845c898b2f1ea458d5453f0fa1da6e2dfce3bb4 Looking at the reproducer syzkaller found it contains: r1 = bpf$MAP_CREATE(0x0, &(0x7f0000002e40)={0x12, 0x0, 0x4, 0x6e, 0x0, 0x1}, 0x68) ^^^ So it found the crash with map type of sock hash and key size of 0x0 (which is invalid), where subsequent map update triggered the corruption. I just did a 'syz test' and it wasn't able to trigger the crash anymore. #syz fix: bpf, sockmap: fix sock_hash_alloc and reject zero-sized keys