]> git.ipfire.org Git - thirdparty/linux.git/commit
alloc_tag: add sequence number for module and iterator
authorDavid Wang <00107082@163.com>
Mon, 9 Jun 2025 06:42:00 +0000 (14:42 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 10 Jul 2025 05:42:06 +0000 (22:42 -0700)
commitb0da7709c28c35e0a51d4b1b350c9028358dfb14
treea7414fc1ad94be8a813ab3278ed64bf459d7995b
parenta03db236aebfaeadf79396dbd570896b870bda01
alloc_tag: add sequence number for module and iterator

Codetag iterator use <id,address> pair to guarantee the validness.  But
both id and address can be reused, there is theoretical possibility when
module inserted right after another module removed, kmalloc returns an
address same as the address kfree by previous module and IDR key reuses
the key recently removed.

Add a sequence number to codetag_module and code_iterator, the sequence
number is strickly incremented whenever a module is loaded.  An iterator
is valid if and only if its sequence number match codetag_module's.

Link: https://lkml.kernel.org/r/20250609064200.112639-1-00107082@163.com
Signed-off-by: David Wang <00107082@163.com>
Acked-by: Suren Baghdasaryan <surenb@google.com>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/codetag.h
lib/codetag.c