From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91CCCC433DB for ; Wed, 17 Feb 2021 06:39:56 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3248D64DBD for ; Wed, 17 Feb 2021 06:39:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3248D64DBD Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SIfTmSiZXRMiuH6fw9MBJumHoiWjmWw41GtbEunWbcA=; b=Z+wUVa1gH5rZDkzV8p+xXtfUd E+EK1zYFW8qTR8CsXjk14gyKfQQsRqAlgmT2/pFSW7ZfBP/IaXX0jW1GTJP5aydBIvg5koZElP4qO 4619DAXMq06CoAYUqRN5Fx2ID9VCllW3bf3xDFg3YBCUPfsRb7xI76anD7W4ms8poOX49iYNaPQ93 I5Vv4x9QedGHP2JNGyuRURdX6vYCxlhfaDZBy3Q4mmamkNMthaGrqIyrEhFRP+cdyRxdl+d5vtn63 054pbhQ9S21eNEXLHXetmexmUaeobTdp2fbwHOgxGjbXU1OUgG5jHRJCZUZCMnTfJIklXdPB9eiym l5ZLOoUQQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCGSj-0002RX-9O; Wed, 17 Feb 2021 06:37:25 +0000 Received: from mail-qv1-xf2b.google.com ([2607:f8b0:4864:20::f2b]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1lCGSg-0002RA-CU for linux-arm-kernel@lists.infradead.org; Wed, 17 Feb 2021 06:37:23 +0000 Received: by mail-qv1-xf2b.google.com with SMTP id y10so5827650qvo.6 for ; Tue, 16 Feb 2021 22:37:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ugTQaAHGFRc8CPFFaoP0oTLZDH3L7/TR0bJ/954bT1w=; b=v8HGgPjVyadQVfPmCx53Cywv+tY+/NwgMZesn4Cct7G8jWSbvOzSIGB/hxY7I+rWGA oPcjS0UokMyi6R8y8MHOZwg3JJF+o1joKHa5yfpiRZu3x83CxzklWCWA6FeIJMTnAWwa 1cjF4Jz6JHzpRx+OJw9YQp+P/pzawTcePep9dRvCNXkqQ93Db2OxFXqsn6ONhV/ZhD5h LlmUlWKOvNF0oDynmUvZ9R0CzNkbwPNwrbf4RrBCl8bFgVu/3tJJoxyj+NXRObkpv9Vz kWZpDzE7jiCSXPhk9ngfm93euWFpMKJ6F/jAnHNWbm3d3fpjYzoY5Zjx0x6kDOPhJSDe ZsqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ugTQaAHGFRc8CPFFaoP0oTLZDH3L7/TR0bJ/954bT1w=; b=mc6nDPnf693sDDUF0DK7eIz0nir95H5C6t4Sx2f6isvAfehmGYq5Bm/aJHD6hnKPh3 LKUVjoiG+/PFv2oZVgww2y91qv/qTUC3DOgdXtA+i9JrrG9+iLbZyVEytV1b97ZFO6WY DW+9gm+RXKu/iMcb9CUMil3yXMFx4vnW3Fg8GMv85ejZl2xyO3Cw4rTbLaCgzEOAL0ZE zIdfEQTpEdvEw2SEOt7J7MISu2sOQQV/r4osIAvn1vZfftto2BC0s7C3g2eJxJj1XvL8 dIFr+HBATK7pQNsJCTNp37MV8uB21d92fcmIN1jTdKDSj33vgeZy46jXAsblBOmkHaDV vZdw== X-Gm-Message-State: AOAM533viQAQ0de136cyhRieebzWdADIDjfpCkfGzhNYaf17CkiE5YZl dAh38PievTVp4fBDpmbW1+ZT0T1MA0S98gPbbhTNvQ== X-Google-Smtp-Source: ABdhPJziFbydIqs9spoKH8g+9HfptYXkPclDT0RznHkiHmn/kvucRG/COOeZ+TcnMFsCaeIlanv6uAAeyMTjEF5z1HE= X-Received: by 2002:a0c:8304:: with SMTP id j4mr23007277qva.18.1613543837440; Tue, 16 Feb 2021 22:37:17 -0800 (PST) MIME-Version: 1.0 References: <0000000000000be4d705bb68dfa7@google.com> <20210216172817.GA14978@arm.com> <20210216180143.GB14978@arm.com> In-Reply-To: From: Dmitry Vyukov Date: Wed, 17 Feb 2021 07:37:06 +0100 Message-ID: Subject: Re: KASAN: invalid-access Write in enqueue_timer To: Catalin Marinas , Eric Dumazet X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210217_013722_481311_62442105 X-CRM114-Status: GOOD ( 23.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , "Jason A. Donenfeld" , Kees Cook , Netdev , syzkaller-bugs , LKML , Mark Brown , syzbot , mbenes@suse.cz, Will Deacon , Ard Biesheuvel , linux-arm-kernel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Feb 16, 2021 at 7:15 PM Dmitry Vyukov wrote: > > On Tue, Feb 16, 2021 at 06:50:20PM +0100, Jason A. Donenfeld wrote: > > > On Tue, Feb 16, 2021 at 6:46 PM Jason A. Donenfeld wrote: > > > > On Tue, Feb 16, 2021 at 6:28 PM Catalin Marinas wrote: > > > > > > hlist_add_head include/linux/list.h:883 [inline] > > > > > > enqueue_timer+0x18/0xc0 kernel/time/timer.c:581 > > > > > > mod_timer+0x14/0x20 kernel/time/timer.c:1106 > > > > > > mod_peer_timer drivers/net/wireguard/timers.c:37 [inline] > > > > > > wg_timers_any_authenticated_packet_traversal+0x68/0x90 drivers/net/wireguard/timers.c:215 > > > > > > > > The line of hlist_add_head that it's hitting is: > > > > > > > > static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) > > > > { > > > > struct hlist_node *first = h->first; > > > > WRITE_ONCE(n->next, first); > > > > if (first) > > > > > > > > So that means it's the dereferencing of h that's a problem. That comes from: > > > > > > > > static void enqueue_timer(struct timer_base *base, struct timer_list *timer, > > > > unsigned int idx, unsigned long bucket_expiry) > > > > { > > > > > > > > hlist_add_head(&timer->entry, base->vectors + idx); > > > > > > > > That means it concerns base->vectors + idx, not the timer_list object > > > > that wireguard manages. That's confusing. Could that imply that the > > > > bug is in freeing a previous timer without removing it from the timer > > > > lists, so that it winds up being in base->vectors? > > > > Good point, it's indeed likely that the timer list is messed up already, > > just an unlucky encounter in the wireguard code. > > > > > Digging around on syzkaller, it looks like there's a similar bug on > > > jbd2, concerning iptunnels's allocation: > > > > > > https://syzkaller.appspot.com/text?tag=CrashReport&x=13afb19cd00000 > > [...] > > > It might not actually be a wireguard bug? > > > > I wonder whether syzbot reported similar issues with > > CONFIG_KASAN_SW_TAGS. It shouldn't be that different from the HW_TAGS > > but at least we can rule out qemu bugs with the MTE emulation. > > +Eric I've seen some similar reports on other syzkaller instances. They all have similar alloc/free stacks, but different access stacks. This does not seem to be wireguard nor arm/mte related. It seems that something released the device prematurely, and then some innocent code gets a use-after-free. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel