From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD0F04219EB for ; Tue, 26 May 2026 18:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779820206; cv=none; b=BFmTmcMBdsXHJJp++fypYrqRA9ATFlDIUQLwojpQWB+7WWcLU/OPqSgJGZLVi4LRrrQF8dc3gXDcvQeO1gcDKOs1KaziXkXxag2zH2yKx/Eyajg2C7lD3/wXy6192dbYRuU945//ZHn7mVsqt7npmKqTDlqE6bRGiDaladAYgLQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779820206; c=relaxed/simple; bh=6vvHGcSi157N+oB7lexlZ4A6+hiMatNMYIGzRqF2drI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=T0ga4aEHK1r/FOj8V0hPFntrLCicIz3kSz8xfyMe1NW6jKVCsvJ/7ofSFbsCO1vyv44iu9ViQTSkxUzCWwPvP3MCihColYInT/eBfax2Vk31rXS5H4ezGpW3vroxe0PMMjmuUCKd/GCuU6+55gJF7pFlpQRJOQOjFsPTrmZRMPs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=K/npMv4i; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="K/npMv4i" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 08D0F2936; Tue, 26 May 2026 11:29:59 -0700 (PDT) Received: from arm.com (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D3E1B3F7B4; Tue, 26 May 2026 11:30:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1779820204; bh=6vvHGcSi157N+oB7lexlZ4A6+hiMatNMYIGzRqF2drI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K/npMv4i2qW9g/9TU4YdmxeRtolv5aI+yYuxqrzCkqOAO0TfYmwr/9lGtagn5lDHy kUb6WYJsmvaZyqjf/yYSt0EfWt0QBpXZkHpmhEWeMUAzJZg2fHl899jOyYpLoDya1L fdhLirTeIBc/bG1S5sbIByG52ch1pvgV5xHx5sq8= Date: Tue, 26 May 2026 19:29:58 +0100 From: Catalin Marinas To: Maciej Wieczor-Retman Cc: Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Samuel Holland , Maciej Wieczor-Retman , linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org Subject: Re: [PATCH v12 02/15] kasan: arm64: x86: Make special tags arch specific Message-ID: References: <6080be7964fc726327186d5bf7979e16ddd282bb.1774872838.git.m.wieczorretman@pm.me> 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-Disposition: inline In-Reply-To: <6080be7964fc726327186d5bf7979e16ddd282bb.1774872838.git.m.wieczorretman@pm.me> On Mon, Mar 30, 2026 at 02:33:16PM +0000, Maciej Wieczor-Retman wrote: > From: Samuel Holland > > KASAN's tag-based mode defines multiple special tag values. They're > reserved for: > - Native kernel value. On arm64 it's 0xFF and it causes an early return > in the tag checking function. > - Invalid value. 0xFE marks an area as freed / unallocated. It's also > the value that is used to initialize regions of shadow memory. > - Min and max values. 0xFD is the highest value that can be randomly > generated for a new tag. 0 is the minimal value with the exception of > arm64's hardware mode where it is equal to 0xF0. > > Metadata macro is also defined: > - Tag width equal to 8. > > Tag-based mode on x86 is going to use 4 bit wide tags so all the above > values need to be changed accordingly. > > Make tag width and native kernel tag arch specific for x86 and arm64. > > Base the invalid tag value and the max value on the native kernel tag > since they follow the same pattern on both mentioned architectures. > > Also generalize KASAN_SHADOW_INIT and 0xff used in various > page_kasan_tag* helpers. > > Give KASAN_TAG_MIN the default value of zero, and move the special value > for hw_tags arm64 to its arch specific kasan-tags.h. > > Signed-off-by: Samuel Holland > Co-developed-by: Maciej Wieczor-Retman > Signed-off-by: Maciej Wieczor-Retman > Acked-by: Will Deacon (for the arm part) > Reviewed-by: Andrey Konovalov > Reviewed-by: Andrey Ryabinin Acked-by: Catalin Marinas