Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp22793iob; Mon, 2 May 2022 11:02:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO6lmIwlS5R1yjIVgnvUxJC1iGLt1YMKFd+TMfaN9gy9pYcQZPaYA2apDdSt7OLdgKkxCB X-Received: by 2002:a05:6512:e86:b0:472:60c3:8430 with SMTP id bi6-20020a0565120e8600b0047260c38430mr6042893lfb.226.1651514573380; Mon, 02 May 2022 11:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651514573; cv=none; d=google.com; s=arc-20160816; b=SxLr8/8x45oPhcE+3WqbysVQ/FOqUZkb8shCksPzdjvyWnAghPOR0PaCfKley8AHIu UCwgkVfQ8sJNdKTQFblWf2tvPYOcrNN9e3zZjCZVftG5sv399VapTc3WT0CrlIRqeQ9w 1w2GA83DdFHuk9bPMGaHxxn/6WdTKR5YJVxds6nMa4OzLvpykQSGYUj4x6ru24eeAtph H70wxLTXl20Omp3EgkswKREpPVKOX9CwhYKCRPN1VHOrl11P1Xtdv2AuBglTpTvL3uuv Q+Ay4IuCai2TR1NNLMvzu/jKrmfE98RrTGeuZki/bbMHO1PhsdYvpTsSvsHf4zZxBzHI Nbxw== 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:dkim-signature; bh=c4OmeIZ6y+f2JRwt4I1DekUCqDfEai6t2MRiaiReNuU=; b=tZRQBBgkxBqWoWnQNu2WM/eIJq+zFnB5Qud2zM0Rc/eeiZcTVxVA4WfsZfXavgPvQ4 6K4IFL9xmGxN4sL5N/ExX88IRej1XSMLnOSDL+6i8AQDBFvERAiC/iEXpDxKzAI1CzGS I6bCvAvSmyGf1qpPjznZjoRxoveeBLCT97/m3u5Ap5b01KEg71OzbLBDKyc0dcUCP3HY oyClBC85wV6Cc69VNHPr1zISNM+qP+ElnYMVtSwA76+ZUwLP1eGPz0/WaqsqsAG/RnxL wGNP6KusUmYNjvZAdOrGfWQ/iSOJdrNOA2Q5hXsDC1OYDyF9q5966IN6FbabjAMCvjOd 2tTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=ToK9CeE7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020a0565120b1200b004720520b772si17019474lfu.158.2022.05.02.11.01.57; Mon, 02 May 2022 11:02:53 -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; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=ToK9CeE7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348139AbiD1ORS (ORCPT + 99 others); Thu, 28 Apr 2022 10:17:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230021AbiD1ORQ (ORCPT ); Thu, 28 Apr 2022 10:17:16 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E65EB53CB for ; Thu, 28 Apr 2022 07:14:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1651155242; x=1682691242; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=c4OmeIZ6y+f2JRwt4I1DekUCqDfEai6t2MRiaiReNuU=; b=ToK9CeE7zntyztH+u2THAsAMEXEdiBuoeewP7yfyvEcTkYJ4UTpfiRUC jjhCQe/biTYz5AQQ+EqcnkAlheJ9BSoH9fkgN/2mrEBCt/7zxE/rMzT/T v1cXiZvwGgKIob0uYfKk7sYwAs38kfshK/vp1dz/cTkishJhTEQaDyuoJ U=; Received: from unknown (HELO ironmsg01-sd.qualcomm.com) ([10.53.140.141]) by alexa-out-sd-02.qualcomm.com with ESMTP; 28 Apr 2022 07:14:01 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg01-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Apr 2022 07:14:01 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 28 Apr 2022 07:14:01 -0700 Received: from qian (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 28 Apr 2022 07:13:59 -0700 Date: Thu, 28 Apr 2022 10:13:56 -0400 From: Qian Cai To: CC: Andrew Morton , Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , , , Vincenzo Frascino , Catalin Marinas , Will Deacon , Mark Rutland , , "Peter Collingbourne" , Evgenii Stepanov , , Andrey Konovalov Subject: Re: [PATCH v6 00/39] kasan, vmalloc, arm64: add vmalloc tagging support for SW/HW_TAGS Message-ID: <20220428141356.GB71@qian> References: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 Mon, Jan 24, 2022 at 07:02:08PM +0100, andrey.konovalov@linux.dev wrote: > From: Andrey Konovalov > > Hi, > > This patchset adds vmalloc tagging support for SW_TAGS and HW_TAGS > KASAN modes. > > The tree with patches is available here: > > https://github.com/xairy/linux/tree/up-kasan-vmalloc-tags-v6 > > About half of patches are cleanups I went for along the way. None of > them seem to be important enough to go through stable, so I decided > not to split them out into separate patches/series. > > The patchset is partially based on an early version of the HW_TAGS > patchset by Vincenzo that had vmalloc support. Thus, I added a > Co-developed-by tag into a few patches. > > SW_TAGS vmalloc tagging support is straightforward. It reuses all of > the generic KASAN machinery, but uses shadow memory to store tags > instead of magic values. Naturally, vmalloc tagging requires adding > a few kasan_reset_tag() annotations to the vmalloc code. > > HW_TAGS vmalloc tagging support stands out. HW_TAGS KASAN is based on > Arm MTE, which can only assigns tags to physical memory. As a result, > HW_TAGS KASAN only tags vmalloc() allocations, which are backed by > page_alloc memory. It ignores vmap() and others. I could use some help here. Ever since this series, our system starts to trigger bad page state bugs from time to time. Any thoughts? BUG: Bad page state in process systemd-udevd pfn:83ffffcd page:fffffc20fdfff340 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x83ffffcd flags: 0xbfffc0000001000(reserved|node=0|zone=2|lastcpupid=0xffff) raw: 0bfffc0000001000 fffffc20fdfff348 fffffc20fdfff348 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set page_owner info is not present (never set?) CPU: 76 PID: 1873 Comm: systemd-udevd Not tainted 5.18.0-rc4-next-20220428-dirty #67 Call trace: dump_backtrace show_stack dump_stack_lvl dump_stack bad_page free_pcp_prepare free_unref_page __free_pages free_pages.part.0 free_pages kasan_depopulate_vmalloc_pte (inlined by) kasan_depopulate_vmalloc_pte at mm/kasan/shadow.c:361 apply_to_pte_range apply_to_pmd_range apply_to_pud_range __apply_to_page_range apply_to_existing_page_range kasan_release_vmalloc (inlined by) kasan_release_vmalloc at mm/kasan/shadow.c:469 __purge_vmap_area_lazy purge_vmap_area_lazy alloc_vmap_area __get_vm_area_node.constprop.0 __vmalloc_node_range module_alloc move_module layout_and_allocate load_module __do_sys_finit_module __arm64_sys_finit_module invoke_syscall el0_svc_common.constprop.0 do_el0_svc el0_svc el0t_64_sync_handler el0t_64_sync Disabling lock debugging due to kernel taint BUG: Bad page state in process systemd-udevd pfn:83ffffcc page:fffffc20fdfff300 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x83ffffcc flags: 0xbfffc0000001000(reserved|node=0|zone=2|lastcpupid=0xffff) raw: 0bfffc0000001000 fffffc20fdfff308 fffffc20fdfff308 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set page_owner info is not present (never set?) CPU: 76 PID: 1873 Comm: systemd-udevd Tainted: G B 5.18.0-rc4-next-20220428-dirty #67 Call trace: dump_backtrace show_stack dump_stack_lvl dump_stack bad_page free_pcp_prepare free_unref_page __free_pages free_pages.part.0 free_pages kasan_depopulate_vmalloc_pte apply_to_pte_range apply_to_pmd_range apply_to_pud_range __apply_to_page_range apply_to_existing_page_range kasan_release_vmalloc __purge_vmap_area_lazy purge_vmap_area_lazy alloc_vmap_area __get_vm_area_node.constprop.0 __vmalloc_node_range module_alloc move_module layout_and_allocate load_module __do_sys_finit_module __arm64_sys_finit_module invoke_syscall el0_svc_common.constprop.0 do_el0_svc el0_svc el0t_64_sync_handler el0t_64_sync