| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/08/10 14:54 | flow | patch-triage |
1mArgs:null Results: {
"EnableConfigs": [
"MEMORY_FAILURE",
"KEXEC",
"KEXEC_FILE"
],
"FocusSymbols": [
"sanity_check_segment_list",
"range_first_hwpoison",
"range_last_hwpoison"
],
"KMSANReasoning": "The patch introduces checks to avoid hardware-poisoned memory during kexec operations. It adds functions to find the first or last hardware-poisoned page in a given physical memory range and uses them in kexec segment sanity checking and memory hole allocation. The changes only involve physical address calculations and integer arithmetic. There are no new structures allocated, no data copied to user space, and no complex logic that could expose uninitialized memory. Therefore, KMSAN is not applicable to this patch.",
"NeedsKMSAN": false,
"Reasoning": "The patch introduces `range_first_hwpoison` and `range_last_hwpoison` to check for hardware-poisoned memory ranges. It integrates these checks into the kexec subsystem (`sanity_check_segment_list` and memory hole allocation functions) to prevent kexec from using poisoned memory. These are functional changes to core kernel logic reachable in virtualized environments via the `kexec_load` and `kexec_file_load` syscalls.",
"WorthFuzzing": true
} |
| 1/1 | 2026/08/10 14:54 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 2adbad00605b2ea85c968931df7d697cd5839d95\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Mon Aug 10 14:54:49 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/include/linux/mm.h b/include/linux/mm.h\nindex 0d21112a8b63c..c8290ba003c8a 100644\n--- a/include/linux/mm.h\n+++ b/include/linux/mm.h\n@@ -5195,6 +5195,8 @@ extern const struct attribute_group memory_failure_attr_group;\n extern void memory_failure_queue(unsigned long pfn, int flags);\n void num_poisoned_pages_inc(unsigned long pfn);\n void num_poisoned_pages_sub(unsigned long pfn, long i);\n+phys_addr_t range_first_hwpoison(phys_addr_t start, unsigned long size);\n+phys_addr_t range_last_hwpoison(phys_addr_t start, unsigned long size);\n #else\n static inline void memory_failure_queue(unsigned long pfn, int flags)\n {\n@@ -5207,6 +5209,18 @@ static inline void num_poisoned_pages_inc(unsigned long pfn)\n static inline void num_poisoned_pages_sub(unsigned long pfn, long i)\n {\n }\n+\n+static inline phys_addr_t range_first_hwpoison(phys_addr_t start,\n+\t\t\t\t\t unsigned long size)\n+{\n+\treturn PHYS_ADDR_MAX;\n+}\n+\n+static inline phys_addr_t range_last_hwpoison(phys_addr_t start,\n+\t\t\t\t\t unsigned long size)\n+{\n+\treturn PHYS_ADDR_MAX;\n+}\n #endif\n \n #if defined(CONFIG_MEMORY_FAILURE) \u0026\u0026 defined(CONFIG_MEMORY_HOTPLUG)\ndiff --git a/kernel/kexec_core.c b/kernel/kexec_core.c\nindex dc770b9a6d053..7ee8c9f078f6b 100644\n--- a/kernel/kexec_core.c\n+++ b/kernel/kexec_core.c\n@@ -212,6 +212,16 @@ int sanity_check_segment_list(struct kimage *image)\n \t}\n #endif\n \n+\t/*\n+\t * Reject destinations that land on hardware-poisoned memory: the\n+\t * relocation copy would machine-check on the bad frame.\n+\t */\n+\tfor (i = 0; i \u003c nr_segments; i++) {\n+\t\tif (range_first_hwpoison(image-\u003esegment[i].mem,\n+\t\t\t\t\t image-\u003esegment[i].memsz) != PHYS_ADDR_MAX)\n+\t\t\treturn -EHWPOISON;\n+\t}\n+\n \t/*\n \t * The destination addresses are searched from system RAM rather than\n \t * being allocated from the buddy allocator, so they are not guaranteed\ndiff --git a/kernel/kexec_file.c b/kernel/kexec_file.c\nindex 2bfbb2d144e69..9305a6b0c23ac 100644\n--- a/kernel/kexec_file.c\n+++ b/kernel/kexec_file.c\n@@ -474,6 +474,7 @@ static int locate_mem_hole_top_down(unsigned long start, unsigned long end,\n {\n \tstruct kimage *image = kbuf-\u003eimage;\n \tunsigned long temp_start, temp_end;\n+\tphys_addr_t poison;\n \n \ttemp_end = min(end, kbuf-\u003ebuf_max);\n \ttemp_start = temp_end - kbuf-\u003ememsz + 1;\n@@ -503,6 +504,15 @@ static int locate_mem_hole_top_down(unsigned long start, unsigned long end,\n \t\t\tcontinue;\n \t\t}\n \n+\t\tpoison = range_first_hwpoison(temp_start, kbuf-\u003ememsz);\n+\t\tif (poison != PHYS_ADDR_MAX) {\n+\t\t\t/* we hit a poisoned page */\n+\t\t\tif (poison \u003c kbuf-\u003ememsz)\n+\t\t\t\treturn 0;\n+\t\t\ttemp_start = poison - kbuf-\u003ememsz;\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\t/* We found a suitable memory range */\n \t\tbreak;\n \t} while (1);\n@@ -519,6 +529,7 @@ static int locate_mem_hole_bottom_up(unsigned long start, unsigned long end,\n {\n \tstruct kimage *image = kbuf-\u003eimage;\n \tunsigned long temp_start, temp_end;\n+\tphys_addr_t poison;\n \n \ttemp_start = max(start, kbuf-\u003ebuf_min);\n \n@@ -545,6 +556,13 @@ static int locate_mem_hole_bottom_up(unsigned long start, unsigned long end,\n \t\t\tcontinue;\n \t\t}\n \n+\t\tpoison = range_last_hwpoison(temp_start, kbuf-\u003ememsz);\n+\t\tif (poison != PHYS_ADDR_MAX) {\n+\t\t\t/* we hit a poisoned page */\n+\t\t\ttemp_start = poison + PAGE_SIZE;\n+\t\t\tcontinue;\n+\t\t}\n+\n \t\t/* We found a suitable memory range */\n \t\tbreak;\n \t} while (1);\ndiff --git a/mm/memory-failure.c b/mm/memory-failure.c\nindex a8b03e2920ba8..f3875680e7955 100644\n--- a/mm/memory-failure.c\n+++ b/mm/memory-failure.c\n@@ -96,6 +96,47 @@ void num_poisoned_pages_sub(unsigned long pfn, long i)\n \t\tmemblk_nr_poison_sub(pfn, i);\n }\n \n+/*\n+ * Return the first or the last hardware-poisoned online page in [start,\n+ * start + size), or PHYS_ADDR_MAX if the range is clean.\n+ */\n+static phys_addr_t range_hwpoison(phys_addr_t start, unsigned long size,\n+\t\t\t\t bool first)\n+{\n+\tphys_addr_t poison = PHYS_ADDR_MAX;\n+\tunsigned long pfn, end_pfn;\n+\n+\tif (!size || !atomic_long_read(\u0026num_poisoned_pages))\n+\t\treturn poison;\n+\n+\tend_pfn = PHYS_PFN(start + size - 1);\n+\tfor (pfn = PHYS_PFN(start); pfn \u003c= end_pfn; pfn++) {\n+\t\tstruct page *page = pfn_to_online_page(pfn);\n+\n+\t\tcond_resched();\n+\n+\t\tif (!page || !is_page_hwpoison(page))\n+\t\t\tcontinue;\n+\n+\t\tif (first)\n+\t\t\treturn PFN_PHYS(pfn);\n+\n+\t\tpoison = PFN_PHYS(pfn);\n+\t}\n+\n+\treturn poison;\n+}\n+\n+phys_addr_t range_first_hwpoison(phys_addr_t start, unsigned long size)\n+{\n+\treturn range_hwpoison(start, size, true);\n+}\n+\n+phys_addr_t range_last_hwpoison(phys_addr_t start, unsigned long size)\n+{\n+\treturn range_hwpoison(start, size, false);\n+}\n+\n /**\n * MF_ATTR_RO - Create sysfs entry for each memory failure statistics.\n * @_name: name of the file in the per NUMA sysfs directory.\n"
} |
| 2/1 | 2026/08/10 14:54 | agent | patch-evaluator |
1mModel:best-expensive Args: null Results: {
"EnableConfigs": [
"MEMORY_FAILURE",
"KEXEC",
"KEXEC_FILE"
],
"FocusSymbols": [
"sanity_check_segment_list",
"range_first_hwpoison",
"range_last_hwpoison"
],
"Reasoning": "The patch introduces `range_first_hwpoison` and `range_last_hwpoison` to check for hardware-poisoned memory ranges. It integrates these checks into the kexec subsystem (`sanity_check_segment_list` and memory hole allocation functions) to prevent kexec from using poisoned memory. These are functional changes to core kernel logic reachable in virtualized environments via the `kexec_load` and `kexec_file_load` syscalls.",
"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). - Code in vendor-specific PCIe switch, SmartNIC, or GPU drivers (e.g., mlxsw, pds_core, qed, ionic, amdgpu) that require physical PCIe hardware cards not emulated in standard QEMU. - Driver .remove, .shutdown, or pci_unregister_driver teardown callbacks (e.g., igb_remove) that are executed only during PCI hot-unplug or sysfs driver unbind operations. 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. Prefer non-static, non-inlined API entrypoint functions over internal static helper functions (which are inlined by the compiler and do not have distinct symbol addresses). 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. Also check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed for Kbuild to compile the code statically into vmlinux. 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 2adbad00605b2ea85c968931df7d697cd5839d95
Author: syz-cluster <triage@syzkaller.com>
Date: Mon Aug 10 14:54:49 2026 +0000
syz-cluster: applied patch under review
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 0d21112a8b63c..c8290ba003c8a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -5195,6 +5195,8 @@ extern const struct attribute_group memory_failure_attr_group;
extern void memory_failure_queue(unsigned long pfn, int flags);
void num_poisoned_pages_inc(unsigned long pfn);
void num_poisoned_pages_sub(unsigned long pfn, long i);
+phys_addr_t range_first_hwpoison(phys_addr_t start, unsigned long size);
+phys_addr_t range_last_hwpoison(phys_addr_t start, unsigned long size);
#else
static inline void memory_failure_queue(unsigned long pfn, int flags)
{
@@ -5207,6 +5209,18 @@ static inline void num_poisoned_pages_inc(unsigned long pfn)
static inline void num_poisoned_pages_sub(unsigned long pfn, long i)
{
}
+
+static inline phys_addr_t range_first_hwpoison(phys_addr_t start,
+ unsigned long size)
+{
+ return PHYS_ADDR_MAX;
+}
+
+static inline phys_addr_t range_last_hwpoison(phys_addr_t start,
+ unsigned long size)
+{
+ return PHYS_ADDR_MAX;
+}
#endif
#if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_MEMORY_HOTPLUG)
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index dc770b9a6d053..7ee8c9f078f6b 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -212,6 +212,16 @@ int sanity_check_segment_list(struct kimage *image)
}
#endif
+ /*
+ * Reject destinations that land on hardware-poisoned memory: the
+ * relocation copy would machine-check on the bad frame.
+ */
+ for (i = 0; i < nr_segments; i++) {
+ if (range_first_hwpoison(image->segment[i].mem,
+ image->segment[i].memsz) != PHYS_ADDR_MAX)
+ return -EHWPOISON;
+ }
+
/*
* The destination addresses are searched from system RAM rather than
* being allocated from the buddy allocator, so they are not guaranteed
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 2bfbb2d144e69..9305a6b0c23ac 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -474,6 +474,7 @@ static int locate_mem_hole_top_down(unsigned long start, unsigned long end,
{
struct kimage *image = kbuf->image;
unsigned long temp_start, temp_end;
+ phys_addr_t poison;
temp_end = min(end, kbuf->buf_max);
temp_start = temp_end - kbuf->memsz + 1;
@@ -503,6 +504,15 @@ static int locate_mem_hole_top_down(unsigned long start, unsigned long end,
continue;
}
+ poison = range_first_hwpoison(temp_start, kbuf->memsz);
+ if (poison != PHYS_ADDR_MAX) {
+ /* we hit a poisoned page */
+ if (poison < kbuf->memsz)
+ return 0;
+ temp_start = poison - kbuf->memsz;
+ continue;
+ }
+
/* We found a suitable memory range */
break;
} while (1);
@@ -519,6 +529,7 @@ static int locate_mem_hole_bottom_up(unsigned long start, unsigned long end,
{
struct kimage *image = kbuf->image;
unsigned long temp_start, temp_end;
+ phys_addr_t poison;
temp_start = max(start, kbuf->buf_min);
@@ -545,6 +556,13 @@ static int locate_mem_hole_bottom_up(unsigned long start, unsigned long end,
continue;
}
+ poison = range_last_hwpoison(temp_start, kbuf->memsz);
+ if (poison != PHYS_ADDR_MAX) {
+ /* we hit a poisoned page */
+ temp_start = poison + PAGE_SIZE;
+ continue;
+ }
+
/* We found a suitable memory range */
break;
} while (1);
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index a8b03e2920ba8..f3875680e7955 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -96,6 +96,47 @@ void num_poisoned_pages_sub(unsigned long pfn, long i)
memblk_nr_poison_sub(pfn, i);
}
+/*
+ * Return the first or the last hardware-poisoned online page in [start,
+ * start + size), or PHYS_ADDR_MAX if the range is clean.
+ */
+static phys_addr_t range_hwpoison(phys_addr_t start, unsigned long size,
+ bool first)
+{
+ phys_addr_t poison = PHYS_ADDR_MAX;
+ unsigned long pfn, end_pfn;
+
+ if (!size || !atomic_long_read(&num_poisoned_pages))
+ return poison;
+
+ end_pfn = PHYS_PFN(start + size - 1);
+ for (pfn = PHYS_PFN(start); pfn <= end_pfn; pfn++) {
+ struct page *page = pfn_to_online_page(pfn);
+
+ cond_resched();
+
+ if (!page || !is_page_hwpoison(page))
+ continue;
+
+ if (first)
+ return PFN_PHYS(pfn);
+
+ poison = PFN_PHYS(pfn);
+ }
+
+ return poison;
+}
+
+phys_addr_t range_first_hwpoison(phys_addr_t start, unsigned long size)
+{
+ return range_hwpoison(start, size, true);
+}
+
+phys_addr_t range_last_hwpoison(phys_addr_t start, unsigned long size)
+{
+ return range_hwpoison(start, size, false);
+}
+
/**
* MF_ATTR_RO - Create sysfs entry for each memory failure statistics.
* @_name: name of the file in the per NUMA sysfs directory.
|
| 3/2 | 2026/08/10 14:54 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 3620 output: 35 thoughts: 276 Thoughts: **Analyzing the Kexec Hardware Poisoning Patch** Okay, so I'm looking at this patch. It introduces `range_first_hwpoison` and `range_last_hwpoison` functions to `mm/memory-failure.c`. These seem to be the core of the protection mechanism. The key here is to prevent kexec from inadvertently using memory that has been flagged as hardware-poisoned. Makes sense; you don't want a system to reboot into a poisoned memory region. Let me quickly confirm kexec's relevance, particularly in virtualized environments. Right, of course, it's a standard feature. No surprises there. The changes are in `kernel/kexec_core.c` (specifically `sanity_check_segment_list`) and `kernel/kexec_file.c` (`locate_mem_hole_top_down` and `locate_mem_hole_bottom_up`). So, it looks like this patch modifies how kexec handles memory segments and hole detection to avoid the poisoned regions. Now, let's nail down the configuration dependencies. `CONFIG_MEMORY_FAILURE` is obviously critical; otherwise, those `range_` functions become essentially no-ops. Also, we'll need either `CONFIG_KEXEC_CORE` or `CONFIG_KEXEC_FILE` enabled for the kexec changes themselves to be included. Let's dive deeper into `sanity_check_segment_list` in `kernel/kexec_core.c` and figure out how it does the work. I need to understand exactly how the poisoned memory avoidance is implemented within that function. |
| 4/2 | 2026/08/10 14:54 | tool | grepper |
0mArgs:{
"Expression": "sanity_check_segment_list",
"PathPrefix": "kernel/kexec_core.c"
}Results: {
"Output": "kernel/kexec_core.c=106=static struct page *kimage_alloc_page(struct kimage *image,\n--\nkernel/kexec_core.c-109-\nkernel/kexec_core.c:110:int sanity_check_segment_list(struct kimage *image)\nkernel/kexec_core.c-111-{\n"
} |
| 5/2 | 2026/08/10 14:54 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 4377 output: 31 thoughts: 17 Thoughts: Here's my thought process, summarized as you requested: **Debugging Strategy: Locating the Call to `sanity_check_segment_list`** Okay, so I need to understand the execution context of `sanity_check_segment_list`. My first move, as always, is to trace its usage. I need to figure out *where* this function is being called from. This is crucial for understanding the data it's operating on and the potential sources of any issues. Time to dig into the codebase and find all the places where `sanity_check_segment_list` is invoked. That'll be the starting point for my investigation. |
| 6/2 | 2026/08/10 14:54 | tool | grepper |
0mError:no matches Args: {
"Expression": "sanity_check_segment_list",
"PathPrefix": "kernel/kexec"
}Results: {
"error": "no matches"
} |
| 7/2 | 2026/08/10 14:54 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 4576 output: 29 thoughts: 25 Thoughts: Okay, let's see. My first thought is: **Where to start digging?** I know this functionality is core, so I need to find the right files within the kernel source. My gut tells me it's related to the kexec mechanism, so I should probably focus on `kernel/kexec_core.c` or perhaps `kernel/kexec.c`. Those seem like the most likely candidates to contain the code I'm after. I'll start there and see what I can find. |
| 8/2 | 2026/08/10 14:55 | tool | grepper |
0mArgs:{
"Expression": "sanity_check_segment_list",
"PathPrefix": "kernel/"
}Results: {
"Output": "kernel/kexec.c=22=static int kimage_alloc_init(struct kimage **rimage, unsigned long entry,\n--\nkernel/kexec.c-56-\nkernel/kexec.c:57:\tret = sanity_check_segment_list(image);\nkernel/kexec.c-58-\tif (ret)\n--\nkernel/kexec_core.c=106=static struct page *kimage_alloc_page(struct kimage *image,\n--\nkernel/kexec_core.c-109-\nkernel/kexec_core.c:110:int sanity_check_segment_list(struct kimage *image)\nkernel/kexec_core.c-111-{\n--\nkernel/kexec_file.c=305=kimage_file_alloc_init(struct kimage **rimage, int kernel_fd,\n--\nkernel/kexec_file.c-332-\nkernel/kexec_file.c:333:\tret = sanity_check_segment_list(image);\nkernel/kexec_file.c-334-\tif (ret)\n--\nkernel/kexec_internal.h=9=struct kimage *do_kimage_alloc_init(void);\nkernel/kexec_internal.h:10:int sanity_check_segment_list(struct kimage *image);\nkernel/kexec_internal.h-11-void kimage_free_page_list(struct list_head *list);\n"
} |
| 9/2 | 2026/08/10 14:55 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 5112 output: 29 thoughts: 65 Thoughts: Here's my summary, as though I'm thinking through this process: **Analyzing the Kexec Memory Hole Patch** Okay, so this patch is clearly digging into the memory hole allocation logic within kexec. Specifically, it's targeting `locate_mem_hole_top_down` and `locate_mem_hole_bottom_up` functions, which live in `kernel/kexec_file.c`. These are, of course, critical for `kexec_file_load`. I need to understand *why* this part of the code is being touched. I wonder if there's a memory fragmentation issue, perhaps a regression related to kdump or kexec's ability to locate a suitable region. First thing’s first, I should check the `Kconfig` file, specifically the `CONFIG_MEMORY_FAILURE` setting. This has implications for how the kernel handles memory errors during boot or operation and could well be connected here. I need to understand if this is related to a failure scenario. Let's see what happens if that setting is enabled or disabled. That will give me some clues as to the intent here, and also any related constraints. |
| 10/2 | 2026/08/10 14:55 | tool | grepper |
0mArgs:{
"Expression": "config MEMORY_FAILURE",
"PathPrefix": "mm/Kconfig"
}Results: {
"Output": "mm/Kconfig=762=config ARCH_SUPPORTS_MEMORY_FAILURE\n--\nmm/Kconfig-764-\nmm/Kconfig:765:config MEMORY_FAILURE\nmm/Kconfig-766-\tdepends on MMU\n"
} |
| 11/2 | 2026/08/10 14:55 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 5526 output: 33 thoughts: 27 Thoughts: Okay, here's my take on those functions, as if I were thinking it: **Analyzing Memory Hole Location Functions** Alright, time to get back into this. I need to take a fresh look at `locate_mem_hole_top_down` and `locate_mem_hole_bottom_up`. These are critical for memory management, of course, so I want to make sure I understand the nuances of both approaches. I need to refresh my memory on the specific criteria they use to define a "hole," the algorithms each employs to find it, and any potential trade-offs. What are the pros and cons of searching from the top versus the bottom of the memory space? Are there specific scenarios where one will be drastically more efficient than the other? I'm going to pay close attention to the edge cases – what happens when the requested memory is larger than the available space, or when there's only a very small, fragmented hole left? Let's dig in and make sure this memory allocation is absolutely rock-solid. |
| 12/2 | 2026/08/10 14:55 | tool | grepper |
0mArgs:{
"Expression": "locate_mem_hole",
"PathPrefix": "kernel/kexec_file.c"
}Results: {
"Output": "kernel/kexec_file.c=364=SYSCALL_DEFINE5(kexec_file_load, int, kernel_fd, int, initrd_fd,\n--\nkernel/kexec_file.c-471-\nkernel/kexec_file.c:472:static int locate_mem_hole_top_down(unsigned long start, unsigned long end,\nkernel/kexec_file.c-473-\t\t\t\t struct kexec_buf *kbuf)\n--\nkernel/kexec_file.c-526-\nkernel/kexec_file.c:527:static int locate_mem_hole_bottom_up(unsigned long start, unsigned long end,\nkernel/kexec_file.c-528-\t\t\t\t struct kexec_buf *kbuf)\n--\nkernel/kexec_file.c-576-\nkernel/kexec_file.c:577:static int locate_mem_hole_callback(struct resource *res, void *arg)\nkernel/kexec_file.c-578-{\n--\nkernel/kexec_file.c-599-\tif (kbuf-\u003etop_down)\nkernel/kexec_file.c:600:\t\treturn locate_mem_hole_top_down(start, end, kbuf);\nkernel/kexec_file.c:601:\treturn locate_mem_hole_bottom_up(start, end, kbuf);\nkernel/kexec_file.c-602-}\n--\nkernel/kexec_file.c=605=static int kexec_walk_memblock(struct kexec_buf *kbuf,\n--\nkernel/kexec_file.c-620-\t * IORESOURCE_SYSRAM_DRIVER_MANAGED handling in\nkernel/kexec_file.c:621:\t * locate_mem_hole_callback().\nkernel/kexec_file.c-622-\t */\n--\nkernel/kexec_file.c=688=static int kexec_alloc_contig(struct kexec_buf *kbuf)\n--\nkernel/kexec_file.c-725-/**\nkernel/kexec_file.c:726: * kexec_locate_mem_hole - find free memory for the purgatory or the next kernel\nkernel/kexec_file.c-727- * @kbuf:\tParameters for the memory search.\n--\nkernel/kexec_file.c-732- */\nkernel/kexec_file.c:733:int kexec_locate_mem_hole(struct kexec_buf *kbuf)\nkernel/kexec_file.c-734-{\n--\nkernel/kexec_file.c-744-\t */\nkernel/kexec_file.c:745:\tret = kho_locate_mem_hole(kbuf, locate_mem_hole_callback);\nkernel/kexec_file.c-746-\tif (ret \u003c= 0)\n--\nkernel/kexec_file.c-756-\tif (!IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK))\nkernel/kexec_file.c:757:\t\tret = kexec_walk_resources(kbuf, locate_mem_hole_callback);\nkernel/kexec_file.c-758-\telse\nkernel/kexec_file.c:759:\t\tret = kexec_walk_memblock(kbuf, locate_mem_hole_callback);\nkernel/kexec_file.c-760-\n--\nkernel/kexec_file.c=774=int kexec_add_buffer(struct kexec_buf *kbuf)\n--\nkernel/kexec_file.c-803-\t/* Walk the RAM ranges and allocate a suitable range for the buffer */\nkernel/kexec_file.c:804:\tret = arch_kexec_locate_mem_hole(kbuf);\nkernel/kexec_file.c-805-\tif (ret)\n"
} |
| 13/2 | 2026/08/10 14:55 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 6780 output: 32 thoughts: 154 Thoughts: **My Analysis of the Memory Failure Patch** Okay, so I'm looking at this patch and my initial thought is that it's introducing these new functions, `range_first_hwpoison` and `range_last_hwpoison`, directly into `mm/memory-failure.c`. Interesting. My immediate concern is where they're being *used*. So, I see that they're being called from `sanity_check_segment_list` in `kernel/kexec_core.c` and also within `locate_mem_hole_top_down` and `locate_mem_hole_bottom_up` in `kernel/kexec_file.c`. That gives me a good start on understanding the scope of this change. Now, I need to understand the dependencies. Clearly, `MEMORY_FAILURE` is needed, but what about the kexec bits? It looks like both `KEXEC_CORE` and `KEXEC_FILE` are relevant. Wait, a flag went off in my head. `KEXEC_CORE` is *selected* by both `KEXEC` and `KEXEC_FILE`, which means... okay, I need to check the dependencies on `KEXEC_FILE` to get a complete picture of the build requirements. I need to fully understand how these features interact and what other flags might be required. |
| 14/2 | 2026/08/10 14:55 | tool | grepper |
0mArgs:{
"Expression": "config KEXEC_FILE",
"PathPrefix": "kernel/Kconfig.kexec"
}Results: {
"Output": "kernel/Kconfig.kexec=20=config KEXEC\n--\nkernel/Kconfig.kexec-37-\nkernel/Kconfig.kexec:38:config KEXEC_FILE\nkernel/Kconfig.kexec-39-\tbool \"Enable kexec file based system call\"\n"
} |
| 15/2 | 2026/08/10 14:55 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 7332 output: 29 thoughts: 11 Thoughts: Okay, here's my take on those thoughts, tailored for an expert audience: **Analyzing the Dependency Chain for a MEMORY_FAILURE** Alright, a `MEMORY_FAILURE`. Time to get strategic. My immediate thought is, before jumping into any deep diagnostics, I need to understand the *context*. Specifically, I'm thinking about the dependencies related to this `MEMORY_FAILURE`. I need to start mapping the potential chain of cause and effect. Is this a cascading failure, triggered by something upstream? Or is it a localized issue? Understanding those dependencies will drive my subsequent investigations. My mental checklist includes not just the immediate code, but also related services, resource constraints, and any external factors that could be at play. We're looking for the root cause and the dependencies will give us that. |
| 16/2 | 2026/08/10 14:55 | tool | grepper |
0mArgs:{
"Expression": "config MEMORY_FAILURE",
"PathPrefix": "mm/Kconfig"
}Results: {
"Output": "mm/Kconfig=762=config ARCH_SUPPORTS_MEMORY_FAILURE\n--\nmm/Kconfig-764-\nmm/Kconfig:765:config MEMORY_FAILURE\nmm/Kconfig-766-\tdepends on MMU\n"
} |
| 17/2 | 2026/08/10 14:55 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 7611 output: 33 thoughts: 137 Thoughts: **Analyzing Key Functions** Okay, let's break down these functions. My immediate focus needs to be on `sanity_check_segment_list`, `locate_mem_hole_top_down`, `locate_mem_hole_bottom_up`, `range_first_hwpoison`, and `range_last_hwpoison`. I'm seeing a distinction here. Wait, `locate_mem_hole_top_down` and `locate_mem_hole_bottom_up` are defined as static, implying they're internal to a specific compilation unit or scope. `sanity_check_segment_list`, `range_first_hwpoison`, and `range_last_hwpoison` are non-static. The next logical step is to verify whether `range_first_hwpoison` is exported. |
| 18/2 | 2026/08/10 14:55 | tool | grepper |
0mArgs:{
"Expression": "range_first_hwpoison",
"PathPrefix": "mm/memory-failure.c"
}Results: {
"Output": "mm/memory-failure.c=103=static phys_addr_t range_hwpoison(phys_addr_t start, unsigned long size,\n--\nmm/memory-failure.c-129-\nmm/memory-failure.c:130:phys_addr_t range_first_hwpoison(phys_addr_t start, unsigned long size)\nmm/memory-failure.c-131-{\n"
} |
| 19/2 | 2026/08/10 14:55 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 8065 output: 26 thoughts: 305 Thoughts: **Analyzing the `kexec` System Calls for Fuzzing Potential** Okay, so I'm looking at this code and it's not exported as part of a module, which makes it a global function. The relevant syscalls here are `kexec_load` and `kexec_file_load`. Initially, I was thinking about focusing on those two syscalls directly, or perhaps the underlying functions they call like `sanity_check_segment_list`, `range_first_hwpoison`, and `range_last_hwpoison`. Wait a minute, `sanity_check_segment_list` is called from both `kimage_alloc_init` and `kimage_file_alloc_init`! And *that* simplifies things. `kimage_alloc_init` is called by `sys_kexec_load`, and `kimage_file_alloc_init` is called by `sys_kexec_file_load`. So, `sanity_check_segment_list` is definitely reachable on *every* `kexec_load` and `kexec_file_load` call. Excellent. The new logic appears to be checking whether the destination addresses specified in the kexec load land on hardware-poisoned memory. That's a definite functional change, making it a prime target for fuzzing. I can see potential edge cases and unexpected behavior there. The important configurations for this are `MEMORY_FAILURE`, `KEXEC`, and `KEXEC_FILE`, which I need to keep in mind for building a proper fuzzing environment. My key focus symbols for the fuzzing campaign are now: `sanity_check_segment_list`, `range_first_hwpoison`, and `range_last_hwpoison`. I should probably verify that `MEMORY_FAILURE` doesn't depend on any other config settings, just to make sure I don't miss something critical. |
| 20/2 | 2026/08/10 14:55 | tool | grepper |
0mArgs:{
"Expression": "depends on",
"PathPrefix": "mm/Kconfig"
}Results: {
"Output": "mm/Kconfig=12=menuconfig SWAP\nmm/Kconfig-13-\tbool \"Support for paging of anonymous memory (swap)\"\nmm/Kconfig:14:\tdepends on MMU \u0026\u0026 BLOCK \u0026\u0026 !ARCH_NO_SWAP\nmm/Kconfig-15-\tdefault y\n--\nmm/Kconfig=22=config ZSWAP\nmm/Kconfig-23-\tbool \"Compressed cache for swap pages\"\nmm/Kconfig:24:\tdepends on SWAP\nmm/Kconfig-25-\tselect CRYPTO\n--\nmm/Kconfig=35=config ZSWAP_DEFAULT_ON\nmm/Kconfig-36-\tbool \"Enable the compressed cache for swap pages by default\"\nmm/Kconfig:37:\tdepends on ZSWAP\nmm/Kconfig-38-\thelp\n--\nmm/Kconfig=45=config ZSWAP_SHRINKER_DEFAULT_ON\nmm/Kconfig-46-\tbool \"Shrink the zswap pool on memory pressure\"\nmm/Kconfig:47:\tdepends on ZSWAP\nmm/Kconfig-48-\tdefault n\n--\nmm/Kconfig=59=choice\nmm/Kconfig-60-\tprompt \"Default compressor\"\nmm/Kconfig:61:\tdepends on ZSWAP\nmm/Kconfig-62-\tdefault ZSWAP_COMPRESSOR_DEFAULT_LZO\n--\nmm/Kconfig=114=config ZSWAP_COMPRESSOR_DEFAULT\nmm/Kconfig-115- string\nmm/Kconfig:116: depends on ZSWAP\nmm/Kconfig-117- default \"deflate\" if ZSWAP_COMPRESSOR_DEFAULT_DEFLATE\n--\nmm/Kconfig=128=menu \"Zsmalloc allocator options\"\nmm/Kconfig:129:\tdepends on ZSMALLOC\nmm/Kconfig-130-\n--\nmm/Kconfig=168=config KVFREE_RCU_BATCHED\nmm/Kconfig-169-\tdef_bool y\nmm/Kconfig:170:\tdepends on !SLUB_TINY \u0026\u0026 !TINY_RCU\nmm/Kconfig:171:\tdepends on !RCU_STRICT_GRACE_PERIOD\nmm/Kconfig-172-\nmm/Kconfig=173=config SLUB_TINY\nmm/Kconfig-174-\tbool \"Configure for minimal memory footprint\"\nmm/Kconfig:175:\tdepends on EXPERT \u0026\u0026 !COMPILE_TEST\nmm/Kconfig-176-\tselect SLAB_MERGE_DEFAULT\n--\nmm/Kconfig=200=config SLAB_FREELIST_RANDOM\nmm/Kconfig-201-\tbool \"Randomize slab freelist\"\nmm/Kconfig:202:\tdepends on !SLUB_TINY\nmm/Kconfig-203-\thelp\n--\nmm/Kconfig=208=config SLAB_FREELIST_HARDENED\nmm/Kconfig-209-\tbool \"Harden slab freelist metadata\"\nmm/Kconfig:210:\tdepends on !SLUB_TINY\nmm/Kconfig-211-\thelp\n--\nmm/Kconfig=217=config SLAB_BUCKETS\nmm/Kconfig-218-\tbool \"Support allocation from separate kmalloc buckets\"\nmm/Kconfig:219:\tdepends on !SLUB_TINY\nmm/Kconfig-220-\tdefault SLAB_FREELIST_HARDENED\n--\nmm/Kconfig=234=config SLUB_STATS\n--\nmm/Kconfig-236-\tbool \"Enable performance statistics\"\nmm/Kconfig:237:\tdepends on SYSFS \u0026\u0026 !SLUB_TINY\nmm/Kconfig-238-\thelp\n--\nmm/Kconfig=247=config KMALLOC_PARTITION_CACHES\nmm/Kconfig:248:\tdepends on !SLUB_TINY\nmm/Kconfig-249-\tbool \"Partitioned slab caches for normal kmalloc\"\n--\nmm/Kconfig=263=choice\nmm/Kconfig-264-\tprompt \"Partitioned slab cache mode\"\nmm/Kconfig:265:\tdepends on KMALLOC_PARTITION_CACHES\nmm/Kconfig-266-\tdefault KMALLOC_PARTITION_TYPED if CC_HAS_ALLOC_TOKEN\n--\nmm/Kconfig=283=config KMALLOC_PARTITION_TYPED\nmm/Kconfig-284-\tbool \"Type based slab cache selection for normal kmalloc\"\nmm/Kconfig:285:\tdepends on CC_HAS_ALLOC_TOKEN\nmm/Kconfig-286-\thelp\n--\nmm/Kconfig=354=config MMAP_ALLOW_UNINITIALIZED\nmm/Kconfig-355-\tbool \"Allow mmapped anonymous memory to be uninitialized\"\nmm/Kconfig:356:\tdepends on EXPERT \u0026\u0026 !MMU\nmm/Kconfig-357-\tdefault n\n--\nmm/Kconfig=376=config SELECT_MEMORY_MODEL\nmm/Kconfig-377-\tdef_bool y\nmm/Kconfig:378:\tdepends on ARCH_SELECT_MEMORY_MODEL\nmm/Kconfig-379-\nmm/Kconfig=380=choice\nmm/Kconfig-381-\tprompt \"Memory model\"\nmm/Kconfig:382:\tdepends on SELECT_MEMORY_MODEL\nmm/Kconfig-383-\tdefault SPARSEMEM_MANUAL if ARCH_SPARSEMEM_DEFAULT\n--\nmm/Kconfig=391=config FLATMEM_MANUAL\nmm/Kconfig-392-\tbool \"Flat Memory\"\nmm/Kconfig:393:\tdepends on !NUMA\nmm/Kconfig:394:\tdepends on !ARCH_SPARSEMEM_ENABLE || ARCH_FLATMEM_ENABLE\nmm/Kconfig-395-\thelp\n--\nmm/Kconfig=407=config SPARSEMEM_MANUAL\nmm/Kconfig-408-\tbool \"Sparse Memory\"\nmm/Kconfig:409:\tdepends on ARCH_SPARSEMEM_ENABLE\nmm/Kconfig-410-\thelp\n--\nmm/Kconfig=422=config SPARSEMEM\nmm/Kconfig-423-\tdef_bool y\nmm/Kconfig:424:\tdepends on (!SELECT_MEMORY_MODEL \u0026\u0026 ARCH_SPARSEMEM_ENABLE) || SPARSEMEM_MANUAL\nmm/Kconfig-425-\nmm/Kconfig=426=config FLATMEM\nmm/Kconfig-427-\tdef_bool y\nmm/Kconfig:428:\tdepends on !NUMA\nmm/Kconfig:429:\tdepends on !SPARSEMEM || FLATMEM_MANUAL\nmm/Kconfig-430-\n--\nmm/Kconfig=449=config SPARSEMEM_EXTREME\nmm/Kconfig-450-\tdef_bool y\nmm/Kconfig:451:\tdepends on SPARSEMEM \u0026\u0026 !SPARSEMEM_STATIC\nmm/Kconfig-452-\n--\nmm/Kconfig=456=config SPARSEMEM_VMEMMAP\nmm/Kconfig-457-\tdef_bool y\nmm/Kconfig:458:\tdepends on SPARSEMEM \u0026\u0026 SPARSEMEM_VMEMMAP_ENABLE\nmm/Kconfig-459-\thelp\n--\nmm/Kconfig=482=config HAVE_GUP_FAST\nmm/Kconfig:483:\tdepends on MMU\nmm/Kconfig-484-\tbool\n--\nmm/Kconfig=506=config EXCLUSIVE_SYSTEM_RAM\nmm/Kconfig-507-\tdef_bool y\nmm/Kconfig:508:\tdepends on !DEVMEM || STRICT_DEVMEM\nmm/Kconfig-509-\n--\nmm/Kconfig=514=menuconfig MEMORY_HOTPLUG\n--\nmm/Kconfig-516-\tselect MEMORY_ISOLATION\nmm/Kconfig:517:\tdepends on SPARSEMEM_VMEMMAP\nmm/Kconfig:518:\tdepends on ARCH_ENABLE_MEMORY_HOTPLUG\nmm/Kconfig:519:\tdepends on 64BIT\nmm/Kconfig-520-\tselect NUMA_KEEP_MEMINFO if NUMA\n--\nmm/Kconfig=586=config MHP_MEMMAP_ON_MEMORY\nmm/Kconfig-587-\tdef_bool y\nmm/Kconfig:588:\tdepends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE\nmm/Kconfig-589-\n--\nmm/Kconfig=592=config ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE\n--\nmm/Kconfig-598-# Default to 4 for wider testing, though 8 might be more appropriate.\nmm/Kconfig:599:# ARM's adjust_pte (unused if VIPT) depends on mm-wide page_table_lock.\nmm/Kconfig-600-# PA-RISC 7xxx's spinlock_t would enlarge struct page from 32 to 44 bytes.\n--\nmm/Kconfig=606=config SPLIT_PTE_PTLOCKS\nmm/Kconfig-607-\tdef_bool y\nmm/Kconfig:608:\tdepends on MMU\nmm/Kconfig:609:\tdepends on SMP\nmm/Kconfig:610:\tdepends on NR_CPUS \u003e= 4\nmm/Kconfig:611:\tdepends on !ARM || CPU_CACHE_VIPT\nmm/Kconfig:612:\tdepends on !PARISC || PA20\nmm/Kconfig:613:\tdepends on !SPARC32\nmm/Kconfig:614:\tdepends on !UML\nmm/Kconfig-615-\n--\nmm/Kconfig=619=config SPLIT_PMD_PTLOCKS\nmm/Kconfig-620-\tdef_bool y\nmm/Kconfig:621:\tdepends on SPLIT_PTE_PTLOCKS \u0026\u0026 ARCH_ENABLE_SPLIT_PMD_PTLOCK\nmm/Kconfig-622-\n--\nmm/Kconfig=630=config BALLOON_MIGRATION\n--\nmm/Kconfig-632-\tdefault y\nmm/Kconfig:633:\tdepends on MIGRATION \u0026\u0026 BALLOON\nmm/Kconfig-634-\thelp\n--\nmm/Kconfig=642=config COMPACTION\n--\nmm/Kconfig-645-\tselect MIGRATION\nmm/Kconfig:646:\tdepends on MMU\nmm/Kconfig-647-\thelp\n--\nmm/Kconfig=657=config COMPACT_UNEVICTABLE_DEFAULT\nmm/Kconfig-658-\tint\nmm/Kconfig:659:\tdepends on COMPACTION\nmm/Kconfig-660-\tdefault 0 if PREEMPT_RT\n--\nmm/Kconfig=673=config NUMA_MIGRATION\n--\nmm/Kconfig-675-\tdefault y\nmm/Kconfig:676:\tdepends on NUMA \u0026\u0026 MMU\nmm/Kconfig-677-\tselect MIGRATION\n--\nmm/Kconfig=684=config MIGRATION\nmm/Kconfig-685-\tbool\nmm/Kconfig:686:\tdepends on MMU\nmm/Kconfig-687-\n--\nmm/Kconfig=728=config KSM\nmm/Kconfig-729-\tbool \"Enable KSM for page merging\"\nmm/Kconfig:730:\tdepends on MMU\nmm/Kconfig-731-\tselect XXHASH\n--\nmm/Kconfig=743=config DEFAULT_MMAP_MIN_ADDR\nmm/Kconfig-744-\tint \"Low address space to protect from user allocation\"\nmm/Kconfig:745:\tdepends on MMU\nmm/Kconfig-746-\tdefault 4096\n--\nmm/Kconfig=765=config MEMORY_FAILURE\nmm/Kconfig:766:\tdepends on MMU\nmm/Kconfig:767:\tdepends on ARCH_SUPPORTS_MEMORY_FAILURE\nmm/Kconfig-768-\tbool \"Enable recovery from hardware memory errors\"\n--\nmm/Kconfig=776=config HWPOISON_INJECT\nmm/Kconfig-777-\ttristate \"HWPoison pages injector\"\nmm/Kconfig:778:\tdepends on MEMORY_FAILURE \u0026\u0026 DEBUG_KERNEL \u0026\u0026 PROC_FS\nmm/Kconfig-779-\tselect PROC_PAGE_MONITOR\n--\nmm/Kconfig=781=config NOMMU_INITIAL_TRIM_EXCESS\nmm/Kconfig-782-\tint \"Turn on mmap() excess space trimming before booting\"\nmm/Kconfig:783:\tdepends on !MMU\nmm/Kconfig-784-\tdefault 1\n--\nmm/Kconfig=815=config PERSISTENT_HUGE_ZERO_FOLIO\nmm/Kconfig-816-\tbool \"Allocate a PMD sized folio for zeroing\"\nmm/Kconfig:817:\tdepends on TRANSPARENT_HUGEPAGE\nmm/Kconfig-818-\thelp\n--\nmm/Kconfig=834=menuconfig TRANSPARENT_HUGEPAGE\nmm/Kconfig-835-\tbool \"Transparent Hugepage Support\"\nmm/Kconfig:836:\tdepends on HAVE_ARCH_TRANSPARENT_HUGEPAGE \u0026\u0026 !PREEMPT_RT\nmm/Kconfig-837-\tselect COMPACTION\n--\nmm/Kconfig=970=config THP_SWAP\nmm/Kconfig-971-\tdef_bool y\nmm/Kconfig:972:\tdepends on ARCH_WANTS_THP_SWAP \u0026\u0026 SWAP \u0026\u0026 64BIT\nmm/Kconfig-973-\thelp\n--\nmm/Kconfig=1016=config ARCH_SUPPORTS_HUGE_PFNMAP\nmm/Kconfig-1017-\tdef_bool n\nmm/Kconfig:1018:\tdepends on TRANSPARENT_HUGEPAGE\nmm/Kconfig-1019-\nmm/Kconfig=1020=config ARCH_SUPPORTS_PMD_PFNMAP\nmm/Kconfig-1021-\tdef_bool y\nmm/Kconfig:1022:\tdepends on ARCH_SUPPORTS_HUGE_PFNMAP \u0026\u0026 HAVE_ARCH_TRANSPARENT_HUGEPAGE\nmm/Kconfig-1023-\nmm/Kconfig=1024=config ARCH_SUPPORTS_PUD_PFNMAP\nmm/Kconfig-1025-\tdef_bool y\nmm/Kconfig:1026:\tdepends on ARCH_SUPPORTS_HUGE_PFNMAP \u0026\u0026 HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD\nmm/Kconfig-1027-\n--\nmm/Kconfig=1038=config NEED_PER_CPU_KM\nmm/Kconfig:1039:\tdepends on !SMP || !MMU\nmm/Kconfig-1040-\tbool\n--\nmm/Kconfig=1055=config CMA\nmm/Kconfig-1056-\tbool \"Contiguous Memory Allocator\"\nmm/Kconfig:1057:\tdepends on MMU\nmm/Kconfig-1058-\tselect MIGRATION\n--\nmm/Kconfig=1070=config CMA_DEBUGFS\nmm/Kconfig-1071-\tbool \"CMA debugfs interface\"\nmm/Kconfig:1072:\tdepends on CMA \u0026\u0026 DEBUG_FS\nmm/Kconfig-1073-\thelp\n--\nmm/Kconfig=1076=config CMA_SYSFS\nmm/Kconfig-1077-\tbool \"CMA information through sysfs interface\"\nmm/Kconfig:1078:\tdepends on CMA \u0026\u0026 SYSFS\nmm/Kconfig-1079-\thelp\n--\nmm/Kconfig=1083=config CMA_AREAS\nmm/Kconfig-1084-\tint \"Maximum count of the CMA areas\"\nmm/Kconfig:1085:\tdepends on CMA\nmm/Kconfig-1086-\tdefault 20 if NUMA\n--\nmm/Kconfig=1130=config MEM_SOFT_DIRTY\nmm/Kconfig-1131-\tbool \"Track memory changes\"\nmm/Kconfig:1132:\tdepends on CHECKPOINT_RESTORE \u0026\u0026 HAVE_ARCH_SOFT_DIRTY \u0026\u0026 PROC_FS\nmm/Kconfig-1133-\tselect PROC_PAGE_MONITOR\n--\nmm/Kconfig=1145=config STACK_MAX_DEFAULT_SIZE_MB\n--\nmm/Kconfig-1148-\trange 8 2048\nmm/Kconfig:1149:\tdepends on STACK_GROWSUP \u0026\u0026 (!64BIT || COMPAT)\nmm/Kconfig-1150-\thelp\n--\nmm/Kconfig=1157=config DEFERRED_STRUCT_PAGE_INIT\nmm/Kconfig-1158-\tbool \"Defer initialisation of struct pages to kthreads\"\nmm/Kconfig:1159:\tdepends on SPARSEMEM\nmm/Kconfig:1160:\tdepends on !NEED_PER_CPU_KM\nmm/Kconfig:1161:\tdepends on 64BIT\nmm/Kconfig:1162:\tdepends on !KMSAN\nmm/Kconfig-1163-\tselect PADATA\n--\nmm/Kconfig=1181=config IDLE_PAGE_TRACKING\nmm/Kconfig-1182-\tbool \"Enable idle page tracking\"\nmm/Kconfig:1183:\tdepends on SYSFS \u0026\u0026 MMU\nmm/Kconfig-1184-\tselect PAGE_IDLE_FLAG\n--\nmm/Kconfig=1219=config ZONE_DMA32\nmm/Kconfig-1220-\tbool \"Support DMA32 zone\" if ARCH_HAS_ZONE_DMA_SET\nmm/Kconfig:1221:\tdepends on !X86_32\nmm/Kconfig-1222-\tdefault y if ARM64\n--\nmm/Kconfig=1224=config ZONE_DEVICE\nmm/Kconfig-1225-\tbool \"Device memory (pmem, HMM, etc...) hotplug support\"\nmm/Kconfig:1226:\tdepends on MEMORY_HOTREMOVE\nmm/Kconfig-1227-\tselect XARRAY_MULTI\n--\nmm/Kconfig=1246=config HMM_MIRROR\nmm/Kconfig-1247-\tbool\nmm/Kconfig:1248:\tdepends on MMU\nmm/Kconfig-1249-\tselect MMU_NOTIFIER\n--\nmm/Kconfig=1254=config DEVICE_PRIVATE\nmm/Kconfig-1255-\tbool \"Unaddressable device memory (GPU memory, ...)\"\nmm/Kconfig:1256:\tdepends on ZONE_DEVICE\nmm/Kconfig-1257-\tselect GET_FREE_REGION\n--\nmm/Kconfig=1293=config GUP_TEST\nmm/Kconfig-1294-\tbool \"Enable infrastructure for get_user_pages()-related unit tests\"\nmm/Kconfig:1295:\tdepends on DEBUG_FS\nmm/Kconfig-1296-\thelp\n--\nmm/Kconfig=1313=comment \"GUP_TEST needs to have DEBUG_FS enabled\"\nmm/Kconfig:1314:\tdepends on !GUP_TEST \u0026\u0026 !DEBUG_FS\nmm/Kconfig-1315-\n--\nmm/Kconfig=1319=config DMAPOOL_TEST\nmm/Kconfig-1320-\ttristate \"Enable a module to run time tests on dma_pool\"\nmm/Kconfig:1321:\tdepends on HAS_DMA\nmm/Kconfig-1322-\thelp\n--\nmm/Kconfig=1343=config SECRETMEM\n--\nmm/Kconfig-1345-\tbool \"Enable memfd_secret() system call\" if EXPERT\nmm/Kconfig:1346:\tdepends on ARCH_HAS_SET_DIRECT_MAP\nmm/Kconfig-1347-\thelp\n--\nmm/Kconfig=1352=config ANON_VMA_NAME\nmm/Kconfig-1353-\tbool \"Anonymous VMA name support\"\nmm/Kconfig:1354:\tdepends on PROC_FS \u0026\u0026 ADVISE_SYSCALLS \u0026\u0026 MMU\nmm/Kconfig-1355-\n--\nmm/Kconfig=1376=config USERFAULTFD_RWP\nmm/Kconfig-1377-\tdef_bool y\nmm/Kconfig:1378:\tdepends on 64BIT \u0026\u0026 ARCH_HAS_PTE_PROTNONE \u0026\u0026 HAVE_ARCH_USERFAULTFD_WP\nmm/Kconfig-1379-\thelp\n--\nmm/Kconfig=1385=menuconfig USERFAULTFD\nmm/Kconfig-1386-\tbool \"Enable userfaultfd() system call\"\nmm/Kconfig:1387:\tdepends on MMU\nmm/Kconfig-1388-\thelp\n--\nmm/Kconfig=1392=config PTE_MARKER_UFFD_WP\n--\nmm/Kconfig-1394-\tdefault y\nmm/Kconfig:1395:\tdepends on USERFAULTFD \u0026\u0026 HAVE_ARCH_USERFAULTFD_WP\nmm/Kconfig-1396-\n--\nmm/Kconfig=1403=config LRU_GEN\nmm/Kconfig-1404-\tbool \"Multi-Gen LRU\"\nmm/Kconfig:1405:\tdepends on MMU\nmm/Kconfig-1406-\t# make sure folio-\u003eflags has enough spare bits\nmm/Kconfig:1407:\tdepends on 64BIT || !SPARSEMEM || SPARSEMEM_VMEMMAP\nmm/Kconfig-1408-\thelp\n--\nmm/Kconfig=1412=config LRU_GEN_ENABLED\nmm/Kconfig-1413-\tbool \"Enable by default\"\nmm/Kconfig:1414:\tdepends on LRU_GEN\nmm/Kconfig-1415-\thelp\n--\nmm/Kconfig=1418=config LRU_GEN_STATS\nmm/Kconfig-1419-\tbool \"Full stats for debugging\"\nmm/Kconfig:1420:\tdepends on LRU_GEN\nmm/Kconfig-1421-\thelp\n--\nmm/Kconfig=1427=config LRU_GEN_WALKS_MMU\nmm/Kconfig-1428-\tdef_bool y\nmm/Kconfig:1429:\tdepends on LRU_GEN \u0026\u0026 ARCH_HAS_HW_PTE_YOUNG\nmm/Kconfig-1430-# }\n--\nmm/Kconfig=1435=config PER_VMA_LOCK\nmm/Kconfig-1436-\tdef_bool y\nmm/Kconfig:1437:\tdepends on ARCH_SUPPORTS_PER_VMA_LOCK \u0026\u0026 MMU \u0026\u0026 SMP\nmm/Kconfig-1438-\thelp\n--\nmm/Kconfig=1444=config LOCK_MM_AND_FIND_VMA\nmm/Kconfig-1445-\tbool\nmm/Kconfig:1446:\tdepends on !STACK_GROWSUP\nmm/Kconfig-1447-\n--\nmm/Kconfig=1457=config NUMA_EMU\nmm/Kconfig-1458-\tbool \"NUMA emulation\"\nmm/Kconfig:1459:\tdepends on NUMA_MEMBLKS\nmm/Kconfig:1460:\tdepends on X86 || GENERIC_ARCH_NUMA\nmm/Kconfig-1461-\thelp\n--\nmm/Kconfig=1482=config PT_RECLAIM\nmm/Kconfig-1483-\tdef_bool y\nmm/Kconfig:1484:\tdepends on MMU_GATHER_RCU_TABLE_FREE \u0026\u0026 !HAVE_ARCH_TLB_REMOVE_TABLE\nmm/Kconfig-1485-\thelp\n--\nmm/Kconfig=1501=config LAZY_MMU_MODE_KUNIT_TEST\nmm/Kconfig-1502-\ttristate \"KUnit tests for the lazy MMU mode\" if !KUNIT_ALL_TESTS\nmm/Kconfig:1503:\tdepends on ARCH_HAS_LAZY_MMU_MODE\nmm/Kconfig:1504:\tdepends on KUNIT\nmm/Kconfig-1505-\tdefault KUNIT_ALL_TESTS\n"
} |
| 21/2 | 2026/08/10 14:55 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 14926 output: 32 thoughts: 88 Thoughts: Here's my understanding of the situation, breaking it down in my own thought process: **Deductive Reasoning on Kernel Configuration** Okay, so I'm looking at these kernel configuration options. The key here seems to be `MEMORY_FAILURE`. I can see that its functionality is intrinsically tied to the Memory Management Unit, the `MMU`, and whether the architecture has hardware support for handling memory failures, specifically, `ARCH_SUPPORTS_MEMORY_FAILURE`. The good news is, from what I can see, `ARCH_SUPPORTS_MEMORY_FAILURE` is explicitly enabled by the major architectures like x86, arm64, and PowerPC. Therefore, it appears that enabling `MEMORY_FAILURE` alone should be sufficient to ensure the necessary functionality. No need to worry about the underlying support - it's handled. Next, I'm noting that `KEXEC` and `KEXEC_FILE` are common configurations. These are standard, but to be thorough, I should now confirm what, if any, dependencies `KEXEC_FILE` might have. Gotta make sure everything lines up properly. I'll need to check the config options for that. |
| 22/2 | 2026/08/10 14:55 | tool | grepper |
0mArgs:{
"Expression": "config KEXEC_FILE",
"PathPrefix": "kernel/Kconfig.kexec"
}Results: {
"Output": "kernel/Kconfig.kexec=20=config KEXEC\n--\nkernel/Kconfig.kexec-37-\nkernel/Kconfig.kexec:38:config KEXEC_FILE\nkernel/Kconfig.kexec-39-\tbool \"Enable kexec file based system call\"\n"
} |
| 23/2 | 2026/08/10 14:55 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 15372 output: 29 thoughts: 17 Thoughts: Okay, here's my summary, considering my expertise: **Checking `KEXEC_FILE` Dependencies** Right, before I proceed any further with this, I need to take a step back and consider the potential ramifications of working with `KEXEC_FILE`. My initial instinct is to dig in, but I've learned that a hasty approach can be disastrous, especially when dealing with something as low-level as kernel execution. The most prudent course of action now is to verify whether `KEXEC_FILE` itself has any hidden dependencies. It could be linked to some other kernel component, a specific module, or even a particular configuration option. A dependency check is crucial to ensure that any changes I make, or any subsequent actions that depend on `KEXEC_FILE`, don't inadvertently break something else further down the line. I need to be absolutely certain that I fully understand the scope of influence before I go any deeper. This is about being meticulous, not just efficient. Better to invest the time now, rather than debugging a cascading failure later on. |
| 24/2 | 2026/08/10 14:55 | tool | grepper |
0mArgs:{
"Expression": "depends on",
"PathPrefix": "kernel/Kconfig.kexec"
}Results: {
"Output": "kernel/Kconfig.kexec=20=config KEXEC\nkernel/Kconfig.kexec-21-\tbool \"Enable kexec system call\"\nkernel/Kconfig.kexec:22:\tdepends on ARCH_SUPPORTS_KEXEC\nkernel/Kconfig.kexec-23-\tselect KEXEC_CORE\n--\nkernel/Kconfig.kexec=38=config KEXEC_FILE\nkernel/Kconfig.kexec-39-\tbool \"Enable kexec file based system call\"\nkernel/Kconfig.kexec:40:\tdepends on ARCH_SUPPORTS_KEXEC_FILE\nkernel/Kconfig.kexec-41-\tselect CRYPTO_LIB_SHA256\n--\nkernel/Kconfig.kexec=49=config KEXEC_SIG\nkernel/Kconfig.kexec-50-\tbool \"Verify kernel signature during kexec_file_load() syscall\"\nkernel/Kconfig.kexec:51:\tdepends on ARCH_SUPPORTS_KEXEC_SIG\nkernel/Kconfig.kexec:52:\tdepends on KEXEC_FILE\nkernel/Kconfig.kexec-53-\thelp\n--\nkernel/Kconfig.kexec=63=config KEXEC_SIG_FORCE\nkernel/Kconfig.kexec-64-\tbool \"Require a valid signature in kexec_file_load() syscall\"\nkernel/Kconfig.kexec:65:\tdepends on ARCH_SUPPORTS_KEXEC_SIG_FORCE\nkernel/Kconfig.kexec:66:\tdepends on KEXEC_SIG\nkernel/Kconfig.kexec-67-\thelp\n--\nkernel/Kconfig.kexec=71=config KEXEC_IMAGE_VERIFY_SIG\n--\nkernel/Kconfig.kexec-73-\tdefault ARCH_DEFAULT_KEXEC_IMAGE_VERIFY_SIG\nkernel/Kconfig.kexec:74:\tdepends on ARCH_SUPPORTS_KEXEC_IMAGE_VERIFY_SIG\nkernel/Kconfig.kexec:75:\tdepends on KEXEC_SIG\nkernel/Kconfig.kexec:76:\tdepends on EFI \u0026\u0026 SIGNED_PE_FILE_VERIFICATION\nkernel/Kconfig.kexec-77-\thelp\n--\nkernel/Kconfig.kexec=80=config KEXEC_BZIMAGE_VERIFY_SIG\nkernel/Kconfig.kexec-81-\tbool \"Enable bzImage signature verification support\"\nkernel/Kconfig.kexec:82:\tdepends on ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG\nkernel/Kconfig.kexec:83:\tdepends on KEXEC_SIG\nkernel/Kconfig.kexec:84:\tdepends on SIGNED_PE_FILE_VERIFICATION\nkernel/Kconfig.kexec-85-\tselect SYSTEM_TRUSTED_KEYRING\n--\nkernel/Kconfig.kexec=89=config KEXEC_JUMP\nkernel/Kconfig.kexec-90-\tbool \"kexec jump\"\nkernel/Kconfig.kexec:91:\tdepends on ARCH_SUPPORTS_KEXEC_JUMP\nkernel/Kconfig.kexec:92:\tdepends on KEXEC \u0026\u0026 HIBERNATION\nkernel/Kconfig.kexec-93-\thelp\n--\nkernel/Kconfig.kexec=97=config CRASH_DUMP\n--\nkernel/Kconfig.kexec-99-\tdefault ARCH_DEFAULT_CRASH_DUMP\nkernel/Kconfig.kexec:100:\tdepends on ARCH_SUPPORTS_CRASH_DUMP\nkernel/Kconfig.kexec:101:\tdepends on KEXEC_CORE\nkernel/Kconfig.kexec-102-\tselect VMCORE_INFO\n--\nkernel/Kconfig.kexec=118=config CRASH_DM_CRYPT\nkernel/Kconfig.kexec-119-\tbool \"Support saving crash dump to dm-crypt encrypted volume\"\nkernel/Kconfig.kexec:120:\tdepends on KEXEC_FILE\nkernel/Kconfig.kexec:121:\tdepends on CRASH_DUMP\nkernel/Kconfig.kexec:122:\tdepends on DM_CRYPT\nkernel/Kconfig.kexec:123:\tdepends on KEYS\nkernel/Kconfig.kexec-124-\thelp\n--\nkernel/Kconfig.kexec=136=config CRASH_DUMP_KUNIT_TEST\nkernel/Kconfig.kexec-137-\ttristate \"Unit Tests for kernel crash dumps\" if !KUNIT_ALL_TESTS\nkernel/Kconfig.kexec:138:\tdepends on CRASH_DUMP \u0026\u0026 KUNIT\nkernel/Kconfig.kexec-139-\tdefault KUNIT_ALL_TESTS\n--\nkernel/Kconfig.kexec=147=config CRASH_HOTPLUG\n--\nkernel/Kconfig.kexec-149-\tdefault y\nkernel/Kconfig.kexec:150:\tdepends on CRASH_DUMP \u0026\u0026 (HOTPLUG_CPU || MEMORY_HOTPLUG)\nkernel/Kconfig.kexec:151:\tdepends on ARCH_SUPPORTS_CRASH_HOTPLUG\nkernel/Kconfig.kexec-152-\thelp\n--\nkernel/Kconfig.kexec=161=config CRASH_MAX_MEMORY_RANGES\n--\nkernel/Kconfig.kexec-163-\tdefault 8192\nkernel/Kconfig.kexec:164:\tdepends on CRASH_HOTPLUG\nkernel/Kconfig.kexec-165-\thelp\n"
} |
| 25/2 | 2026/08/10 14:55 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 16969 output: 171 thoughts: 1106 Thoughts: **Kexec and Memory Failure: Configuration and Fuzzing Strategy** Okay, so I've been looking at this kexec-related patch. My initial thought was that `KEXEC` and `KEXEC_FILE` should be enough, but upon closer inspection, `KEXEC_CORE` is also selected by them. Therefore, I need to enable all of those configs: `KEXEC`, `KEXEC_FILE`, and now `MEMORY_FAILURE`. I need to ensure the system is properly configured to handle memory failures, as this patch directly impacts how kexec interacts with potentially poisoned memory. Now, let's verify reachability. The critical function, `sanity_check_segment_list`, is indeed reachable via the `sys_kexec_load` and `sys_kexec_file_load` syscall paths, as it's called through `kimage_alloc_init` and `kimage_file_alloc_init`, respectively. Good. I also checked that `locate_mem_hole_top_down` and `locate_mem_hole_bottom_up` are reachable, also through `sys_kexec_file_load` and the `kexec_locate_mem_hole` path. Excellent. Finally, I've confirmed that `range_first_hwpoison` and `range_last_hwpoison` are reachable, since they are called from those other functions. Given that reachability and functionality are confirmed, here's what I've determined based on the prompt's instructions: The required configs are: * `MEMORY_FAILURE` * `KEXEC` * `KEXEC_FILE` I need to focus on these symbols for fuzzing: * `sanity_check_segment_list` * `range_first_hwpoison` * `range_last_hwpoison` While `locate_mem_hole_top_down` and `locate_mem_hole_bottom_up` are reachable, they are static functions. The prompt specifically asks to prioritize non-static entry points, so I will exclude them. Finally, I reviewed the prompt's exclusion criteria. This patch doesn't fall into any of the excluded categories. It introduces changes related to core kernel logic, specifically the kexec subsystem and memory failure handling, which are reachable in environments like QEMU through system calls. Thus, the patch has significant value and should be fuzzed. |
| 26/2 | 2026/08/10 14:55 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"MEMORY_FAILURE",
"KEXEC",
"KEXEC_FILE"
],
"FocusSymbols": [
"sanity_check_segment_list",
"range_first_hwpoison",
"range_last_hwpoison"
],
"Reasoning": "The patch introduces `range_first_hwpoison` and `range_last_hwpoison` to check for hardware-poisoned memory ranges. It integrates these checks into the kexec subsystem (`sanity_check_segment_list` and memory hole allocation functions) to prevent kexec from using poisoned memory. These are functional changes to core kernel logic reachable in virtualized environments via the `kexec_load` and `kexec_file_load` syscalls.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"MEMORY_FAILURE",
"KEXEC",
"KEXEC_FILE"
],
"FocusSymbols": [
"sanity_check_segment_list",
"range_first_hwpoison",
"range_last_hwpoison"
],
"Reasoning": "The patch introduces `range_first_hwpoison` and `range_last_hwpoison` to check for hardware-poisoned memory ranges. It integrates these checks into the kexec subsystem (`sanity_check_segment_list` and memory hole allocation functions) to prevent kexec from using poisoned memory. These are functional changes to core kernel logic reachable in virtualized environments via the `kexec_load` and `kexec_file_load` syscalls.",
"WorthFuzzing": true
} |
| 27/1 | 2026/08/10 14:55 | action | If |
0mArgs:{
"WorthFuzzing": true
}Results: null |
| 28/2 | 2026/08/10 14:55 | agent | kmsan-evaluator |
0mModel:best-expensive Args: null Results: {
"KMSANReasoning": "The patch introduces checks to avoid hardware-poisoned memory during kexec operations. It adds functions to find the first or last hardware-poisoned page in a given physical memory range and uses them in kexec segment sanity checking and memory hole allocation. The changes only involve physical address calculations and integer arithmetic. There are no new structures allocated, no data copied to user space, and no complex logic that could expose uninitialized memory. Therefore, KMSAN is not applicable to this patch.",
"NeedsKMSAN": false
}Instruction: You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.
CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
a comprehensive suite of debugging tools and sanitizers, including KASAN
(out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
(locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
or page allocations) and kernel-to-user memory info-leaks.
Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.
Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.
Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
attributes, ioctl output arguments, socket options, or BPF buffers) where fields
or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
uninitialized bytes of existing buffers.
Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
dereferences, locking deadlocks, or use-after-free bugs (these are already caught
by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.
Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
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 2adbad00605b2ea85c968931df7d697cd5839d95
Author: syz-cluster <triage@syzkaller.com>
Date: Mon Aug 10 14:54:49 2026 +0000
syz-cluster: applied patch under review
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 0d21112a8b63c..c8290ba003c8a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -5195,6 +5195,8 @@ extern const struct attribute_group memory_failure_attr_group;
extern void memory_failure_queue(unsigned long pfn, int flags);
void num_poisoned_pages_inc(unsigned long pfn);
void num_poisoned_pages_sub(unsigned long pfn, long i);
+phys_addr_t range_first_hwpoison(phys_addr_t start, unsigned long size);
+phys_addr_t range_last_hwpoison(phys_addr_t start, unsigned long size);
#else
static inline void memory_failure_queue(unsigned long pfn, int flags)
{
@@ -5207,6 +5209,18 @@ static inline void num_poisoned_pages_inc(unsigned long pfn)
static inline void num_poisoned_pages_sub(unsigned long pfn, long i)
{
}
+
+static inline phys_addr_t range_first_hwpoison(phys_addr_t start,
+ unsigned long size)
+{
+ return PHYS_ADDR_MAX;
+}
+
+static inline phys_addr_t range_last_hwpoison(phys_addr_t start,
+ unsigned long size)
+{
+ return PHYS_ADDR_MAX;
+}
#endif
#if defined(CONFIG_MEMORY_FAILURE) && defined(CONFIG_MEMORY_HOTPLUG)
diff --git a/kernel/kexec_core.c b/kernel/kexec_core.c
index dc770b9a6d053..7ee8c9f078f6b 100644
--- a/kernel/kexec_core.c
+++ b/kernel/kexec_core.c
@@ -212,6 +212,16 @@ int sanity_check_segment_list(struct kimage *image)
}
#endif
+ /*
+ * Reject destinations that land on hardware-poisoned memory: the
+ * relocation copy would machine-check on the bad frame.
+ */
+ for (i = 0; i < nr_segments; i++) {
+ if (range_first_hwpoison(image->segment[i].mem,
+ image->segment[i].memsz) != PHYS_ADDR_MAX)
+ return -EHWPOISON;
+ }
+
/*
* The destination addresses are searched from system RAM rather than
* being allocated from the buddy allocator, so they are not guaranteed
diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c
index 2bfbb2d144e69..9305a6b0c23ac 100644
--- a/kernel/kexec_file.c
+++ b/kernel/kexec_file.c
@@ -474,6 +474,7 @@ static int locate_mem_hole_top_down(unsigned long start, unsigned long end,
{
struct kimage *image = kbuf->image;
unsigned long temp_start, temp_end;
+ phys_addr_t poison;
temp_end = min(end, kbuf->buf_max);
temp_start = temp_end - kbuf->memsz + 1;
@@ -503,6 +504,15 @@ static int locate_mem_hole_top_down(unsigned long start, unsigned long end,
continue;
}
+ poison = range_first_hwpoison(temp_start, kbuf->memsz);
+ if (poison != PHYS_ADDR_MAX) {
+ /* we hit a poisoned page */
+ if (poison < kbuf->memsz)
+ return 0;
+ temp_start = poison - kbuf->memsz;
+ continue;
+ }
+
/* We found a suitable memory range */
break;
} while (1);
@@ -519,6 +529,7 @@ static int locate_mem_hole_bottom_up(unsigned long start, unsigned long end,
{
struct kimage *image = kbuf->image;
unsigned long temp_start, temp_end;
+ phys_addr_t poison;
temp_start = max(start, kbuf->buf_min);
@@ -545,6 +556,13 @@ static int locate_mem_hole_bottom_up(unsigned long start, unsigned long end,
continue;
}
+ poison = range_last_hwpoison(temp_start, kbuf->memsz);
+ if (poison != PHYS_ADDR_MAX) {
+ /* we hit a poisoned page */
+ temp_start = poison + PAGE_SIZE;
+ continue;
+ }
+
/* We found a suitable memory range */
break;
} while (1);
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index a8b03e2920ba8..f3875680e7955 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -96,6 +96,47 @@ void num_poisoned_pages_sub(unsigned long pfn, long i)
memblk_nr_poison_sub(pfn, i);
}
+/*
+ * Return the first or the last hardware-poisoned online page in [start,
+ * start + size), or PHYS_ADDR_MAX if the range is clean.
+ */
+static phys_addr_t range_hwpoison(phys_addr_t start, unsigned long size,
+ bool first)
+{
+ phys_addr_t poison = PHYS_ADDR_MAX;
+ unsigned long pfn, end_pfn;
+
+ if (!size || !atomic_long_read(&num_poisoned_pages))
+ return poison;
+
+ end_pfn = PHYS_PFN(start + size - 1);
+ for (pfn = PHYS_PFN(start); pfn <= end_pfn; pfn++) {
+ struct page *page = pfn_to_online_page(pfn);
+
+ cond_resched();
+
+ if (!page || !is_page_hwpoison(page))
+ continue;
+
+ if (first)
+ return PFN_PHYS(pfn);
+
+ poison = PFN_PHYS(pfn);
+ }
+
+ return poison;
+}
+
+phys_addr_t range_first_hwpoison(phys_addr_t start, unsigned long size)
+{
+ return range_hwpoison(start, size, true);
+}
+
+phys_addr_t range_last_hwpoison(phys_addr_t start, unsigned long size)
+{
+ return range_hwpoison(start, size, false);
+}
+
/**
* MF_ATTR_RO - Create sysfs entry for each memory failure statistics.
* @_name: name of the file in the per NUMA sysfs directory.
|
| 29/3 | 2026/08/10 14:55 | llm | kmsan-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 3617 output: 123 thoughts: 639 Thoughts: **Analyzing the Uninitialized Memory Risks in the Kexec Patch** Okay, so this patch focuses on integrating memory failure checks into the kexec code. My initial assessment is that it looks pretty straightforward, but I need to be meticulous. I've got to ensure there aren't any sneaky uninitialized memory exposures. First, I see the addition of `range_first_hwpoison` and `range_last_hwpoison` functions in `mm/memory-failure.c`, with their corresponding stubs in `include/linux/mm.h`. That makes sense, those seem to be the core of the new hardware-poisoned memory detection. I also note the modification of `sanity_check_segment_list` to reject poisoned segments, and crucially, the changes to `locate_mem_hole_top_down` and `locate_mem_hole_bottom_up` to *skip* this poisoned memory when searching for memory holes for kexec segments. Now, let's drill down into the potential for uninitialized memory risks. I see two new `phys_addr_t poison` variables are added in the `locate_mem_hole` functions. These are initialized using the `range_first_hwpoison` or `range_last_hwpoison` functions, which return either `PHYS_ADDR_MAX` or a physical address. Good, that initialization is clear. I see no cases where those variables are used without being initialized first. Excellent. Further analysis reveals no structures are being passed to user space, so that's a check. Also, there are no complex data structures being allocated where uninitialized fields could be read. There are no bounds checks or length calculations that could lead to reading uninitialized bytes either. Therefore, I'm confident that this patch does *not* introduce any uninitialized memory risks. We can safely set `NeedsKMSAN` to `false` for this one. Just to be absolutely certain, I'm double-checking the logic in `locate_mem_hole_top_down`. Here, I'm looking at the `if (poison < kbuf->memsz)` condition. Ah, right, that's not about uninitialized memory at all; it's an overflow prevention mechanism involving integer arithmetic. `poison` is a physical address, `kbuf->memsz` is a size, so if `poison` is less than `kbuf->memsz` that indicates a poisoned page. It returns 0. Not a problem. And now the `locate_mem_hole_bottom_up` logic. Same deal: all integer arithmetic, no uninitialized memory concerns. So, in summary, this patch is solely focused on gracefully handling hardware-poisoned memory during kexec operations. It properly avoids those regions. This is a clean integration, and I see no risk. I'm completely satisfied that this change is safe from an uninitialized memory perspective. The analysis is complete; no uninitialized memory bugs were detected, and `NeedsKMSAN` is indeed `false`. |
| 30/3 | 2026/08/10 14:56 | tool | set-results |
0mArgs:{
"KMSANReasoning": "The patch introduces checks to avoid hardware-poisoned memory during kexec operations. It adds functions to find the first or last hardware-poisoned page in a given physical memory range and uses them in kexec segment sanity checking and memory hole allocation. The changes only involve physical address calculations and integer arithmetic. There are no new structures allocated, no data copied to user space, and no complex logic that could expose uninitialized memory. Therefore, KMSAN is not applicable to this patch.",
"NeedsKMSAN": false
}Results: {
"KMSANReasoning": "The patch introduces checks to avoid hardware-poisoned memory during kexec operations. It adds functions to find the first or last hardware-poisoned page in a given physical memory range and uses them in kexec segment sanity checking and memory hole allocation. The changes only involve physical address calculations and integer arithmetic. There are no new structures allocated, no data copied to user space, and no complex logic that could expose uninitialized memory. Therefore, KMSAN is not applicable to this patch.",
"NeedsKMSAN": false
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|