Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1452814pxk; Sun, 13 Sep 2020 03:18:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyagvjYwp3hkBvcZ/yZiRbj/69ToPOsZ77aD0I+07aSDIB21iIWVUXqp8XJNOAe954fTccX X-Received: by 2002:aa7:dd0d:: with SMTP id i13mr12286256edv.314.1599992325136; Sun, 13 Sep 2020 03:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599992325; cv=none; d=google.com; s=arc-20160816; b=NEdAZTOeIfhwUY4HmxmFaaKnTEMDjCSJJNDwSZJTCr6FokYg3AXMSETgqUd0UHsFIa iHzti0iYk3MIhcftv238KTZmiYXUmNiywb7sQYOOj5dHKf19MJE/F6jlyLRDPAEskHm6 22LhhYgP0bZLHuXjmoI/vSNZBWs4iXMDp6yYXAVqVTJ4gBkGDLbjK1BZX8jsNFThyFAG X4CYp6JtcmHk0HQuApl5Ypm56l49KzaGayCptaaWJdEHJeUDmvEBcE7ttAcnWr1XnuGY wQD+aittjF8BADcsxNrtS9mEGs5AeiUjtve8d9HN93dBNqAJW8VUZIdSmuThGln5a6c0 5RqQ== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=2/rTINPcp/OFtffjcOu1onBIlOhuthR1U8PEEQixv6o=; b=ljUD8xKCsIdPmTJpC6mLLGHCNVZf7e5ShHOK7fgDUg/MDf85RQGvbqm8q2URMHd7+5 CIw+WQYlyFLX2711dcfMMnpj6c0Uq6j9DwJcR+q87n3/pg/TpZXIO8gDBRNLd+BQRmbY KocamnyTgO7+oult5Ej2RfWbhndw3wMpEVEgBQ/s4j9WdV5wy+l2SP7FKveQHuvSE3tt I6r224uOEWihQPzUZBHo3NB7gzFam0zC9ykuxn+9vq1NQ0YKa9BKpUiSI7oCTHN7huVL saSdtK9ETuI/TI9SVXALHLIvKdrO5GzJWXEjMCiBC+91Xp0K0J4mbFe6SnBGjkrBeP6/ crww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=nyykmS9A; 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 b6si4816395eja.208.2020.09.13.03.18.22; Sun, 13 Sep 2020 03:18:45 -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=nyykmS9A; 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 S1725938AbgIMKRv (ORCPT + 99 others); Sun, 13 Sep 2020 06:17:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbgIMKRr (ORCPT ); Sun, 13 Sep 2020 06:17:47 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FA79C061573 for ; Sun, 13 Sep 2020 03:17:47 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id o16so14183721qkj.10 for ; Sun, 13 Sep 2020 03:17:47 -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:content-transfer-encoding; bh=2/rTINPcp/OFtffjcOu1onBIlOhuthR1U8PEEQixv6o=; b=nyykmS9AkG4i9TMnFMtKZHTav1DMaE8SUFI+3OiVcdw3B0DLu+pwVWzwQ6kGDjXf+l K7px0dO6gMMsvi3FkubJfozBEGHG+rP93NI06PRHsQgki8OoPHqY4TXz13GUqzh7kCbd eNxIqk344Vpp0aL3iLW26m4v2V5FRN8BDQVamB8DMWFVrdn5Qah6vQTLKhO0Wcbgi3Lw nasjdseAWfh5Qv3irs0+8a5dzF3edJvciMdqoCgZAggoLv6zwMFraDCMREsb8aernu5v dqog9E6ULf0mB0oCupoPtZXG7qAqgf8qf6NbYBR8vFecPrkM+QmWOQrwLg7/iw0aaUS+ w0Nw== 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:content-transfer-encoding; bh=2/rTINPcp/OFtffjcOu1onBIlOhuthR1U8PEEQixv6o=; b=BSZr/74yXAcpSAN5UZFO/T7N2HhSYSrFgcmwP2csfsGvcONtC0sJAJOto+n46EwogI EU1x+Kh2OcIvog1XlTi1862oxMDgW+7mWbRK10o1nDqsqqrV+vckHRJLo+aKZ4Dwxwsq v3o1ews+ta97+2te3YONQeZeKb+VArxWL7KbnKCPsgjEjqpOZVaInmJh6oPpw+MpDYnn +OhjGIHV3enClETrhTRoFuT3q8qTFZ4hxQ3rHwqKh8BvBqCXM0dFm8GGEZUUAUH2bf/o P9CxW6P9ZERz/a3LTUPjPXVv+FiYraoA/UpZj0t8mpK/nmBHxzMhmPs95NxeWWqAkm1f vIcQ== X-Gm-Message-State: AOAM530YN6nqc8DvWzAat41HxFh9l/m3SWwLaydNcmrIW4eUbUBFtE2m cIHJtu5hFGzpVYKWSpd6JaZrm00IXXLpPooXb66L6g== X-Received: by 2002:a37:5684:: with SMTP id k126mr8015895qkb.43.1599992264608; Sun, 13 Sep 2020 03:17:44 -0700 (PDT) MIME-Version: 1.0 References: <20200825015654.27781-1-walter-zh.wu@mediatek.com> In-Reply-To: From: Dmitry Vyukov Date: Sun, 13 Sep 2020 12:17:33 +0200 Message-ID: Subject: Re: [PATCH v3 0/6] kasan: add workqueue and timer stack for generic KASAN To: Andrey Konovalov Cc: Marco Elver , Walter Wu , Andrey Ryabinin , Alexander Potapenko , 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" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 26, 2020 at 2:30 PM 'Andrey Konovalov' via kasan-dev wrote: > > On Tue, Aug 25, 2020 at 10:26 AM 'Marco Elver' via kasan-dev > wrote: > > > > On Tue, 25 Aug 2020 at 03:57, Walter Wu wro= te: > > > > > > 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 stack information. It is useful for programm= ers > > > to solve use-after-free or double-free memory issue. > > > > > > Generic KASAN also records the last two workqueue and timer stacks an= d > > > prints them in KASAN report. It is only suitable for generic KASAN. > > > > > > [1]https://groups.google.com/g/syzkaller-bugs/search?q=3D%22use-after= -free%22+process_one_work > > > [2]https://groups.google.com/g/syzkaller-bugs/search?q=3D%22use-after= -free%22%20expire_timers > > > [3]https://bugzilla.kernel.org/show_bug.cgi?id=3D198437 > > > > > > 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 > > > > Acked-by: Marco Elver > > Reviewed-by: Andrey Konovalov Reviewed-by: Dmitry Vyukov Thanks! The UAF reports with RCU stacks that I see now are just =F0=9F=94= =A5=F0=9F=94=A5=F0=9F=94=A5 > > > --- > > > > > > Changes since v2: > > > - modify kasan document to be more readable. > > > Thanks for Marco suggestion. > > > > > > 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. > > > > > > --- > > > > > > Documentation/dev-tools/kasan.rst | 4 ++-- > > > kernel/time/timer.c | 3 +++ > > > kernel/workqueue.c | 3 +++ > > > lib/test_kasan.c | 54 ++++++++++++++++++++++++++++++= ++++++++++++++++++++++++ > > > mm/kasan/report.c | 4 ++-- > > > 5 files changed, 64 insertions(+), 4 deletions(-) > > > > > > -- > > > You received this message because you are subscribed to the Google Gr= oups "kasan-dev" group. > > > To unsubscribe from this group and stop receiving emails from it, sen= d an email to kasan-dev+unsubscribe@googlegroups.com. > > > To view this discussion on the web visit https://groups.google.com/d/= msgid/kasan-dev/20200825015654.27781-1-walter-zh.wu%40mediatek.com. > > > > -- > > You received this message because you are subscribed to the Google Grou= ps "kasan-dev" group. > > To unsubscribe from this group and stop receiving emails from it, send = an email to kasan-dev+unsubscribe@googlegroups.com. > > To view this discussion on the web visit https://groups.google.com/d/ms= gid/kasan-dev/CANpmjNOvj%2B%3Dv7VDVDXpsUNZ9o0%2BKoJVJs0MjLhwr0XpYcYQZ5g%40m= ail.gmail.com. > > -- > You received this message because you are subscribed to the Google Groups= "kasan-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an= email to kasan-dev+unsubscribe@googlegroups.com. > To view this discussion on the web visit https://groups.google.com/d/msgi= d/kasan-dev/CAAeHK%2ByVShDPCxVKDsO_5SwoM2ZG7x7byUJ74PtB7ekY61L2YQ%40mail.gm= ail.com.