aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid Wang <00107082@163.com>2025-06-09 14:42:00 +0800
committerAndrew Morton <akpm@linux-foundation.org>2025-07-09 22:42:06 -0700
commitb0da7709c28c35e0a51d4b1b350c9028358dfb14 (patch)
treea7414fc1ad94be8a813ab3278ed64bf459d7995b /include
parentgup: optimize longterm pin_user_pages() for large folio (diff)
downloadlinux-b0da7709c28c35e0a51d4b1b350c9028358dfb14.tar.gz
linux-b0da7709c28c35e0a51d4b1b350c9028358dfb14.zip
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/codetag.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/codetag.h b/include/linux/codetag.h
index 5f2b9a1f722c..457ed8fd3214 100644
--- a/include/linux/codetag.h
+++ b/include/linux/codetag.h
@@ -54,6 +54,7 @@ struct codetag_iterator {
struct codetag_module *cmod;
unsigned long mod_id;
struct codetag *ct;
+ unsigned long mod_seq;
};
#ifdef MODULE