Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2154697pxa; Mon, 24 Aug 2020 06:47:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2SqFq9OdhD4ZZ/nSijqTu8+1id5691mfYXVLEf3+x3hXTnNDup9ysBbYD1phC7IzoZxJi X-Received: by 2002:a05:6402:c9b:: with SMTP id cm27mr4739462edb.50.1598276831262; Mon, 24 Aug 2020 06:47:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598276831; cv=none; d=google.com; s=arc-20160816; b=ljyJwilGNWyL6mz9OR6Kb0tlZHFQBXqCv9OvDXYePegxXCp/1HMHWiv06LAX48CuVp fR1QSHgYXs9r4x+IZvzkmuPfYAQUtBancmaxYY73VIeYlVrbmyIS5ot9Sy92h2CoO0Qt tWQzPHWA+mF7aBcrwEtgpxZcd+H+K3+QgZgdUulampjje9jJJyzhfGSCstHIA2VuxO// RS4uyOINd78ytnuckN2FD5wYuq5dZt3eNkXPNuFC1HO+k4tmwB1tLNXZa82bjAZ80HlZ fpWCuM6nr1eJV/tfHc8NFzFmN0wsPZlTkaU2SDBIz2dmuqCKIcBqRFJDwxq9JVcLUwaB XZdQ== 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=kCkJ5WyjWp/vo15sfOy04O9dC6dPdDe+nxNNjru5ZGQ=; b=cAXtbmOW3ZVmdjrywlaECcxvbOnNWXytJxL0qj/MJY9eL6zjWQtJ3qN78qTOsx3k5L EP7BAn1HtIYuP5DJ8ZBfAuaj3MUciDx+9UDOeMwDwQWEgswTMzOgLox8oaEgsRfJG9Sn lQX7Ip8fPeseayg5IAvO1+Jo5RXFqDTtWKDmTTCj9Hhs2VKN/0YIljC76H4AIzp9uAPU VyveglQzLExGvSpDSVZpNqZI44Y4wsL/GdDl65GEMRO4okoJTwLYhfSF2mzrdwrDGec9 AyhTHjC+kHEnft49pyfhsyiXT1lG7/QuZbDExikbW91CXv0SRbjaw88N7AYea+I31oKC ufDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=L4Ekwisf; 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 f11si6580495ejr.96.2020.08.24.06.46.48; Mon, 24 Aug 2020 06:47:11 -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=L4Ekwisf; 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 S1726461AbgHXNqM (ORCPT + 99 others); Mon, 24 Aug 2020 09:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725963AbgHXNqJ (ORCPT ); Mon, 24 Aug 2020 09:46:09 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5EB3C061573 for ; Mon, 24 Aug 2020 06:46:08 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id v16so4261683plo.1 for ; Mon, 24 Aug 2020 06:46:08 -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=kCkJ5WyjWp/vo15sfOy04O9dC6dPdDe+nxNNjru5ZGQ=; b=L4Ekwisfob8lARUVm4IHX3FSJQrLhsxH1pNhXY+IU4Jl5JmiwnHFq4kC+ZkoUgOmTF oRxm0wToaEKJKO4tLNn6/l/IbT/fPOEy8H5nh0aJGhI8AJPtc3yAZkw3Pklb8nDKpVTZ sb+l2wno0t2WM3QWkGJPS2hXaU5ciwx7kBOSduO8r9OP/phqdKZ70GrZuTjvtp43wuvd zi2orafnwRsVj9eU9Gzv2Z9QJenI/AXGEIZGjWwxssOBvL6wdxgf1Wd5MugS4Gu4Dq+u gNOJJ+kFq8iLGHNcGlIQvv6gEbWiOXgCP/msm39irv9GzYAwCC22QJe/X5ND0WU7nSvx +kPw== 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=kCkJ5WyjWp/vo15sfOy04O9dC6dPdDe+nxNNjru5ZGQ=; b=LD3AzLc/3EkpUk/j6PTAfpeiU3Zb3GSAA5WJoE3sSBaNenR1LYWpDTKk99PYu1sevQ 8VmKd76/qfMJP9RJ/iQdD49jKMITi7wprp2053sb2Kr/h6vmHMA9WfqF2YobubED1Mqt QEW1ooVz5qNqSW6i7mCm/k3oDKm+CANpinSvfnSFE1O4CVfyopzIFNgXhqSlj6Ra7e28 7HA+US0gF+oJ2aGa1Zy6PnWQDKQZcXnNWijBl9FKEzpeXoSa440riV9tFy77RTt2Kd8e +2CpdJG/1BdLlYrmTcm6hexCH3kFAlUn85UfMtMM11qw5vgyfT/6ne5SmgvyNoALFLL0 CVFg== X-Gm-Message-State: AOAM5308iTXM0ljfL5RlYHeQfwCCjqAQBbaKgmdESMIcf+hVnxm/1aUd OHXK8nlFSM5hm0Oj7ePlblSwkV/giUjlPPSivZxydg== X-Received: by 2002:a17:902:6944:: with SMTP id k4mr3098268plt.147.1598276768239; Mon, 24 Aug 2020 06:46:08 -0700 (PDT) MIME-Version: 1.0 References: <20200824081353.25148-1-walter-zh.wu@mediatek.com> In-Reply-To: From: Andrey Konovalov Date: Mon, 24 Aug 2020 15:45:56 +0200 Message-ID: Subject: Re: [PATCH v2 5/6] kasan: add tests for workqueue stack recording To: Marco Elver Cc: Walter Wu , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Matthias Brugger , 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, Aug 24, 2020 at 1:49 PM Marco Elver wrote: > > 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've asked Andrew to take those in 5.9, but that didn't happen. Perhaps we should ping him again after Plumbers. > 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. Yeah, either waiting for KASAN+Kunit or separating the tests sounds like plausible approaches.