From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F1AB23EAB3 for ; Tue, 2 Dec 2025 16:35:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764693323; cv=none; b=sedoV4av/qIeJRt1bD0kK8G7SWcjhiOQ5yvRkPrL6kCS0/szxhUiU5DWVchWBeA6TPTgameu4PiNjVbFDz8dj+bs6XzPmdpiYHf84szB+L0w/clZRSSTlhf+K9+o0qH9O5TbZSDEWn8bHShU7TuTS+4DHc9BsW0irpXby98FRIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764693323; c=relaxed/simple; bh=c+Kw4G6wwW9KQPvFyW4u+wQDqUJ09F/jHiMPVKzRiuk=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=ejGXrybtx/vFYCAS00GMUCWoW6XE8ya6sf/v6UvMny7TD03SsTJdPsFzDddzDkrqU82ihKrSApYTqKYFebeZ/hWjaDE/HL3byQYjdUdsOWvAsYXD7ADNiI8KGjpEfrmGAbor8i0ObtXGNCISO6GrzvMP4jeKMCSANrkBwNDrE1U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=NPe3ok8n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="NPe3ok8n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1859C4CEF1; Tue, 2 Dec 2025 16:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1764693323; bh=c+Kw4G6wwW9KQPvFyW4u+wQDqUJ09F/jHiMPVKzRiuk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NPe3ok8nBKe2DJvZhBsyauenQK8LKJFBFScGEqUtqR2a2ikTZsDl/eK7D/l+2u+bZ tY8neLan5PBXVDYTxW4ojOg6p8ZrgkSAOPMXnAymaL3qvFhYiybjklQ/6as4LeeFwJ ej2vkymWpEg3pf+3vPreHggtPcFWrc52DWbkJ2TI= Date: Tue, 2 Dec 2025 08:35:22 -0800 From: Andrew Morton To: Maciej Wieczor-Retman Cc: urezki@gmail.com, elver@google.com, vincenzo.frascino@arm.com, glider@google.com, dvyukov@google.com, ryabinin.a.a@gmail.com, andreyknvl@gmail.com, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, maciej.wieczor-retman@intel.com, Jiayuan Chen Subject: Re: [PATCH v2 0/2] kasan: vmalloc: Fix incorrect tag assignment with multiple vm_structs Message-Id: <20251202083522.1b0349117b9159b891808532@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 02 Dec 2025 14:27:56 +0000 Maciej Wieczor-Retman wrote: > A KASAN tag mismatch, possibly resulting in a kernel panic, can be > observed on systems with a tag-based KASAN enabled and with multiple > NUMA nodes. Initially it was only noticed on x86 [1] but later a similar > issue was also reported on arm64 [2]. > > Specifically the problem is related to how vm_structs interact with > pcpu_chunks - both when they are allocated, assigned and when pcpu_chunk > addresses are derived. > > When vm_structs are allocated they are tagged if vmalloc support is > enabled along the KASAN mode. Later when first pcpu chunk is allocated > it gets its 'base_addr' field set to the first allocated vm_struct. > With that it inherits that vm_struct's tag. > > When pcpu_chunk addresses are later derived (by pcpu_chunk_addr(), for > example in pcpu_alloc_noprof()) the base_addr field is used and offsets > are added to it. If the initial conditions are satisfied then some of > the offsets will point into memory allocated with a different vm_struct. > So while the lower bits will get accurately derived the tag bits in the > top of the pointer won't match the shadow memory contents. > > The solution (proposed at v2 of the x86 KASAN series [3]) is to tag the > vm_structs the same when allocating them for the per cpu allocator (in > pcpu_get_vm_areas()). > > Originally these patches were part of the x86 KASAN series [4]. > > The series is based on 6.18. This series overlaps a lot with https://lkml.kernel.org/r/20251128111516.244497-1-jiayuan.chen@linux.dev Please discuss! > [1] https://lore.kernel.org/all/e7e04692866d02e6d3b32bb43b998e5d17092ba4.1738686764.git.maciej.wieczor-retman@intel.com/ > [2] https://lore.kernel.org/all/aMUrW1Znp1GEj7St@MiWiFi-R3L-srv/ > [3] https://lore.kernel.org/all/CAPAsAGxDRv_uFeMYu9TwhBVWHCCtkSxoWY4xmFB_vowMbi8raw@mail.gmail.com/ > [4] https://lore.kernel.org/all/cover.1761763681.git.m.wieczorretman@pm.me/ >