Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2085705pxa; Mon, 24 Aug 2020 04:54:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJ9ZiYkpAUXEqxJvY34wPUKBjc1dgXdJYC+xcEZN18v6H82XM+eNdjxw0l4GROzKKNyqQq X-Received: by 2002:a17:906:f8d1:: with SMTP id lh17mr5051319ejb.409.1598270040295; Mon, 24 Aug 2020 04:54:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598270040; cv=none; d=google.com; s=arc-20160816; b=mQIuTdzIFjpTsISb1aE71gSZJ4Mw+7IG99tFypwaINNDTTi0Fay8w0JnmndUapKlKv Zyei2cuE2jENvDoy8wWW1OGZZCl/4VMgVX8Zdwc8YT9mWVkEUjzsDITLfju1EEDRVDOI rn3Gt8yNU2UdX7NCNV/8ZCs7RIpJnnC+yRU3tnTLXsRfm/u/xCOVkfyYoXlacgs7wo3l UVkUsqZxpeH0eQKx17L5qMVrlbVsugXN8DLAZO4PbaCCqDxvD9OM7gQuHkd/E4idxiF5 DH/RyT1wr4Wc+Hy5YFfBCv5tBmgCy6lmyfTclF3nyjsuBEcSdLzbu4fv3lpakE5vScLv iF5Q== 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=yJXg3YmJV9VmBBuMxTtghIxF3sII7GvdsrK6BwX4Nus=; b=ZZEBsjM9dofrcj98lN8xl06AgWzDekCF29NVbk7PLacbaQ9bPS6GWLhGLa6QQoyq9E ZRjrPjGYeOSOf6SnXJDF3nRW54MtMtAPDVECdVzMnCrSiWOgxKIH/O+FyVhdhW3sWt78 X+cBoRgWIkRyXRS3LE3nqM2kBjdQX7YgqczZFAoYseSaHGy3pzCeo6OIVKTUTQHucOIt 4FsGEs470I39fOf1QuuviVmSv6fTY4FQWqUupeO9MuRgb6ugGfdHpclzCLSHfCvDRduy tpt0gqFQT3gBSVpakONYVFoh5ZR4eXSXq2XZIAJQk60YdrcE21l3ZV1T2tix5ERhrAMg R0dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=oLyJ6GRK; 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 d19si4333645edx.221.2020.08.24.04.53.37; Mon, 24 Aug 2020 04:54:00 -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=oLyJ6GRK; 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 S1726727AbgHXLuX (ORCPT + 99 others); Mon, 24 Aug 2020 07:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbgHXLuU (ORCPT ); Mon, 24 Aug 2020 07:50:20 -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 9F4D0C061573 for ; Mon, 24 Aug 2020 04:50:20 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id o8so4277496otp.9 for ; Mon, 24 Aug 2020 04:50:20 -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=yJXg3YmJV9VmBBuMxTtghIxF3sII7GvdsrK6BwX4Nus=; b=oLyJ6GRKHTm1t7mgGpDwN4erpee2C2K8InRMviIFM7ItOZjfGHwrLx5AqYVOyiaj2H Sut0+dlkdVXZjAi7t6gZDvKzPxSlKEVjXEXukWfDse9h4cuaBBoHnh8nLCJnowemg/gp OBPAHWMwTO2x0X0nGFhP1VkCLuv2QlfwmAOgXeKwSFhOB1mhlIHVv9tX3val2OmziOqL KPTYLiXiQBhJxzN5Qip06U+Xx/adZQ8VHy13CgZ7WTjW3CJfkqFD3cc/vMOMqxFDP2d/ ci8FSMbFgXLLI+sGzo1XDEnZB+xvTYLArHLLB9OJ+Ku8Yj8EkrGjlqkkGP0s7pdstJok DJQw== 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=yJXg3YmJV9VmBBuMxTtghIxF3sII7GvdsrK6BwX4Nus=; b=UzvvEYhUU7k6Zk98ezHVRKaUZ+GQnr8ag1K6eMhTHbJntoXWOVPwth4sHxaXCYtkG6 WBA9O3VZVDMC5N/JUJO/XB9//GCp6dl8o/51x86/Dr+IUbnAX8tmwA71/rrsBjCqnv6b j4DDFvril9+uPfUpRU2PeWcFJy3+nSW1QFNHKCmU7g94nDnvFK/RapmrpZV6WVd7QQWf 5fbcO8DshFas/g8ti3S9rn9uVYuXXTi92EDO5SJOPlcS1vvQhoTS/xngkwa1RbWPqfUC MVQ65r+APCzllUDaM1BJESFlZLfyCrxony9KnMMjwyBH6eBaAFYkFm0NKrq/w5z9wjp4 foIA== X-Gm-Message-State: AOAM531ObG0CYYcBSQDu2Gg030DXva7PfW1L4W9QwJcsSGeIQTcoR0+e aDyZD42vN6lwpfMQC7FX9ZR94oU/GgMzOhYZ8NwoXQ== X-Received: by 2002:a9d:739a:: with SMTP id j26mr3480830otk.17.1598269819856; Mon, 24 Aug 2020 04:50:19 -0700 (PDT) MIME-Version: 1.0 References: <20200824080706.24704-1-walter-zh.wu@mediatek.com> In-Reply-To: <20200824080706.24704-1-walter-zh.wu@mediatek.com> From: Marco Elver Date: Mon, 24 Aug 2020 13:50:08 +0200 Message-ID: Subject: Re: [PATCH v2 0/6] kasan: add workqueue and timer stack for generic KASAN To: Walter Wu Cc: Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , John Stultz , Stephen Boyd , Andrew Morton , Tejun Heo , Lai Jiangshan , kasan-dev , Linux Memory Management List , LKML , Linux ARM , wsd_upstream , linux-mediatek@lists.infradead.org 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:07, Walter Wu wrote: > > Syzbot reports many UAF issues for workqueue or timer, see [1] and [2]. > In some of these access/allocation happened in process_one_work(), > we see the free stack is useless in KASAN report, it doesn't help > programmers to solve UAF on workqueue. The same may stand for times. > > This patchset improves KASAN reports by making them to have workqueue > queueing stack and timer queueing stack information. It is useful for > programmers to solve use-after-free or double-free memory issue. > > Generic KASAN will record the last two workqueue and timer stacks, > print them in KASAN report. It is only suitable for generic KASAN. > > [1]https://groups.google.com/g/syzkaller-bugs/search?q=%22use-after-free%22+process_one_work > [2]https://groups.google.com/g/syzkaller-bugs/search?q=%22use-after-free%22%20expire_timers > [3]https://bugzilla.kernel.org/show_bug.cgi?id=198437 > > Walter Wu (6): > timer: kasan: record timer stack > workqueue: kasan: record workqueue stack > kasan: print timer and workqueue stack > lib/test_kasan.c: add timer test case > lib/test_kasan.c: add workqueue test case > kasan: update documentation for generic kasan > > --- > > Changes since v1: > - Thanks for Marco and Thomas suggestion. > - Remove unnecessary code and fix commit log > - reuse kasan_record_aux_stack() and aux_stack > to record timer and workqueue stack. > - change the aux stack title for common name. Much cleaner. In general, Acked-by: Marco Elver but I left some more comments. I'm a bit worried about the tests, because of KASAN-test KUnit rework, but probably not much we can do until these are added to -mm tree. Thanks, -- Marco