| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/07/03 02:28 | flow | patch-triage |
3mArgs:null Results: {
"EnableConfigs": [
"KEXEC_HANDOVER"
],
"FocusSymbols": [
"kho_split_preserved_pages",
"kho_preserve_pages",
"kho_unpreserve_pages",
"kho_radix_add_page",
"kho_radix_del_page",
"kho_radix_walk_tree",
"kho_preserve_folio",
"kho_unpreserve_folio"
],
"Reasoning": "The patch introduces a new function `kho_split_preserved_pages` and modifies the Kexec Handover (KHO) radix tree logic to support split pages. It changes core functions like `kho_radix_add_page`, `kho_radix_del_page`, `kho_preserve_pages`, and `kho_unpreserve_pages`. These are functional changes to the kernel's live update mechanism and should be fuzzed to ensure the radix tree and page preservation logic handles split pages correctly.",
"WorthFuzzing": true
} |
| 1/1 | 2026/07/03 02:28 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit d34b2d446d1ff2992b507162bb0f2cf1c3746a0f\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Fri Jul 3 02:28:19 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/include/linux/kexec_handover.h b/include/linux/kexec_handover.h\nindex 8968c56d2d73e1..452e38bb207682 100644\n--- a/include/linux/kexec_handover.h\n+++ b/include/linux/kexec_handover.h\n@@ -24,6 +24,7 @@ int kho_preserve_folio(struct folio *folio);\n void kho_unpreserve_folio(struct folio *folio);\n int kho_preserve_pages(struct page *page, unsigned long nr_pages);\n void kho_unpreserve_pages(struct page *page, unsigned long nr_pages);\n+int kho_split_preserved_pages(struct page *page, unsigned int order);\n int kho_preserve_vmalloc(void *ptr, struct kho_vmalloc *preservation);\n void kho_unpreserve_vmalloc(struct kho_vmalloc *preservation);\n void *kho_alloc_preserve(size_t size);\n@@ -65,6 +66,12 @@ static inline int kho_preserve_pages(struct page *page, unsigned int nr_pages)\n \n static inline void kho_unpreserve_pages(struct page *page, unsigned int nr_pages) { }\n \n+static inline int kho_split_preserved_pages(struct page *page,\n+\t\t\t\t\t unsigned int order)\n+{\n+\treturn -EOPNOTSUPP;\n+}\n+\n static inline int kho_preserve_vmalloc(void *ptr,\n \t\t\t\t struct kho_vmalloc *preservation)\n {\ndiff --git a/include/linux/kho_radix_tree.h b/include/linux/kho_radix_tree.h\nindex 84e918b96e53df..9244a3f7a2d477 100644\n--- a/include/linux/kho_radix_tree.h\n+++ b/include/linux/kho_radix_tree.h\n@@ -34,16 +34,22 @@ struct kho_radix_tree {\n \tstruct mutex lock; /* protects the tree's structure and root pointer */\n };\n \n+enum kho_page_type {\n+\tKHO_PAGE_CONTIG = 0,\n+\tKHO_PAGE_SPLIT,\n+};\n+\n typedef int (*kho_radix_tree_walk_callback_t)(phys_addr_t phys,\n-\t\t\t\t\t unsigned int order);\n+\t\t\t\t\t unsigned int order,\n+\t\t\t\t\t enum kho_page_type type);\n \n #ifdef CONFIG_KEXEC_HANDOVER\n \n int kho_radix_add_page(struct kho_radix_tree *tree, unsigned long pfn,\n-\t\t unsigned int order);\n+\t\t unsigned int order, enum kho_page_type type);\n \n void kho_radix_del_page(struct kho_radix_tree *tree, unsigned long pfn,\n-\t\t\tunsigned int order);\n+\t\t\tunsigned int order, enum kho_page_type type);\n \n int kho_radix_walk_tree(struct kho_radix_tree *tree,\n \t\t\tkho_radix_tree_walk_callback_t cb);\n@@ -51,13 +57,14 @@ int kho_radix_walk_tree(struct kho_radix_tree *tree,\n #else /* #ifdef CONFIG_KEXEC_HANDOVER */\n \n static inline int kho_radix_add_page(struct kho_radix_tree *tree, long pfn,\n-\t\t\t\t unsigned int order)\n+\t\t\t\t unsigned int order, enum kho_page_type type)\n {\n \treturn -EOPNOTSUPP;\n }\n \n static inline void kho_radix_del_page(struct kho_radix_tree *tree,\n-\t\t\t\t unsigned long pfn, unsigned int order) { }\n+\t\t\t\t unsigned long pfn, unsigned int order,\n+\t\t\t\t enum kho_page_type type) { }\n \n static inline int kho_radix_walk_tree(struct kho_radix_tree *tree,\n \t\t\t\t kho_radix_tree_walk_callback_t cb)\ndiff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c\nindex 4834a809985ab7..ea08248901b551 100644\n--- a/kernel/liveupdate/kexec_handover.c\n+++ b/kernel/liveupdate/kexec_handover.c\n@@ -43,18 +43,22 @@\n \n /*\n * KHO uses page-\u003eprivate, which is an unsigned long, to store page metadata.\n- * Use it to store both the magic and the order.\n+ * Use it to store the magic, the order, and the type bit.\n */\n union kho_page_info {\n \tunsigned long page_private;\n \tstruct {\n-\t\tunsigned int order;\n+\t\tunsigned int order : 31;\n+\t\tunsigned int type : 1;\n \t\tunsigned int magic;\n \t};\n };\n \n static_assert(sizeof(union kho_page_info) == sizeof(((struct page *)0)-\u003eprivate));\n \n+#define KHO_KEY_TYPE_SHIFT 63\n+#define KHO_KEY_TYPE_MASK BIT(KHO_KEY_TYPE_SHIFT)\n+\n static bool kho_enable __ro_after_init = IS_ENABLED(CONFIG_KEXEC_HANDOVER_ENABLE_DEFAULT);\n \n bool kho_is_enabled(void)\n@@ -85,42 +89,52 @@ static struct kho_out kho_out = {\n };\n \n /**\n- * kho_radix_encode_key - Encodes a physical address and order into a radix key.\n+ * kho_radix_encode_key - Encodes a physical address, order and type into a radix key.\n * @phys: The physical address of the page.\n * @order: The order of the page.\n+ * @type: The page type.\n *\n- * This function combines a page's physical address and its order into a\n+ * This function combines a page's physical address, its order, and its type into a\n * single unsigned long, which is used as a key for all radix tree\n * operations.\n *\n * Return: The encoded unsigned long radix key.\n */\n-static unsigned long kho_radix_encode_key(phys_addr_t phys, unsigned int order)\n+static unsigned long kho_radix_encode_key(phys_addr_t phys, unsigned int order,\n+\t\t\t\t\t enum kho_page_type type)\n {\n \t/* Order bits part */\n \tunsigned long h = 1UL \u003c\u003c (KHO_ORDER_0_LOG2 - order);\n \t/* Shifted physical address part */\n \tunsigned long l = phys \u003e\u003e (PAGE_SHIFT + order);\n+\t/* Type bit part */\n+\tunsigned long t = (unsigned long)type \u003c\u003c KHO_KEY_TYPE_SHIFT;\n \n-\treturn h | l;\n+\treturn h | l | t;\n }\n \n /**\n- * kho_radix_decode_key - Decodes a radix key back into a physical address and order.\n+ * kho_radix_decode_key - Decodes a radix key back into physical address, order, and type.\n * @key: The unsigned long key to decode.\n * @order: An output parameter, a pointer to an unsigned int where the decoded\n * page order will be stored.\n+ * @type: An output parameter, a pointer to where the decoded type will be stored.\n *\n * This function reverses the encoding performed by kho_radix_encode_key(),\n- * extracting the original physical address and page order from a given key.\n+ * extracting the original physical address, page order, and type from a given key.\n *\n * Return: The decoded physical address.\n */\n-static phys_addr_t kho_radix_decode_key(unsigned long key, unsigned int *order)\n+static phys_addr_t kho_radix_decode_key(unsigned long key, unsigned int *order,\n+\t\t\t\t\tenum kho_page_type *type)\n {\n-\tunsigned int order_bit = fls64(key);\n+\tunsigned int order_bit;\n \tphys_addr_t phys;\n \n+\t*type = (key \u0026 KHO_KEY_TYPE_MASK) \u003e\u003e KHO_KEY_TYPE_SHIFT;\n+\tkey \u0026= ~KHO_KEY_TYPE_MASK;\n+\n+\torder_bit = fls64(key);\n \t/* order_bit is numbered starting at 1 from fls64 */\n \t*order = KHO_ORDER_0_LOG2 - order_bit + 1;\n \t/* The order is discarded by the shift */\n@@ -148,6 +162,7 @@ static unsigned long kho_radix_get_table_index(unsigned long key,\n * @tree: The KHO radix tree.\n * @pfn: The page frame number of the page to preserve.\n * @order: The order of the page.\n+ * @type: The page type.\n *\n * This function traverses the radix tree based on the key derived from @pfn\n * and @order. It sets the corresponding bit in the leaf bitmap to mark the\n@@ -157,11 +172,12 @@ static unsigned long kho_radix_get_table_index(unsigned long key,\n * Return: 0 on success, or a negative error code on failure.\n */\n int kho_radix_add_page(struct kho_radix_tree *tree,\n-\t\t unsigned long pfn, unsigned int order)\n+\t\t unsigned long pfn, unsigned int order,\n+\t\t enum kho_page_type type)\n {\n \t/* Newly allocated nodes for error cleanup */\n \tstruct kho_radix_node *intermediate_nodes[KHO_TREE_MAX_DEPTH] = { 0 };\n-\tunsigned long key = kho_radix_encode_key(PFN_PHYS(pfn), order);\n+\tunsigned long key = kho_radix_encode_key(PFN_PHYS(pfn), order, type);\n \tstruct kho_radix_node *anchor_node = NULL;\n \tstruct kho_radix_node *node = tree-\u003eroot;\n \tstruct kho_radix_node *new_node;\n@@ -231,15 +247,16 @@ EXPORT_SYMBOL_GPL(kho_radix_add_page);\n * @tree: The KHO radix tree.\n * @pfn: The page frame number of the page to unpreserve.\n * @order: The order of the page.\n+ * @type: The page type.\n *\n * This function traverses the radix tree and clears the bit corresponding to\n * the page, effectively removing its \"preserved\" status. It does not free\n * the tree's intermediate nodes, even if they become empty.\n */\n void kho_radix_del_page(struct kho_radix_tree *tree, unsigned long pfn,\n-\t\t\tunsigned int order)\n+\t\t\tunsigned int order, enum kho_page_type type)\n {\n-\tunsigned long key = kho_radix_encode_key(PFN_PHYS(pfn), order);\n+\tunsigned long key = kho_radix_encode_key(PFN_PHYS(pfn), order, type);\n \tstruct kho_radix_node *node = tree-\u003eroot;\n \tstruct kho_radix_leaf *leaf;\n \tunsigned int i, idx;\n@@ -277,14 +294,15 @@ static int kho_radix_walk_leaf(struct kho_radix_leaf *leaf,\n \t\t\t kho_radix_tree_walk_callback_t cb)\n {\n \tunsigned long *bitmap = (unsigned long *)leaf;\n+\tenum kho_page_type type;\n \tunsigned int order;\n \tphys_addr_t phys;\n \tunsigned int i;\n \tint err;\n \n \tfor_each_set_bit(i, bitmap, PAGE_SIZE * BITS_PER_BYTE) {\n-\t\tphys = kho_radix_decode_key(key | i, \u0026order);\n-\t\terr = cb(phys, order);\n+\t\tphys = kho_radix_decode_key(key | i, \u0026order, \u0026type);\n+\t\terr = cb(phys, order, type);\n \t\tif (err)\n \t\t\treturn err;\n \t}\n@@ -357,11 +375,18 @@ int kho_radix_walk_tree(struct kho_radix_tree *tree,\n }\n EXPORT_SYMBOL_GPL(kho_radix_walk_tree);\n \n-/* For physically contiguous 0-order pages. */\n-static void kho_init_pages(struct page *page, unsigned long nr_pages)\n+/* For physically contiguous pages. */\n+static void kho_restore_refcounts(struct page *page, unsigned long nr_pages,\n+\t\t\t\t enum kho_page_type type)\n {\n-\tfor (unsigned long i = 0; i \u003c nr_pages; i++) {\n-\t\tset_page_count(page + i, 1);\n+\t/* Head page always gets refcount of 1. */\n+\tset_page_count(page, 1);\n+\tclear_page_tag_ref(page);\n+\n+\tfor (unsigned long i = 1; i \u003c nr_pages; i++) {\n+\t\tunsigned int count = (type == KHO_PAGE_SPLIT) ? 1 : 0;\n+\n+\t\tset_page_count(page + i, count);\n \t\t/* Clear each page's codetag to avoid accounting mismatch. */\n \t\tclear_page_tag_ref(page + i);\n \t}\n@@ -369,16 +394,7 @@ static void kho_init_pages(struct page *page, unsigned long nr_pages)\n \n static void kho_init_folio(struct page *page, unsigned int order)\n {\n-\tunsigned long nr_pages = (1 \u003c\u003c order);\n-\n-\t/* Head page gets refcount of 1. */\n-\tset_page_count(page, 1);\n-\t/* Clear head page's codetag to avoid accounting mismatch. */\n-\tclear_page_tag_ref(page);\n-\n-\t/* For higher order folios, tail pages get a page count of zero. */\n-\tfor (unsigned long i = 1; i \u003c nr_pages; i++)\n-\t\tset_page_count(page + i, 0);\n+\tkho_restore_refcounts(page, 1 \u003c\u003c order, KHO_PAGE_CONTIG);\n \n \tif (order \u003e 0)\n \t\tprep_compound_page(page, order);\n@@ -403,13 +419,20 @@ static struct page *kho_restore_page(phys_addr_t phys, bool is_folio)\n \t\treturn NULL;\n \tnr_pages = (1 \u003c\u003c info.order);\n \n+\t/*\n+\t * If we want to restore a folio, but the memory was split in the\n+\t * previous kernel, something is wrong.\n+\t */\n+\tif (WARN_ON_ONCE(is_folio \u0026\u0026 info.type == KHO_PAGE_SPLIT))\n+\t\treturn NULL;\n+\n \t/* Clear private to make sure later restores on this page error out. */\n \tpage-\u003eprivate = 0;\n \n \tif (is_folio)\n \t\tkho_init_folio(page, info.order);\n \telse\n-\t\tkho_init_pages(page, nr_pages);\n+\t\tkho_restore_refcounts(page, nr_pages, info.type);\n \n \tadjust_managed_page_count(page, nr_pages);\n \treturn page;\n@@ -485,7 +508,8 @@ static struct page *__init kho_get_preserved_page(phys_addr_t phys,\n }\n \n static int __init kho_preserved_memory_reserve(phys_addr_t phys,\n-\t\t\t\t\t unsigned int order)\n+\t\t\t\t\t unsigned int order,\n+\t\t\t\t\t enum kho_page_type type)\n {\n \tunion kho_page_info info;\n \tstruct page *page;\n@@ -499,6 +523,7 @@ static int __init kho_preserved_memory_reserve(phys_addr_t phys,\n \tmemblock_reserved_mark_noinit(phys, sz);\n \tinfo.magic = KHO_PAGE_MAGIC;\n \tinfo.order = order;\n+\tinfo.type = type;\n \tpage-\u003eprivate = info.page_private;\n \n \treturn 0;\n@@ -859,7 +884,7 @@ int kho_preserve_folio(struct folio *folio)\n \tif (WARN_ON(kho_scratch_overlap(pfn \u003c\u003c PAGE_SHIFT, PAGE_SIZE \u003c\u003c order)))\n \t\treturn -EINVAL;\n \n-\treturn kho_radix_add_page(tree, pfn, order);\n+\treturn kho_radix_add_page(tree, pfn, order, KHO_PAGE_CONTIG);\n }\n EXPORT_SYMBOL_GPL(kho_preserve_folio);\n \n@@ -877,7 +902,7 @@ void kho_unpreserve_folio(struct folio *folio)\n \tconst unsigned long pfn = folio_pfn(folio);\n \tconst unsigned int order = folio_order(folio);\n \n-\tkho_radix_del_page(tree, pfn, order);\n+\tkho_radix_del_page(tree, pfn, order, KHO_PAGE_CONTIG);\n }\n EXPORT_SYMBOL_GPL(kho_unpreserve_folio);\n \n@@ -898,15 +923,29 @@ static unsigned int __kho_preserve_pages_order(unsigned long start_pfn,\n \treturn order;\n }\n \n+static bool kho_is_page_split(unsigned long pfn, unsigned int order)\n+{\n+\t/*\n+\t * If the refcount of the second page is non-zero, this block\n+\t * has been split.\n+\t */\n+\tif (order \u003e 0 \u0026\u0026 page_ref_count(pfn_to_page(pfn + 1)) != 0)\n+\t\treturn true;\n+\n+\treturn false;\n+}\n+\n static void __kho_unpreserve(struct kho_radix_tree *tree,\n \t\t\t unsigned long pfn, unsigned long end_pfn)\n {\n-\tunsigned int order;\n-\n \twhile (pfn \u003c end_pfn) {\n-\t\torder = __kho_preserve_pages_order(pfn, end_pfn);\n+\t\tunsigned int order = __kho_preserve_pages_order(pfn, end_pfn);\n+\t\tenum kho_page_type type;\n \n-\t\tkho_radix_del_page(tree, pfn, order);\n+\t\ttype = kho_is_page_split(pfn, order) ? KHO_PAGE_SPLIT :\n+\t\t\t\t\t\t KHO_PAGE_CONTIG;\n+\n+\t\tkho_radix_del_page(tree, pfn, order, type);\n \n \t\tpfn += 1 \u003c\u003c order;\n \t}\n@@ -938,8 +977,12 @@ int kho_preserve_pages(struct page *page, unsigned long nr_pages)\n \n \twhile (pfn \u003c end_pfn) {\n \t\tunsigned int order = __kho_preserve_pages_order(pfn, end_pfn);\n+\t\tenum kho_page_type type;\n+\n+\t\ttype = kho_is_page_split(pfn, order) ? KHO_PAGE_SPLIT :\n+\t\t\t\t\t\t KHO_PAGE_CONTIG;\n \n-\t\terr = kho_radix_add_page(tree, pfn, order);\n+\t\terr = kho_radix_add_page(tree, pfn, order, type);\n \t\tif (err) {\n \t\t\tfailed_pfn = pfn;\n \t\t\tbreak;\n@@ -975,6 +1018,29 @@ void kho_unpreserve_pages(struct page *page, unsigned long nr_pages)\n }\n EXPORT_SYMBOL_GPL(kho_unpreserve_pages);\n \n+/**\n+ * kho_split_preserved_pages - split contiguous pages that are preserved\n+ * @page: first page in the list.\n+ * @order: the order of the original allocation.\n+ *\n+ * This function allows to split a high-order allocation that has been\n+ * preserved across kexec. It unpreserves the pages, splits them using\n+ * split_page() and then re-preserves them as individual pages.\n+ *\n+ * This function MUST only be called on pages that are currently preserved.\n+ * The @order provided MUST match the order used during the initial\n+ * preservation.\n+ *\n+ * Return: 0 on success, or a negative error code on failure.\n+ */\n+int kho_split_preserved_pages(struct page *page, unsigned int order)\n+{\n+\tkho_unpreserve_pages(page, 1UL \u003c\u003c order);\n+\tsplit_page(page, order);\n+\treturn kho_preserve_pages(page, 1UL \u003c\u003c order);\n+}\n+EXPORT_SYMBOL_GPL(kho_split_preserved_pages);\n+\n /* vmalloc flags KHO supports */\n #define KHO_VMALLOC_SUPPORTED_FLAGS\t(VM_ALLOC | VM_ALLOW_HUGE_VMAP)\n \n"
} |
| 2/1 | 2026/07/03 02:28 | agent | patch-evaluator |
3mModel:gemini-3.1-pro-preview Args: null Results: {
"EnableConfigs": [
"KEXEC_HANDOVER"
],
"FocusSymbols": [
"kho_split_preserved_pages",
"kho_preserve_pages",
"kho_unpreserve_pages",
"kho_radix_add_page",
"kho_radix_del_page",
"kho_radix_walk_tree",
"kho_preserve_folio",
"kho_unpreserve_folio"
],
"Reasoning": "The patch introduces a new function `kho_split_preserved_pages` and modifies the Kexec Handover (KHO) radix tree logic to support split pages. It changes core functions like `kho_radix_add_page`, `kho_radix_del_page`, `kho_preserve_pages`, and `kho_unpreserve_pages`. These are functional changes to the kernel's live update mechanism and should be fuzzed to ensure the radix tree and page preservation logic handles split pages correctly.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer. Your job is to review a provided patch series and determine if it makes functional changes to the kernel that should be fuzzed. IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively use your code access tools to examine the actual source code and confirm any assumptions. Return WorthFuzzing=false if the patch only contains: - Modifications to Documentation/, Kconfig files, or code comments. - Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints. - Changes to numeric constants or macros that do not functionally alter execution flow. - Code paths that are impossible to reach in virtualized environments like GCE or QEMU, even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim). If it modifies reachable core kernel logic, drivers, or architectures, use your code search tools to verify the code can be executed, then return WorthFuzzing=true. When returning WorthFuzzing=true, you MUST ALSO: 1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols. Avoid listing generic hot-path functions to prevent skewed test distributions. 2. Identify any specific CONFIG_ options required to properly test this new/modified feature. Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions. Do not list too generic configs (we already have them enabled). Only list those that specifically cover the modified code. List them in the EnableConfigs output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4"). Prefer calling several tools at the same time to save round-trips. Use set-results tool to provide results of the analysis. It must be called exactly once before the final reply. Ignore results of this tool. Prompt: For your convenience, here is the diff of the changes:
commit d34b2d446d1ff2992b507162bb0f2cf1c3746a0f
Author: syz-cluster <triage@syzkaller.com>
Date: Fri Jul 3 02:28:19 2026 +0000
syz-cluster: applied patch under review
diff --git a/include/linux/kexec_handover.h b/include/linux/kexec_handover.h
index 8968c56d2d73e1..452e38bb207682 100644
--- a/include/linux/kexec_handover.h
+++ b/include/linux/kexec_handover.h
@@ -24,6 +24,7 @@ int kho_preserve_folio(struct folio *folio);
void kho_unpreserve_folio(struct folio *folio);
int kho_preserve_pages(struct page *page, unsigned long nr_pages);
void kho_unpreserve_pages(struct page *page, unsigned long nr_pages);
+int kho_split_preserved_pages(struct page *page, unsigned int order);
int kho_preserve_vmalloc(void *ptr, struct kho_vmalloc *preservation);
void kho_unpreserve_vmalloc(struct kho_vmalloc *preservation);
void *kho_alloc_preserve(size_t size);
@@ -65,6 +66,12 @@ static inline int kho_preserve_pages(struct page *page, unsigned int nr_pages)
static inline void kho_unpreserve_pages(struct page *page, unsigned int nr_pages) { }
+static inline int kho_split_preserved_pages(struct page *page,
+ unsigned int order)
+{
+ return -EOPNOTSUPP;
+}
+
static inline int kho_preserve_vmalloc(void *ptr,
struct kho_vmalloc *preservation)
{
diff --git a/include/linux/kho_radix_tree.h b/include/linux/kho_radix_tree.h
index 84e918b96e53df..9244a3f7a2d477 100644
--- a/include/linux/kho_radix_tree.h
+++ b/include/linux/kho_radix_tree.h
@@ -34,16 +34,22 @@ struct kho_radix_tree {
struct mutex lock; /* protects the tree's structure and root pointer */
};
+enum kho_page_type {
+ KHO_PAGE_CONTIG = 0,
+ KHO_PAGE_SPLIT,
+};
+
typedef int (*kho_radix_tree_walk_callback_t)(phys_addr_t phys,
- unsigned int order);
+ unsigned int order,
+ enum kho_page_type type);
#ifdef CONFIG_KEXEC_HANDOVER
int kho_radix_add_page(struct kho_radix_tree *tree, unsigned long pfn,
- unsigned int order);
+ unsigned int order, enum kho_page_type type);
void kho_radix_del_page(struct kho_radix_tree *tree, unsigned long pfn,
- unsigned int order);
+ unsigned int order, enum kho_page_type type);
int kho_radix_walk_tree(struct kho_radix_tree *tree,
kho_radix_tree_walk_callback_t cb);
@@ -51,13 +57,14 @@ int kho_radix_walk_tree(struct kho_radix_tree *tree,
#else /* #ifdef CONFIG_KEXEC_HANDOVER */
static inline int kho_radix_add_page(struct kho_radix_tree *tree, long pfn,
- unsigned int order)
+ unsigned int order, enum kho_page_type type)
{
return -EOPNOTSUPP;
}
static inline void kho_radix_del_page(struct kho_radix_tree *tree,
- unsigned long pfn, unsigned int order) { }
+ unsigned long pfn, unsigned int order,
+ enum kho_page_type type) { }
static inline int kho_radix_walk_tree(struct kho_radix_tree *tree,
kho_radix_tree_walk_callback_t cb)
diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
index 4834a809985ab7..ea08248901b551 100644
--- a/kernel/liveupdate/kexec_handover.c
+++ b/kernel/liveupdate/kexec_handover.c
@@ -43,18 +43,22 @@
/*
* KHO uses page->private, which is an unsigned long, to store page metadata.
- * Use it to store both the magic and the order.
+ * Use it to store the magic, the order, and the type bit.
*/
union kho_page_info {
unsigned long page_private;
struct {
- unsigned int order;
+ unsigned int order : 31;
+ unsigned int type : 1;
unsigned int magic;
};
};
static_assert(sizeof(union kho_page_info) == sizeof(((struct page *)0)->private));
+#define KHO_KEY_TYPE_SHIFT 63
+#define KHO_KEY_TYPE_MASK BIT(KHO_KEY_TYPE_SHIFT)
+
static bool kho_enable __ro_after_init = IS_ENABLED(CONFIG_KEXEC_HANDOVER_ENABLE_DEFAULT);
bool kho_is_enabled(void)
@@ -85,42 +89,52 @@ static struct kho_out kho_out = {
};
/**
- * kho_radix_encode_key - Encodes a physical address and order into a radix key.
+ * kho_radix_encode_key - Encodes a physical address, order and type into a radix key.
* @phys: The physical address of the page.
* @order: The order of the page.
+ * @type: The page type.
*
- * This function combines a page's physical address and its order into a
+ * This function combines a page's physical address, its order, and its type into a
* single unsigned long, which is used as a key for all radix tree
* operations.
*
* Return: The encoded unsigned long radix key.
*/
-static unsigned long kho_radix_encode_key(phys_addr_t phys, unsigned int order)
+static unsigned long kho_radix_encode_key(phys_addr_t phys, unsigned int order,
+ enum kho_page_type type)
{
/* Order bits part */
unsigned long h = 1UL << (KHO_ORDER_0_LOG2 - order);
/* Shifted physical address part */
unsigned long l = phys >> (PAGE_SHIFT + order);
+ /* Type bit part */
+ unsigned long t = (unsigned long)type << KHO_KEY_TYPE_SHIFT;
- return h | l;
+ return h | l | t;
}
/**
- * kho_radix_decode_key - Decodes a radix key back into a physical address and order.
+ * kho_radix_decode_key - Decodes a radix key back into physical address, order, and type.
* @key: The unsigned long key to decode.
* @order: An output parameter, a pointer to an unsigned int where the decoded
* page order will be stored.
+ * @type: An output parameter, a pointer to where the decoded type will be stored.
*
* This function reverses the encoding performed by kho_radix_encode_key(),
- * extracting the original physical address and page order from a given key.
+ * extracting the original physical address, page order, and type from a given key.
*
* Return: The decoded physical address.
*/
-static phys_addr_t kho_radix_decode_key(unsigned long key, unsigned int *order)
+static phys_addr_t kho_radix_decode_key(unsigned long key, unsigned int *order,
+ enum kho_page_type *type)
{
- unsigned int order_bit = fls64(key);
+ unsigned int order_bit;
phys_addr_t phys;
+ *type = (key & KHO_KEY_TYPE_MASK) >> KHO_KEY_TYPE_SHIFT;
+ key &= ~KHO_KEY_TYPE_MASK;
+
+ order_bit = fls64(key);
/* order_bit is numbered starting at 1 from fls64 */
*order = KHO_ORDER_0_LOG2 - order_bit + 1;
/* The order is discarded by the shift */
@@ -148,6 +162,7 @@ static unsigned long kho_radix_get_table_index(unsigned long key,
* @tree: The KHO radix tree.
* @pfn: The page frame number of the page to preserve.
* @order: The order of the page.
+ * @type: The page type.
*
* This function traverses the radix tree based on the key derived from @pfn
* and @order. It sets the corresponding bit in the leaf bitmap to mark the
@@ -157,11 +172,12 @@ static unsigned long kho_radix_get_table_index(unsigned long key,
* Return: 0 on success, or a negative error code on failure.
*/
int kho_radix_add_page(struct kho_radix_tree *tree,
- unsigned long pfn, unsigned int order)
+ unsigned long pfn, unsigned int order,
+ enum kho_page_type type)
{
/* Newly allocated nodes for error cleanup */
struct kho_radix_node *intermediate_nodes[KHO_TREE_MAX_DEPTH] = { 0 };
- unsigned long key = kho_radix_encode_key(PFN_PHYS(pfn), order);
+ unsigned long key = kho_radix_encode_key(PFN_PHYS(pfn), order, type);
struct kho_radix_node *anchor_node = NULL;
struct kho_radix_node *node = tree->root;
struct kho_radix_node *new_node;
@@ -231,15 +247,16 @@ EXPORT_SYMBOL_GPL(kho_radix_add_page);
* @tree: The KHO radix tree.
* @pfn: The page frame number of the page to unpreserve.
* @order: The order of the page.
+ * @type: The page type.
*
* This function traverses the radix tree and clears the bit corresponding to
* the page, effectively removing its "preserved" status. It does not free
* the tree's intermediate nodes, even if they become empty.
*/
void kho_radix_del_page(struct kho_radix_tree *tree, unsigned long pfn,
- unsigned int order)
+ unsigned int order, enum kho_page_type type)
{
- unsigned long key = kho_radix_encode_key(PFN_PHYS(pfn), order);
+ unsigned long key = kho_radix_encode_key(PFN_PHYS(pfn), order, type);
struct kho_radix_node *node = tree->root;
struct kho_radix_leaf *leaf;
unsigned int i, idx;
@@ -277,14 +294,15 @@ static int kho_radix_walk_leaf(struct kho_radix_leaf *leaf,
kho_radix_tree_walk_callback_t cb)
{
unsigned long *bitmap = (unsigned long *)leaf;
+ enum kho_page_type type;
unsigned int order;
phys_addr_t phys;
unsigned int i;
int err;
for_each_set_bit(i, bitmap, PAGE_SIZE * BITS_PER_BYTE) {
- phys = kho_radix_decode_key(key | i, &order);
- err = cb(phys, order);
+ phys = kho_radix_decode_key(key | i, &order, &type);
+ err = cb(phys, order, type);
if (err)
return err;
}
@@ -357,11 +375,18 @@ int kho_radix_walk_tree(struct kho_radix_tree *tree,
}
EXPORT_SYMBOL_GPL(kho_radix_walk_tree);
-/* For physically contiguous 0-order pages. */
-static void kho_init_pages(struct page *page, unsigned long nr_pages)
+/* For physically contiguous pages. */
+static void kho_restore_refcounts(struct page *page, unsigned long nr_pages,
+ enum kho_page_type type)
{
- for (unsigned long i = 0; i < nr_pages; i++) {
- set_page_count(page + i, 1);
+ /* Head page always gets refcount of 1. */
+ set_page_count(page, 1);
+ clear_page_tag_ref(page);
+
+ for (unsigned long i = 1; i < nr_pages; i++) {
+ unsigned int count = (type == KHO_PAGE_SPLIT) ? 1 : 0;
+
+ set_page_count(page + i, count);
/* Clear each page's codetag to avoid accounting mismatch. */
clear_page_tag_ref(page + i);
}
@@ -369,16 +394,7 @@ static void kho_init_pages(struct page *page, unsigned long nr_pages)
static void kho_init_folio(struct page *page, unsigned int order)
{
- unsigned long nr_pages = (1 << order);
-
- /* Head page gets refcount of 1. */
- set_page_count(page, 1);
- /* Clear head page's codetag to avoid accounting mismatch. */
- clear_page_tag_ref(page);
-
- /* For higher order folios, tail pages get a page count of zero. */
- for (unsigned long i = 1; i < nr_pages; i++)
- set_page_count(page + i, 0);
+ kho_restore_refcounts(page, 1 << order, KHO_PAGE_CONTIG);
if (order > 0)
prep_compound_page(page, order);
@@ -403,13 +419,20 @@ static struct page *kho_restore_page(phys_addr_t phys, bool is_folio)
return NULL;
nr_pages = (1 << info.order);
+ /*
+ * If we want to restore a folio, but the memory was split in the
+ * previous kernel, something is wrong.
+ */
+ if (WARN_ON_ONCE(is_folio && info.type == KHO_PAGE_SPLIT))
+ return NULL;
+
/* Clear private to make sure later restores on this page error out. */
page->private = 0;
if (is_folio)
kho_init_folio(page, info.order);
else
- kho_init_pages(page, nr_pages);
+ kho_restore_refcounts(page, nr_pages, info.type);
adjust_managed_page_count(page, nr_pages);
return page;
@@ -485,7 +508,8 @@ static struct page *__init kho_get_preserved_page(phys_addr_t phys,
}
static int __init kho_preserved_memory_reserve(phys_addr_t phys,
- unsigned int order)
+ unsigned int order,
+ enum kho_page_type type)
{
union kho_page_info info;
struct page *page;
@@ -499,6 +523,7 @@ static int __init kho_preserved_memory_reserve(phys_addr_t phys,
memblock_reserved_mark_noinit(phys, sz);
info.magic = KHO_PAGE_MAGIC;
info.order = order;
+ info.type = type;
page->private = info.page_private;
return 0;
@@ -859,7 +884,7 @@ int kho_preserve_folio(struct folio *folio)
if (WARN_ON(kho_scratch_overlap(pfn << PAGE_SHIFT, PAGE_SIZE << order)))
return -EINVAL;
- return kho_radix_add_page(tree, pfn, order);
+ return kho_radix_add_page(tree, pfn, order, KHO_PAGE_CONTIG);
}
EXPORT_SYMBOL_GPL(kho_preserve_folio);
@@ -877,7 +902,7 @@ void kho_unpreserve_folio(struct folio *folio)
const unsigned long pfn = folio_pfn(folio);
const unsigned int order = folio_order(folio);
- kho_radix_del_page(tree, pfn, order);
+ kho_radix_del_page(tree, pfn, order, KHO_PAGE_CONTIG);
}
EXPORT_SYMBOL_GPL(kho_unpreserve_folio);
@@ -898,15 +923,29 @@ static unsigned int __kho_preserve_pages_order(unsigned long start_pfn,
return order;
}
+static bool kho_is_page_split(unsigned long pfn, unsigned int order)
+{
+ /*
+ * If the refcount of the second page is non-zero, this block
+ * has been split.
+ */
+ if (order > 0 && page_ref_count(pfn_to_page(pfn + 1)) != 0)
+ return true;
+
+ return false;
+}
+
static void __kho_unpreserve(struct kho_radix_tree *tree,
unsigned long pfn, unsigned long end_pfn)
{
- unsigned int order;
-
while (pfn < end_pfn) {
- order = __kho_preserve_pages_order(pfn, end_pfn);
+ unsigned int order = __kho_preserve_pages_order(pfn, end_pfn);
+ enum kho_page_type type;
- kho_radix_del_page(tree, pfn, order);
+ type = kho_is_page_split(pfn, order) ? KHO_PAGE_SPLIT :
+ KHO_PAGE_CONTIG;
+
+ kho_radix_del_page(tree, pfn, order, type);
pfn += 1 << order;
}
@@ -938,8 +977,12 @@ int kho_preserve_pages(struct page *page, unsigned long nr_pages)
while (pfn < end_pfn) {
unsigned int order = __kho_preserve_pages_order(pfn, end_pfn);
+ enum kho_page_type type;
+
+ type = kho_is_page_split(pfn, order) ? KHO_PAGE_SPLIT :
+ KHO_PAGE_CONTIG;
- err = kho_radix_add_page(tree, pfn, order);
+ err = kho_radix_add_page(tree, pfn, order, type);
if (err) {
failed_pfn = pfn;
break;
@@ -975,6 +1018,29 @@ void kho_unpreserve_pages(struct page *page, unsigned long nr_pages)
}
EXPORT_SYMBOL_GPL(kho_unpreserve_pages);
+/**
+ * kho_split_preserved_pages - split contiguous pages that are preserved
+ * @page: first page in the list.
+ * @order: the order of the original allocation.
+ *
+ * This function allows to split a high-order allocation that has been
+ * preserved across kexec. It unpreserves the pages, splits them using
+ * split_page() and then re-preserves them as individual pages.
+ *
+ * This function MUST only be called on pages that are currently preserved.
+ * The @order provided MUST match the order used during the initial
+ * preservation.
+ *
+ * Return: 0 on success, or a negative error code on failure.
+ */
+int kho_split_preserved_pages(struct page *page, unsigned int order)
+{
+ kho_unpreserve_pages(page, 1UL << order);
+ split_page(page, order);
+ return kho_preserve_pages(page, 1UL << order);
+}
+EXPORT_SYMBOL_GPL(kho_split_preserved_pages);
+
/* vmalloc flags KHO supports */
#define KHO_VMALLOC_SUPPORTED_FLAGS (VM_ALLOC | VM_ALLOW_HUGE_VMAP)
|
| 3/2 | 2026/07/03 02:28 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 6851 output: 21 thoughts: 175 Thoughts: **Analyzing the Kexec Handover Patch** Okay, so I'm looking at this patch and it seems like they're introducing some key changes for Kexec Handover (KHO). Specifically, they've added a function called `kho_split_preserved_pages` and modified a few existing ones: `kho_radix_add_page`, `kho_radix_del_page`, and `kho_radix_walk_tree`. The core of the modification revolves around a new `enum kho_page_type`, distinguishing between `KHO_PAGE_CONTIG` and `KHO_PAGE_SPLIT`. This makes sense; handling page splits is essential for a handover process like Kexec. They've linked the changes to `kernel/liveupdate/kexec_handover.c`. Hold on... `kernel/liveupdate/kexec_handover.c`... that file path feels a little off. Is that standard, or am I missing something? I need to quickly verify that this is an actual valid path within the kernel source tree. Before I proceed, let me double-check that this file really exists. Also, I better confirm that `CONFIG_KEXEC_HANDOVER` is the correct configuration option to enable all of this. It's crucial that this whole feature is correctly enabled. |
| 4/2 | 2026/07/03 02:28 | tool | grepper |
0mArgs:{
"Expression": "kho_split_preserved_pages"
}Results: {
"Output": "include/linux/kexec_handover.h=26=void kho_unpreserve_pages(struct page *page, unsigned long nr_pages);\ninclude/linux/kexec_handover.h:27:int kho_split_preserved_pages(struct page *page, unsigned int order);\ninclude/linux/kexec_handover.h-28-int kho_preserve_vmalloc(void *ptr, struct kho_vmalloc *preservation);\n--\ninclude/linux/kexec_handover.h=67=static inline void kho_unpreserve_pages(struct page *page, unsigned int nr_pages) { }\ninclude/linux/kexec_handover.h-68-\ninclude/linux/kexec_handover.h:69:static inline int kho_split_preserved_pages(struct page *page,\ninclude/linux/kexec_handover.h-70-\t\t\t\t\t unsigned int order)\n--\nkernel/liveupdate/kexec_handover.c=1019=EXPORT_SYMBOL_GPL(kho_unpreserve_pages);\n--\nkernel/liveupdate/kexec_handover.c-1021-/**\nkernel/liveupdate/kexec_handover.c:1022: * kho_split_preserved_pages - split contiguous pages that are preserved\nkernel/liveupdate/kexec_handover.c-1023- * @page: first page in the list.\n--\nkernel/liveupdate/kexec_handover.c-1035- */\nkernel/liveupdate/kexec_handover.c:1036:int kho_split_preserved_pages(struct page *page, unsigned int order)\nkernel/liveupdate/kexec_handover.c-1037-{\n--\nkernel/liveupdate/kexec_handover.c-1041-}\nkernel/liveupdate/kexec_handover.c:1042:EXPORT_SYMBOL_GPL(kho_split_preserved_pages);\nkernel/liveupdate/kexec_handover.c-1043-\n"
} |
| 5/2 | 2026/07/03 02:28 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 7829 output: 20 thoughts: 13 Thoughts: Here's my attempt at summarizing the thought process, tailored for an expert audience: **Configuration Diagnostics: A Quick Pulse Check** Okay, so I’ve received confirmation. *Yes, it does.* Let's drill down into the potential sources of this behavior. My gut feeling is we're looking at a configuration issue, a subtle drift in settings that’s manifesting in this particular scenario. Time to roll up my sleeves and dive into the configs. This isn’t a deep dive yet; just a rapid diagnostic scan for the usual suspects: misconfigured permissions, environment variables that haven't propagated correctly, or a caching issue acting up. Let's see if we can identify the problem with a few key checks. |
| 6/2 | 2026/07/03 02:29 | tool | grepper |
0mArgs:{
"Expression": "config KEXEC_HANDOVER"
}Results: {
"Output": "kernel/liveupdate/Kconfig=3=menu \"Live Update and Kexec HandOver\"\nkernel/liveupdate/Kconfig-4-\nkernel/liveupdate/Kconfig:5:config KEXEC_HANDOVER\nkernel/liveupdate/Kconfig-6-\tbool \"kexec handover\"\n--\nkernel/liveupdate/Kconfig-17-\nkernel/liveupdate/Kconfig:18:config KEXEC_HANDOVER_DEBUG\nkernel/liveupdate/Kconfig-19-\tbool \"Enable Kexec Handover debug checks\"\n--\nkernel/liveupdate/Kconfig-26-\nkernel/liveupdate/Kconfig:27:config KEXEC_HANDOVER_DEBUGFS\nkernel/liveupdate/Kconfig-28-\tbool \"kexec handover debugfs interface\"\n--\nkernel/liveupdate/Kconfig-37-\nkernel/liveupdate/Kconfig:38:config KEXEC_HANDOVER_ENABLE_DEFAULT\nkernel/liveupdate/Kconfig-39-\tbool \"Enable kexec handover by default\"\n"
} |
| 7/2 | 2026/07/03 02:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 8263 output: 21 thoughts: 19 Thoughts: Okay, here's my interpretation of that thought process, assuming I'm an expert in this field and approaching this systematically: **Checking for Usage of `kho_split_preserved_pages`** Alright, my first instinct is to see how widely this `kho_split_preserved_pages` is actually being used. Before I delve into anything else, or make any assumptions about its purpose or potential implications, I need to understand its scope. Is this a core component? Is it only used in a specific module? Or perhaps it's a forgotten artifact from an earlier project? I need to know how many places it touches, if any. So, I need to check the codebase. Where's it used? What other parts of the system interact with it? That will guide my next steps. This is just reconnaissance. Gather information, before I do anything else. |
| 8/2 | 2026/07/03 02:29 | tool | grepper |
0mArgs:{
"Expression": "kho_split_preserved_pages"
}Results: {
"Output": "include/linux/kexec_handover.h=26=void kho_unpreserve_pages(struct page *page, unsigned long nr_pages);\ninclude/linux/kexec_handover.h:27:int kho_split_preserved_pages(struct page *page, unsigned int order);\ninclude/linux/kexec_handover.h-28-int kho_preserve_vmalloc(void *ptr, struct kho_vmalloc *preservation);\n--\ninclude/linux/kexec_handover.h=67=static inline void kho_unpreserve_pages(struct page *page, unsigned int nr_pages) { }\ninclude/linux/kexec_handover.h-68-\ninclude/linux/kexec_handover.h:69:static inline int kho_split_preserved_pages(struct page *page,\ninclude/linux/kexec_handover.h-70-\t\t\t\t\t unsigned int order)\n--\nkernel/liveupdate/kexec_handover.c=1019=EXPORT_SYMBOL_GPL(kho_unpreserve_pages);\n--\nkernel/liveupdate/kexec_handover.c-1021-/**\nkernel/liveupdate/kexec_handover.c:1022: * kho_split_preserved_pages - split contiguous pages that are preserved\nkernel/liveupdate/kexec_handover.c-1023- * @page: first page in the list.\n--\nkernel/liveupdate/kexec_handover.c-1035- */\nkernel/liveupdate/kexec_handover.c:1036:int kho_split_preserved_pages(struct page *page, unsigned int order)\nkernel/liveupdate/kexec_handover.c-1037-{\n--\nkernel/liveupdate/kexec_handover.c-1041-}\nkernel/liveupdate/kexec_handover.c:1042:EXPORT_SYMBOL_GPL(kho_split_preserved_pages);\nkernel/liveupdate/kexec_handover.c-1043-\n"
} |
| 9/2 | 2026/07/03 02:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 8986 output: 19 thoughts: 35 Thoughts: **Initial Assessment: Observing Modification, Seeking Usage** Okay, so I'm seeing no active users right now – that's the immediate state. However, my internal flags are up because I've noticed modifications to `kho_preserve_pages` and `kho_unpreserve_pages`. This is significant; these functions are likely core to some key process, even if no one is explicitly *using* them at the moment. My first instinct, as always, is to follow the breadcrumbs. It's time to trace the usage of those modified functions. I need to understand why they were touched and what implications those changes might have. This is where the real work begins. |
| 10/2 | 2026/07/03 02:29 | tool | grepper |
0mArgs:{
"Expression": "kho_preserve_pages"
}Results: {
"Output": "include/linux/kexec_handover.h=24=void kho_unpreserve_folio(struct folio *folio);\ninclude/linux/kexec_handover.h:25:int kho_preserve_pages(struct page *page, unsigned long nr_pages);\ninclude/linux/kexec_handover.h-26-void kho_unpreserve_pages(struct page *page, unsigned long nr_pages);\n--\ninclude/linux/kexec_handover.h=60=static inline void kho_unpreserve_folio(struct folio *folio) { }\ninclude/linux/kexec_handover.h-61-\ninclude/linux/kexec_handover.h:62:static inline int kho_preserve_pages(struct page *page, unsigned int nr_pages)\ninclude/linux/kexec_handover.h-63-{\n--\nkernel/liveupdate/kexec_handover.c=453=EXPORT_SYMBOL_GPL(kho_restore_folio);\n--\nkernel/liveupdate/kexec_handover.c-460- * Restore a contiguous list of order 0 pages that was preserved with\nkernel/liveupdate/kexec_handover.c:461: * kho_preserve_pages().\nkernel/liveupdate/kexec_handover.c-462- *\n--\nkernel/liveupdate/kexec_handover.c=907=EXPORT_SYMBOL_GPL(kho_unpreserve_folio);\nkernel/liveupdate/kexec_handover.c-908-\nkernel/liveupdate/kexec_handover.c:909:static unsigned int __kho_preserve_pages_order(unsigned long start_pfn,\nkernel/liveupdate/kexec_handover.c-910-\t\t\t\t\t unsigned long end_pfn)\n--\nkernel/liveupdate/kexec_handover.c=938=static void __kho_unpreserve(struct kho_radix_tree *tree,\n--\nkernel/liveupdate/kexec_handover.c-941-\twhile (pfn \u003c end_pfn) {\nkernel/liveupdate/kexec_handover.c:942:\t\tunsigned int order = __kho_preserve_pages_order(pfn, end_pfn);\nkernel/liveupdate/kexec_handover.c-943-\t\tenum kho_page_type type;\n--\nkernel/liveupdate/kexec_handover.c-954-/**\nkernel/liveupdate/kexec_handover.c:955: * kho_preserve_pages - preserve contiguous pages across kexec\nkernel/liveupdate/kexec_handover.c-956- * @page: first page in the list.\n--\nkernel/liveupdate/kexec_handover.c-963- */\nkernel/liveupdate/kexec_handover.c:964:int kho_preserve_pages(struct page *page, unsigned long nr_pages)\nkernel/liveupdate/kexec_handover.c-965-{\n--\nkernel/liveupdate/kexec_handover.c-978-\twhile (pfn \u003c end_pfn) {\nkernel/liveupdate/kexec_handover.c:979:\t\tunsigned int order = __kho_preserve_pages_order(pfn, end_pfn);\nkernel/liveupdate/kexec_handover.c-980-\t\tenum kho_page_type type;\n--\nkernel/liveupdate/kexec_handover.c-998-}\nkernel/liveupdate/kexec_handover.c:999:EXPORT_SYMBOL_GPL(kho_preserve_pages);\nkernel/liveupdate/kexec_handover.c-1000-\n--\nkernel/liveupdate/kexec_handover.c-1007- * This must be called with the same @page and @nr_pages as the corresponding\nkernel/liveupdate/kexec_handover.c:1008: * kho_preserve_pages() call. Unpreserving arbitrary sub-ranges of larger\nkernel/liveupdate/kexec_handover.c-1009- * preserved blocks is not supported.\n--\nkernel/liveupdate/kexec_handover.c=1036=int kho_split_preserved_pages(struct page *page, unsigned int order)\n--\nkernel/liveupdate/kexec_handover.c-1039-\tsplit_page(page, order);\nkernel/liveupdate/kexec_handover.c:1040:\treturn kho_preserve_pages(page, 1UL \u003c\u003c order);\nkernel/liveupdate/kexec_handover.c-1041-}\n--\nkernel/liveupdate/kexec_handover.c=1075=static struct kho_vmalloc_chunk *new_vmalloc_chunk(struct kho_vmalloc_chunk *cur)\n--\nkernel/liveupdate/kexec_handover.c-1083-\nkernel/liveupdate/kexec_handover.c:1084:\terr = kho_preserve_pages(virt_to_page(chunk), 1);\nkernel/liveupdate/kexec_handover.c-1085-\tif (err)\n--\nkernel/liveupdate/kexec_handover.c=1125=int kho_preserve_vmalloc(void *ptr, struct kho_vmalloc *preservation)\n--\nkernel/liveupdate/kexec_handover.c-1150-\nkernel/liveupdate/kexec_handover.c:1151:\t\terr = kho_preserve_pages(vm-\u003epages[i], nr_contig_pages);\nkernel/liveupdate/kexec_handover.c-1152-\t\tif (err)\n--\nmm/memblock.c=2528=static int __init reserved_mem_preserve(void)\n--\nmm/memblock.c-2537-\nmm/memblock.c:2538:\t\terr = kho_preserve_pages(page, nr_pages);\nmm/memblock.c-2539-\t\tif (err)\n--\nmm/memblock.c=2557=static int __init prepare_kho_fdt(void)\n--\nmm/memblock.c-2569-\tfdt = page_to_virt(fdt_page);\nmm/memblock.c:2570:\terr = kho_preserve_pages(fdt_page, 1);\nmm/memblock.c-2571-\tif (err)\n"
} |
| 11/2 | 2026/07/03 02:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 10759 output: 20 thoughts: 157 Thoughts: **Analyzing Kernel Live Update for Kexec Handover** Okay, so this patch is digging into `kernel/liveupdate/kexec_handover.c`, which, as I recall, is right in the heart of the `CONFIG_KEXEC_HANDOVER` functionality. This is pretty fundamental stuff, core kernel code that I need to understand thoroughly. It looks like the patch introduces a new function, `kho_split_preserved_pages`, and then goes on to modify a few others: `kho_radix_add_page`, `kho_radix_del_page`, and `kho_radix_walk_tree`. The common thread is the introduction of a new `enum kho_page_type`, distinguishing between `KHO_PAGE_CONTIG` and `KHO_PAGE_SPLIT`. My gut tells me this is all related to handling memory that might be fragmented or split during the handover process. It's likely trying to improve the reliability or efficiency of preserving and restoring memory across the kexec transition. It's also touching `kho_preserve_pages` and `kho_unpreserve_pages`, which are the obvious candidates for handling these split pages. This is all functional code, it's not simply refactoring, so it must be addressing some real-world issue in Kexec handover. I'm going to double-check that `CONFIG_KEXEC_HANDOVER` is enabled in our configuration to be sure this is applicable to the current system, it's always good to be certain. |
| 12/2 | 2026/07/03 02:29 | tool | grepper |
0mArgs:{
"Expression": "config KEXEC_HANDOVER"
}Results: {
"Output": "kernel/liveupdate/Kconfig=3=menu \"Live Update and Kexec HandOver\"\nkernel/liveupdate/Kconfig-4-\nkernel/liveupdate/Kconfig:5:config KEXEC_HANDOVER\nkernel/liveupdate/Kconfig-6-\tbool \"kexec handover\"\n--\nkernel/liveupdate/Kconfig-17-\nkernel/liveupdate/Kconfig:18:config KEXEC_HANDOVER_DEBUG\nkernel/liveupdate/Kconfig-19-\tbool \"Enable Kexec Handover debug checks\"\n--\nkernel/liveupdate/Kconfig-26-\nkernel/liveupdate/Kconfig:27:config KEXEC_HANDOVER_DEBUGFS\nkernel/liveupdate/Kconfig-28-\tbool \"kexec handover debugfs interface\"\n--\nkernel/liveupdate/Kconfig-37-\nkernel/liveupdate/Kconfig:38:config KEXEC_HANDOVER_ENABLE_DEFAULT\nkernel/liveupdate/Kconfig-39-\tbool \"Enable kexec handover by default\"\n"
} |
| 13/2 | 2026/07/03 02:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 11508 output: 21 thoughts: 37 Thoughts: Okay, here's my interpretation of those thoughts, presented as if they're my own: **Investigating the Scope of a Kernel Live Update Patch** Alright, so a patch has hit my desk and it touches `kernel/liveupdate/kexec_handover.c`. My first question is always: *what else is affected?* I need to understand the full scope of this change. It's not enough to just look at the code modified, I need to understand if there are any subtle dependencies or side effects. Therefore, the logical next step is to examine the associated `Makefile`. It is crucial to determine if this change ripples outward, or is localized to the `kexec_handover` module. What other build configurations, include files, or dependencies might be impacted? If it's a critical module like this, I have to ensure I haven't missed any other configuration changes or related files. Gotta cover all the bases. |
| 14/2 | 2026/07/03 02:30 | tool | grepper |
0mArgs:{
"Expression": "kexec_handover.o"
}Results: {
"Output": "kernel/liveupdate/Makefile=3=luo-y :=\t\t\t\t\t\t\t\t\\\n--\nkernel/liveupdate/Makefile-9-\nkernel/liveupdate/Makefile:10:obj-$(CONFIG_KEXEC_HANDOVER)\t\t+= kexec_handover.o\nkernel/liveupdate/Makefile-11-obj-$(CONFIG_KEXEC_HANDOVER_DEBUG)\t+= kexec_handover_debug.o\n"
} |
| 15/2 | 2026/07/03 02:30 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 11872 output: 30 thoughts: 235 Thoughts: **Kernel Kexec Handover Functionality Analysis** Okay, so I see `CONFIG_KEXEC_HANDOVER` is the key configuration option we're dealing with here. Time to dig into the core functions. My initial focus is on these: `kho_split_preserved_pages`, `kho_radix_add_page`, `kho_radix_del_page`, `kho_preserve_pages`, `kho_unpreserve_pages`, and `kho_radix_walk_tree`. Let's confirm that `kho_split_preserved_pages` is correctly exported and reachable. Ah, yes, `EXPORT_SYMBOL_GPL(kho_split_preserved_pages)` confirms it's exported and visible to modules with a GPL license. This is a fresh function, interesting. The rest appear to be modified versions of existing functions. Checking... `kho_preserve_pages` is exported, `kho_unpreserve_pages` is exported, `kho_radix_add_page` is exported, `kho_radix_del_page` is exported, and `kho_radix_walk_tree` is exported. Wait, `kho_radix_add_page` and `kho_radix_del_page` are exported? Hmm, that's not what I expected. I'll need to look at the implications of these additions. |
| 16/2 | 2026/07/03 02:31 | tool | grepper |
0mArgs:{
"Expression": "EXPORT_SYMBOL_GPL\\(kho_radix_add_page\\)"
}Results: {
"Output": "kernel/liveupdate/kexec_handover.c=174=int kho_radix_add_page(struct kho_radix_tree *tree,\n--\nkernel/liveupdate/kexec_handover.c-242-}\nkernel/liveupdate/kexec_handover.c:243:EXPORT_SYMBOL_GPL(kho_radix_add_page);\nkernel/liveupdate/kexec_handover.c-244-\n"
} |
| 17/2 | 2026/07/03 02:31 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 12552 output: 221 thoughts: 566 Thoughts: **My Assessment of the KHO Page Splitting Patch** Okay, yes, I've got this. Let's start by looking at these new and modified static functions: `kho_is_page_split`, `kho_restore_refcounts`, and the updated radix encoding/decoding: `kho_radix_encode_key` and `kho_radix_decode_key`. Now, let's focus on these key symbols that seem central to the changes: `kho_split_preserved_pages`, `kho_preserve_pages`, `kho_unpreserve_pages`, `kho_radix_add_page`, `kho_radix_del_page`, `kho_radix_walk_tree`, and, hold on, `kho_preserve_folio` and `kho_unpreserve_folio`. Ah, right, those last two are also modified to use `KHO_PAGE_CONTIG`, good catch. I'll make sure to include those. Just double-checking, is `KEXEC_HANDOVER` the only relevant config here? Yes, `CONFIG_KEXEC_HANDOVER` seems sufficient. Now, a crucial point: is `kho_split_preserved_pages` actually reachable? It *is* exported, meaning modules could potentially call it. But is there a module that *does*? Okay, I've searched, and found no direct callers. However, it's exported and could be used in a later patch, and more importantly, it means that syzkaller *could* generate calls to it if it knows about it. Given that this is a functional change related to the core kernel – specifically liveupdate and kexec_handover – it's absolutely worth fuzzing. The radix tree and page preservation logic are being modified for split pages, so we need to test this thoroughly. Alright, let's formulate my response. **WorthFuzzing: true** **FocusSymbols:** * `kho_split_preserved_pages` * `kho_preserve_pages` * `kho_unpreserve_pages` * `kho_radix_add_page` * `kho_radix_del_page` * `kho_radix_walk_tree` * `kho_preserve_folio` * `kho_unpreserve_folio` **EnableConfigs:** * `KEXEC_HANDOVER` **Reasoning:** This patch introduces `kho_split_preserved_pages` and modifies the Kexec Handover (KHO) radix tree logic to support split pages. It touches core functionality, altering functions like `kho_radix_add_page`, `kho_radix_del_page`, and the page preservation methods. These are functional changes to the kernel's live update mechanism, and fuzzing is essential to ensure that the radix tree and page preservation logic correctly handle split pages, especially given that it is a functional change to the kernel's live update mechanism. |
| 18/2 | 2026/07/03 02:31 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"KEXEC_HANDOVER"
],
"FocusSymbols": [
"kho_split_preserved_pages",
"kho_preserve_pages",
"kho_unpreserve_pages",
"kho_radix_add_page",
"kho_radix_del_page",
"kho_radix_walk_tree",
"kho_preserve_folio",
"kho_unpreserve_folio"
],
"Reasoning": "The patch introduces a new function `kho_split_preserved_pages` and modifies the Kexec Handover (KHO) radix tree logic to support split pages. It changes core functions like `kho_radix_add_page`, `kho_radix_del_page`, `kho_preserve_pages`, and `kho_unpreserve_pages`. These are functional changes to the kernel's live update mechanism and should be fuzzed to ensure the radix tree and page preservation logic handles split pages correctly.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"KEXEC_HANDOVER"
],
"FocusSymbols": [
"kho_split_preserved_pages",
"kho_preserve_pages",
"kho_unpreserve_pages",
"kho_radix_add_page",
"kho_radix_del_page",
"kho_radix_walk_tree",
"kho_preserve_folio",
"kho_unpreserve_folio"
],
"Reasoning": "The patch introduces a new function `kho_split_preserved_pages` and modifies the Kexec Handover (KHO) radix tree logic to support split pages. It changes core functions like `kho_radix_add_page`, `kho_radix_del_page`, `kho_preserve_pages`, and `kho_unpreserve_pages`. These are functional changes to the kernel's live update mechanism and should be fuzzed to ensure the radix tree and page preservation logic handles split pages correctly.",
"WorthFuzzing": true
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|