Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2084998pxa; Mon, 24 Aug 2020 04:52:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyQIxemPb607OH/2jGD+7IesEzqTWeRuG99JqljwROB1xnDrAg2K2jrQ4Jo0+PmJON8X8x X-Received: by 2002:a17:907:447d:: with SMTP id oo21mr5329172ejb.462.1598269961420; Mon, 24 Aug 2020 04:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598269961; cv=none; d=google.com; s=arc-20160816; b=opQDn0SuCwQw8klyXl4AyL+NXQZ/Q9KQrFLUKX4aeR8wToyLuZhhdUyzufFNjnPWP/ zcMDMNgYIBd8Qwno4iiCWJRNAW6UGoBb6j/VoERWiByaSYKoadGwrnnthaaQEsUq3ZWo d3tge5N/KoAzRdYMbhRFydmtFHDixaVNSCtAS2VgGleADn8fH2dAlkIDLpijwCgxtx93 yeHRb//c8pirH0cWH+zH1lWdNltyETdzdY02ujEhFCfcJ3+7PTW9acgU2+Zq3JanQ6EJ cZLt30dAlwnBb3eYIK+P7BzSLGzEOpoObLsB69LJxTtfuETVH7Y/3VYdLrKZfJ6g7jB8 3uVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IfIxkLsRxova3XYkDm6i/K8H2HRLaB3EQ7huQjW3f6w=; b=Z6yiZ9leT+noJvoe+21sZsGjp0al0587Itmiu3t+ryafg0SFxvT7B0C/ECfVWW+hvQ KcoDMUVTU/aENHQTmBkbsZRxxC4335SOOOPa++qNs4JOcd/w+y0j3YALuB5q7i93pZTU Vz70+mHXUK5wtGQX8XdtJR1Fl0EfcY3JZIzq16WEoqKKnpS53DEbks+AlrZTXo4+XgTE 8Y02vKrLNNP9YXP2P9sC1BYY0dtZeL4gjPJMZ6cWOV6gpZ0Ra0LqJguvxrCTj+5FsiJy KAtD+Z7lv5oZDOsrYalDczclPlJaYVVFeqthSnwRCOJxDsThDlEpvVFAka38MAmnE6If O0cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ifu4mAhc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n11si6707751edy.433.2020.08.24.04.52.17; Mon, 24 Aug 2020 04:52:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ifu4mAhc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726466AbgHXLt3 (ORCPT + 99 others); Mon, 24 Aug 2020 07:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbgHXLt1 (ORCPT ); Mon, 24 Aug 2020 07:49:27 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5D93C061573 for ; Mon, 24 Aug 2020 04:49:26 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id i13so2126819otc.5 for ; Mon, 24 Aug 2020 04:49:26 -0700 (PDT) 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=IfIxkLsRxova3XYkDm6i/K8H2HRLaB3EQ7huQjW3f6w=; b=ifu4mAhcTRgtT25z97rVnVLSZIehYoWZP8njiAuMAclckn9QF6jbVP9Hz7Htj0eApu mAtaaK9Vv7vTMujUpSkvkdv59rffw4S+b4wo7FklQ4IG/DkO+lejrQgJuaRUVn5yPkkf Ugo6AK2ksLHd7xu8urFifQ5nbrZf01NR6zdW3IrCwjZ2bEo68yYEKe+C3635MLiW5BSV Mmy+tihlpl7pk1aBdkegmzmwQtmMwLz+rebJoqtGTgAG8H+Fr6z5tMjoYOB8Diw+cuRa 7z2JPsLcyQRrjG2k9P3H0xHTrBpndrxWp3GysVNseNU2L1WSHLLP7FLCS1SQXOXp1UY8 EWWg== 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=IfIxkLsRxova3XYkDm6i/K8H2HRLaB3EQ7huQjW3f6w=; b=kjgbqGYv+KsarhRFkTrUPiYVobrfuVOVBoF+9ypgW36b0I3or+bHatfpKgc+7Y7jMU V5n4FzxNAoUfCV7bu68nz5eyMosnu1mGBire0ojbqJGz0kFMyPQFiHxl+zItnt3mVpbE dh4yzXwzxhj+QctsVKxgcR4ztWOy9iqRW1b0a+9l4104zMTQd7wN3+XNBnUyCD8ZLaZt YntqRCPG6NlqGyhm9uQ5n0mk5TDOawo+Yaw/ggHlT6/ux/c3H+exjibA/fXcrp9MNKQh GwjVKKg5JimVoQoQ127byFOAYUYYoddbGnDnjkA3eYYkDUKxGqyoMHvc/LmPxgoQZKGV 1nfw== X-Gm-Message-State: AOAM532J8na+M0iC5bc5xpBAP9N2V2gefwzWE5jtL0cY9I4dcZK45MWI rfL+wciUbYz6tg3M0ck+5nRNCC2bV5OYUktpyrHBGw== X-Received: by 2002:a05:6830:1612:: with SMTP id g18mr3040756otr.251.1598269765865; Mon, 24 Aug 2020 04:49:25 -0700 (PDT) MIME-Version: 1.0 References: <20200824081353.25148-1-walter-zh.wu@mediatek.com> In-Reply-To: <20200824081353.25148-1-walter-zh.wu@mediatek.com> From: Marco Elver Date: Mon, 24 Aug 2020 13:49:14 +0200 Message-ID: Subject: Re: [PATCH v2 5/6] kasan: add tests for workqueue stack recording To: Walter Wu Cc: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , kasan-dev , Linux Memory Management List , LKML , Linux ARM , wsd_upstream , linux-mediatek@lists.infradead.org, Andrey Konovalov 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 On Mon, 24 Aug 2020 at 10:14, Walter Wu wrote: > > Adds a test to verify workqueue stack recording and print it in > KASAN report. > > The KASAN report was as follows(cleaned up slightly): > > BUG: KASAN: use-after-free in kasan_workqueue_uaf > > Freed by task 54: > kasan_save_stack+0x24/0x50 > kasan_set_track+0x24/0x38 > kasan_set_free_info+0x20/0x40 > __kasan_slab_free+0x10c/0x170 > kasan_slab_free+0x10/0x18 > kfree+0x98/0x270 > kasan_workqueue_work+0xc/0x18 > > Last potentially related work creation: > kasan_save_stack+0x24/0x50 > kasan_record_wq_stack+0xa8/0xb8 > insert_work+0x48/0x288 > __queue_work+0x3e8/0xc40 > queue_work_on+0xf4/0x118 > kasan_workqueue_uaf+0xfc/0x190 > > Signed-off-by: Walter Wu > Cc: Andrey Ryabinin > Cc: Dmitry Vyukov > Cc: Alexander Potapenko > Cc: Matthias Brugger > Cc: Andrey Konovalov > --- > lib/test_kasan.c | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) These will majorly conflict with the KASAN-test KUnit rework, which I don't know what the status is. AFAIK, these are not yet in -mm tree. I think the KASAN-test KUnit rework has priority, as rebasing that work on top of this patch is going to be difficult. So maybe these test additions can be declared optional if there are conflicts coming, and if that'll be the case you'll have to rebase and resend the test. Thanks, -- Marco