public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] kasan: hw_tags: Disable tagging for stack and page-tables
@ 2026-04-24 13:01 Dev Jain
  2026-04-24 13:01 ` [PATCH v3 1/3] vmalloc: add __GFP_SKIP_KASAN support Dev Jain
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dev Jain @ 2026-04-24 13:01 UTC (permalink / raw)
  To: arnd, kees, mingo, peterz, juri.lelli, vincent.guittot, akpm,
	david, urezki
  Cc: dietmar.eggemann, rostedt, bsegall, mgorman, vschneid, ljs,
	Liam.Howlett, vbabka, rppt, surenb, mhocko, tglx, usama.anjum,
	mathieu.desnoyers, linux-arch, linux-kernel, linux-mm, Dev Jain

Stacks and page tables are always accessed with the match-all tag,
so assigning a new random tag every time at allocation and setting
invalid tag at deallocation time, just adds overhead without improving
the detection.

With __GFP_SKIP_KASAN the page keeps its poison tag and KASAN_TAG_KERNEL
(match-all tag) is stored in the page flags while keeping the poison tag
in the hardware. The benefit of it is that 256 tag setting instruction
per 4 kB page aren't needed at allocation and deallocation time.

Thus match-all pointers still work, while non-match tags (other than
poison tag) still fault.

__GFP_SKIP_KASAN only skips for KASAN_HW_TAGS mode, so coverage is
unchanged.

Benchmark:
The benchmark has two modes. In thread mode, the child process forks
and creates N threads. In pgtable mode, the parent maps and faults a
specified memory size and then forks repeatedly with children exiting
immediately.

Thread benchmark:
2000 iterations, 2000 threads:	2.575 s → 2.229 s (~13.4% faster)

The pgtable samples:
- 2048 MB, 2000 iters		19.08 s → 17.62 s (~7.6% faster)
---

Changes since v2:
- Directly skip kasan_unpoison_vmalloc() for GFP_SKIP_KASAN in patch 1

Changes since v1:
- Update description/title
- Patch 1: Simplify skip conditions based on the fact that __GFP_SKIP_KASAN
- Patch 2: Specify _GFP_SKIP_KASAN in THREADINFO_GFP and GFP_VMAP_STACK

Muhammad Usama Anjum (3):
  vmalloc: add __GFP_SKIP_KASAN support
  kasan: skip HW tagging for all kernel thread stacks
  mm: skip KASAN tagging for page-allocated page tables

 include/asm-generic/pgalloc.h |  2 +-
 include/linux/thread_info.h   |  2 +-
 kernel/fork.c                 |  5 +++--
 mm/vmalloc.c                  | 20 +++++++++++++++++---
 4 files changed, 22 insertions(+), 7 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-04-25  9:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-24 13:01 [PATCH v3 0/3] kasan: hw_tags: Disable tagging for stack and page-tables Dev Jain
2026-04-24 13:01 ` [PATCH v3 1/3] vmalloc: add __GFP_SKIP_KASAN support Dev Jain
2026-04-24 18:32   ` Catalin Marinas
2026-04-25  9:14   ` Catalin Marinas
2026-04-24 13:01 ` [PATCH v3 2/3] kasan: skip HW tagging for all kernel thread stacks Dev Jain
2026-04-24 13:01 ` [PATCH v3 3/3] mm: skip KASAN tagging for page-allocated page tables Dev Jain
2026-04-24 17:41   ` Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox