Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4504128rwb; Tue, 6 Sep 2022 08:23:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Mg73SvAvv16ISY00J5ZzyeYY17f+qEbf8bwqFUEiSPNH3A4Knzd+IbJKNx8bM/l6b3wTI X-Received: by 2002:a05:6402:51c6:b0:43d:dd3a:196e with SMTP id r6-20020a05640251c600b0043ddd3a196emr48193951edd.213.1662477828720; Tue, 06 Sep 2022 08:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662477828; cv=none; d=google.com; s=arc-20160816; b=00YeEjtzp35pY1ygNuUv02LCtHYXNOBbkotuW4tH4FOA0ToVgEryKrZMzA3FYDUNw7 eS+ZUBEPJyI8CT8hxryoAe3/IFqPlljk/vI3RAr6JNpjxLLYZ8h65e9RgWhodOpp7joD Jffh0H+7ZPfcAMfSWeeBEKmKcw+t3YUbyKg+oZLjOoUBBve5eyq5eDeI32j+nKTpr75w vTrCzYLBbucnL6Nto4UC9CmZqMFTV9I0B41YXnu4rgte0JT4Z89bKnq6E9Av3sU2aINd tNypJqg6M8p6E5JYGkEVVk8oE+KRJWsHuMbg5Sjtdt4p3OS+OcPsHJHiN4PnYkjhw7w+ BM/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=72xqVB6II8JIqeGj83eozLwfyaFjnFCPJqRhcgBgkvQ=; b=f0AGXD/mEBnk1vf/MkzPt7z9fWeK+PcQme01ov2A7Eo/2WtmLhJJv4wSVyaJQefuTU HhMSW5vo+IT0d64dmEDGQ41WND+uyFzakt+KeMS1GlS6CkX4E8U2xoPgYU2Ocxs+z5V+ 1JRfXGoTzWHWWeKG8C3h+q9thW5F6XvTJBNG9uviDAQ1QOI0R54YGpFuaPzM4VIyvm1f 9zZBXJQBDlMCGyUUuDVlptxFK8EIOG4b30W5bSG83DQ8M+v1kw2xmx0Mppn/PivIZTi1 MCGde2NCmgo0a6yhn/CO9wmJfUJ2C05VJIdZZRD71IvVu5gLrUilip/RwqQvH8nCJrYc b2PQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e20-20020a056402191400b00447fb143ad4si437397edz.417.2022.09.06.08.23.16; Tue, 06 Sep 2022 08:23:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238882AbiIFPTg (ORCPT + 99 others); Tue, 6 Sep 2022 11:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233466AbiIFPTB (ORCPT ); Tue, 6 Sep 2022 11:19:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6569BBADB9 for ; Tue, 6 Sep 2022 07:31:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7629FB8164A for ; Tue, 6 Sep 2022 14:29:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20D93C433C1; Tue, 6 Sep 2022 14:29:53 +0000 (UTC) Date: Tue, 6 Sep 2022 15:29:50 +0100 From: Catalin Marinas To: Dmitry Vyukov Cc: Andrey Konovalov , Linux ARM , LKML , syzkaller-bugs , tongtiangen@huawei.com, Vincenzo Frascino , Kefeng Wang , Will Deacon , syzbot , Evgenii Stepanov , Peter Collingbourne Subject: Re: [syzbot] KASAN: invalid-access Read in copy_page Message-ID: References: <0000000000004387dc05e5888ae5@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 06, 2022 at 03:40:59PM +0200, Dmitry Vyukov wrote: > On Tue, 6 Sept 2022 at 15:24, Catalin Marinas wrote: > > On Mon, Sep 05, 2022 at 11:39:24PM +0200, Andrey Konovalov wrote: > > > Syzbot reported an issue with MTE tagging of user pages, see the report below. > > > > > > Possibly, it's related to your "mm: kasan: Skip unpoisoning of user > > > pages" series. However, I'm not sure what the issue is. > > [...] > > > On Sat, Aug 6, 2022 at 3:31 AM syzbot > > > wrote: > > > > BUG: KASAN: invalid-access in copy_page+0x10/0xd0 arch/arm64/lib/copy_page.S:26 > > > > Read at addr f5ff000017f2e000 by task syz-executor.1/2218 > > > > Pointer tag: [f5], memory tag: [f2] > > [...] > > > > The buggy address belongs to the physical page: > > > > page:000000003e6672be refcount:3 mapcount:2 mapping:0000000000000000 index:0xffffffffe pfn:0x57f2e > > > > memcg:fbff00001ded8000 > > > > anon flags: 0x1ffc2800208001c(uptodate|dirty|lru|swapbacked|arch_2|node=0|zone=0|lastcpupid=0x7ff|kasantag=0xa) > > > > It looks like a copy-on-write where the source page is tagged > > (PG_mte_tagged set) but page_kasan_tag() != 0xff (kasantag == 0xa). The > > page is also swap-backed. Our current assumption is that > > page_kasan_tag_reset() should be called on page allocation and we should > > never end up with a user page without the kasan tag reset. [...] > > Does it take long to reproduce this kasan warning? > > syzbot finds several such cases every day (200 crashes for the past 35 days): > https://syzkaller.appspot.com/bug?extid=c2c79c6d6eddc5262b77 > So once it reaches the tested tree, we should have an answer within a day. That's good to know. BTW, does syzkaller write tags in mmap'ed pages or only issues random syscalls? I'm trying to figure out whether tag 0xf2 was written by the kernel without updating the corresponding page_kasan_tag() or it was syzkaller recolouring the page. -- Catalin