Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3456027imm; Sun, 13 May 2018 11:45:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZppRyq9OGEPAPxTmNiGjZPd5NRMk659RIJdBdkSLAugdpILJW21vqsly2d1N56Z3UFELn6/ X-Received: by 2002:a63:6d8f:: with SMTP id i137-v6mr6042096pgc.268.1526237146279; Sun, 13 May 2018 11:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526237146; cv=none; d=google.com; s=arc-20160816; b=u3mgIaQ66+FT5A2tiA+9eZmWSXbytqFD2xQ53tzNlJKMTeAcoufXEqvHvIr2jYBlKa xmD4qV8aTDCVvTf7mdU6YkHStwyVetQ55H4dKLLIKOtYJGVNlolJGT4+1Y6dbLCSnU2Y Q/YWq5vW2dBLoghiqIwyaEwdpfL5CDUpU7y0wYukUGj4A552RZE29F20hzNi63WtACp8 WIYDJ4akphbqIAxW5OoRPO1Cva6/lINs58+uJAG7atIfeJ4ZxsHkOR0DNMrPaKY+dS+l z1YxQOsXvE/COl3bcgODWuWK1PGZBxJyTzDqyV72SVkh48KTNGIpsQayO0msrztVX/l5 d+IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=TMVB4BuaBj93f5NeqhanrmkkLHFDo5fVg2b/EagdMUc=; b=qjSwmkyVzG9rC97VsIgJpdTvF3gt7tFKjOXp7U8o649h/X2qel85K0xBDtQLttQKQg phQBBxgYusos4FcHTN0Y+SVnZXA7LIPbEx6s5ZAsPjCkcWjyibLrcGcCMqPlyOtkK+8J mgZWDNb9bdux58FUnCxwR7YXHIPeXsii+5cMIyEnYJ4ryttoVKQoHpYiOYFNuW1DvSna nZneNj0l8gvOvyBE/GIUu71H/H9jopj2Ucu9T7ZyPV2oZmhq5UfPq5CHRVPP9a9zPdm0 WbPuJJmTJv57hRyIVNt+cy2Y1l2qgwZy9IPuE3e1PpH7kxULqjnjtAAWy4fawDQaP0Mw /HUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nnM2+weB; 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 h185-v6si7754612pfe.332.2018.05.13.11.45.16; Sun, 13 May 2018 11:45:46 -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=nnM2+weB; 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 S1751941AbeEMSpK (ORCPT + 99 others); Sun, 13 May 2018 14:45:10 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:46788 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751596AbeEMSpI (ORCPT ); Sun, 13 May 2018 14:45:08 -0400 Received: by mail-pl0-f66.google.com with SMTP id 30-v6so1233181pld.13; Sun, 13 May 2018 11:45:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TMVB4BuaBj93f5NeqhanrmkkLHFDo5fVg2b/EagdMUc=; b=nnM2+weBMRRFytqEK0nUx/FHVWfj7rc3xWozCHjkQ4Eb1Ix8jLt6DORgA8g54LtKyQ oWWqxiIV2GuJTKFOTA4+JpJG17zmkjVv6GQDNFdkaJUojq2dyMjSvEJ8P5cKI5mT+gmE jqA9xBuKsmb18SvvockHfCJNu4ZiJ58uR47/RebzmRcHLqumHKokRfQmbObEQ0R8majm FEn5P19aTIsFz7o6jpG4ifIoWzDTo5PlnqEVVIOygAm/1/sI8Zr7O09O01ZuqPpt1f3m J7FeUxtiW5YPzUA/dcIFSBOoAVMneMDYRYOSwd+wytiEWZkrp99nQjkdGcQ/zlYwTz82 0oAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TMVB4BuaBj93f5NeqhanrmkkLHFDo5fVg2b/EagdMUc=; b=mr6db/jIv7ZkjS2psN+eH9C7n64OfyBKsMQDPaBWmIVmCm1lsjNkgTJD8qHaFz62O9 GqksrNGlVrFxdPRBYgDeLzBuUo5Me0YXQgjEBAA+Bt4W1BVAtAr/zC5bEiKVD1NoKSc6 0s28och30LQ3rHy5l33IK6lxnYKfgQaEvKMCH6wc/iGMPjtrapCTzvGcE8ylNTiYnmP2 RQmi1hTuw5LixGyNHCEYd/1yWXRjm67CIGcWSpr4LBzDTcA6yDpQbdSnE7EauEA5nFY/ trzUfUvIl3LH6/TdQRFIiSze8xA12xJIV6yWjTAZ6lMbhzS2f5hrPhJzednerAOo++s5 BtSg== X-Gm-Message-State: ALKqPwe4F+Ft5o15x/atoLtxHgcz3P011gPAwLMpOqAKVP72avht7ArY k0e3/s3RuDFinW0P0obJnLF+JMCL8BA= X-Received: by 2002:a17:902:7d87:: with SMTP id a7-v6mr6973645plm.264.1526237107545; Sun, 13 May 2018 11:45:07 -0700 (PDT) Received: from sol.localdomain (c-67-185-97-198.hsd1.wa.comcast.net. [67.185.97.198]) by smtp.gmail.com with ESMTPSA id a3-v6sm11041555pgw.14.2018.05.13.11.45.06 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 13 May 2018 11:45:06 -0700 (PDT) Date: Sun, 13 May 2018 11:47:14 -0700 From: Eric Biggers To: linux-wireless@vger.kernel.org, Johannes Berg Cc: syzbot , gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: WARNING in dev_vprintk_emit Message-ID: <20180513184714.GA677@sol.localdomain> References: <001a113a36724a053a0562f93c05@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <001a113a36724a053a0562f93c05@google.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [+MAC80211 list and maintainer] On Wed, Jan 17, 2018 at 05:58:01AM -0800, syzbot wrote: > Hello, > > syzkaller hit the following crash on > c92a9a461dff6140c539c61e457aa97df29517d6 > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/master > compiler: gcc (GCC) 7.1.1 20170620 > .config is attached > Raw console output is attached. > C reproducer is attached > syzkaller reproducer is attached. See https://goo.gl/kgGztJ > for information about syzkaller reproducers > > > IMPORTANT: if you fix the bug, please add the following tag to the commit: > Reported-by: syzbot+e64565577af34b3768dc@syzkaller.appspotmail.com > It will help syzbot understand when the bug is fixed. See footer for > details. > If you forward the report, please keep this part and the footer. > > WARNING: CPU: 1 PID: 3652 at drivers/base/core.c:2884 create_syslog_header > drivers/base/core.c:2884 [inline] > WARNING: CPU: 1 PID: 3652 at drivers/base/core.c:2884 > dev_vprintk_emit+0x159/0x510 drivers/base/core.c:2894 > Kernel panic - not syncing: panic_on_warn set ... > > CPU: 1 PID: 3652 Comm: syzkaller376059 Not tainted 4.15.0-rc7+ #260 > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS > Google 01/01/2011 > Call Trace: > __dump_stack lib/dump_stack.c:17 [inline] > dump_stack+0x194/0x257 lib/dump_stack.c:53 > panic+0x1e4/0x41c kernel/panic.c:183 > __warn+0x1dc/0x200 kernel/panic.c:547 > report_bug+0x211/0x2d0 lib/bug.c:184 > fixup_bug.part.11+0x37/0x80 arch/x86/kernel/traps.c:178 > fixup_bug arch/x86/kernel/traps.c:247 [inline] > do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296 > do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315 > invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:1079 > RIP: 0010:create_syslog_header drivers/base/core.c:2884 [inline] > RIP: 0010:dev_vprintk_emit+0x159/0x510 drivers/base/core.c:2894 > RSP: 0018:ffff8801bc40ee68 EFLAGS: 00010286 > RAX: dffffc0000000008 RBX: ffff8801bc080980 RCX: ffffffff8159da9e > RDX: 0000000000000000 RSI: 1ffff100378f9d2d RDI: 0000000000000293 > RBP: ffff8801bc40efa8 R08: 1ffff10037881d60 R09: 0000000000000000 > R10: ffff8801bc40f090 R11: 0000000000000000 R12: 1ffff10037881dd4 > R13: ffff8801d472c400 R14: ffff8801bc40eec0 R15: ffff8801bc40efe0 > dev_printk_emit+0xc0/0xf0 drivers/base/core.c:2907 > __dev_printk+0xa7/0x120 drivers/base/core.c:2919 > dev_printk+0x111/0x170 drivers/base/core.c:2936 > ieee80211_init_rate_ctrl_alg+0x2d5/0x4a0 net/mac80211/rate.c:978 > ieee80211_register_hw+0x1448/0x3100 net/mac80211/main.c:1091 > mac80211_hwsim_new_radio+0x1b2e/0x2b90 > drivers/net/wireless/mac80211_hwsim.c:2700 > hwsim_new_radio_nl+0x5b7/0x7c0 drivers/net/wireless/mac80211_hwsim.c:3152 > genl_family_rcv_msg+0x7b7/0xfb0 net/netlink/genetlink.c:599 > genl_rcv_msg+0xb2/0x140 net/netlink/genetlink.c:624 > netlink_rcv_skb+0x224/0x470 net/netlink/af_netlink.c:2408 > genl_rcv+0x28/0x40 net/netlink/genetlink.c:635 > netlink_unicast_kernel net/netlink/af_netlink.c:1275 [inline] > netlink_unicast+0x4ee/0x700 net/netlink/af_netlink.c:1301 > netlink_sendmsg+0xa4a/0xe60 net/netlink/af_netlink.c:1864 > sock_sendmsg_nosec net/socket.c:638 [inline] > sock_sendmsg+0xca/0x110 net/socket.c:648 > ___sys_sendmsg+0x767/0x8b0 net/socket.c:2028 > __sys_sendmsg+0xe5/0x210 net/socket.c:2062 > SYSC_sendmsg net/socket.c:2073 [inline] > SyS_sendmsg+0x2d/0x50 net/socket.c:2069 > entry_SYSCALL_64_fastpath+0x23/0x9a > RIP: 0033:0x43fd89 > RSP: 002b:00007ffe0ab23e98 EFLAGS: 00000203 ORIG_RAX: 000000000000002e > RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 000000000043fd89 > RDX: 0000000000000000 RSI: 0000000020b3dfc8 RDI: 0000000000000003 > RBP: 00000000006ca018 R08: 0000000000000000 R09: 0000000000000000 > R10: 0000000000000000 R11: 0000000000000203 R12: 00000000004016f0 > R13: 0000000000401780 R14: 0000000000000000 R15: 0000000000000000 > Dumping ftrace buffer: > (ftrace buffer empty) > Kernel Offset: disabled > Rebooting in 86400 seconds.. > > > --- > This bug is generated by a dumb bot. It may contain errors. > See https://goo.gl/tpsmEJ for details. > Direct all questions to syzkaller@googlegroups.com. > > syzbot will keep track of this bug report. > If you forgot to add the Reported-by tag, once the fix for this bug is > merged > into any tree, please reply to this email with: > #syz fix: exact-commit-title > If you want to test a patch for this bug, please reply with: > #syz test: git://repo/address.git branch > and provide the patch inline or as an attachment. > To mark this as a duplicate of another syzbot report, please reply with: > #syz dup: exact-subject-of-another-report > If it's a one-off invalid bug report, please reply with: > #syz invalid > Note: if the crash happens again, it will cause creation of a new bug > report. > Note: all commands must start from beginning of the line in the email body. The bug is that mac80211_hwsim allows creating device names that are too long, via HWSIM_CMD_NEW_RADIO. Commit a7cfebcb7594a2 ("cfg80211: limit wiphy names to 128 bytes") limited them to 128 bytes, but it's not enough because dev_vprintk_emit() needs the device name plus some other stuff to not exceed 128 bytes. Here's a reproducer that works on Linus' tree (commit ccda3c4b777), provided that CONFIG_MAC80211_HWSIM=y. Note that you'll probably need to change the hardcoded MAC80211_HWSIM generic netlink family ID for it to work. Johannes, what would you say about limiting the name length to 64 bytes instead? #include #include #include #define HWSIM_CMD_NEW_RADIO 4 #define HWSIM_ATTR_RADIO_NAME 17 /* Replace with `genl-ctrl-list | awk '/MAC80211_HWSIM/{print $1}'` */ #define MAC80211_HWSIM_GENL_ID 0x17 /* Length of name to test */ #define NAMELEN 128 int main() { struct { struct nlmsghdr hdr; struct genlmsghdr ghdr; struct nlattr attr; char radio_name[NLA_ALIGN(NAMELEN)]; } msg = { .hdr = { .nlmsg_len = sizeof(msg), .nlmsg_type = MAC80211_HWSIM_GENL_ID, .nlmsg_flags = NLM_F_REQUEST, }, .ghdr = { .cmd = HWSIM_CMD_NEW_RADIO }, .attr = { .nla_len = sizeof(struct nlattr) + NAMELEN, .nla_type = HWSIM_ATTR_RADIO_NAME, }, .radio_name = {[0 ... NAMELEN-1] = 'A'}, }; int fd = socket(AF_NETLINK, SOCK_RAW, NETLINK_GENERIC); write(fd, &msg, sizeof(msg)); }