[RFC PATCH 11/15] Fix module_symbol() and is_kernel_text()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Kazuhito Hagio <k-hagio-ab@xxxxxxx>
---
 symbols.c | 41 ++++++++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 13 deletions(-)

diff --git a/symbols.c b/symbols.c
index 62092ba7d723..ba9cf607f256 100644
--- a/symbols.c
+++ b/symbols.c
@@ -3533,8 +3533,11 @@ is_kernel_text(ulong value)
 				if (!(lm->mod_section_data[s].flags & SEC_CODE))
 					continue;
 	
-				start = lm->mod_base + 
-					lm->mod_section_data[s].offset;
+				if (MODULE_MEMORY())
+					start = lm->mod_section_data[s].addr;
+				else
+					start = lm->mod_base + lm->mod_section_data[s].offset;
+
 				end = start + lm->mod_section_data[s].size;
 	
 	        		if ((value >= start) && (value < end)) 
@@ -5405,17 +5408,29 @@ module_symbol(ulong value,
 	for (i = 0; i < st->mods_installed; i++) {
 		lm = &st->load_modules[i];
 
-		if (IN_MODULE(value, lm)) {
-			base = lm->mod_base;
-			end = lm->mod_base + lm->mod_size;
-		} else if (IN_MODULE_INIT(value, lm)) {
-			base = lm->mod_init_module_ptr;
-			end = lm->mod_init_module_ptr + lm->mod_init_size;
-		} else if (IN_MODULE_PERCPU(value, lm)) {
-			base = lm->mod_percpu;
-			end = lm->mod_percpu + lm->mod_percpu_size;
-		} else
-			continue;
+		if (MODULE_MEMORY()) {
+			if (IN_MODULE(value, lm) || IN_MODULE_INIT(value, lm)) {
+				int type = module_mem_type(value, lm);
+				base = lm->mem[type].base;
+				end = base + lm->mem[type].size;
+			} else if (IN_MODULE_PERCPU(value, lm)) {
+				base = lm->mod_percpu;
+				end = lm->mod_percpu + lm->mod_percpu_size;
+			} else
+				continue;
+		} else {
+			if (IN_MODULE(value, lm)) {
+				base = lm->mod_base;
+				end = lm->mod_base + lm->mod_size;
+			} else if (IN_MODULE_INIT(value, lm)) {
+				base = lm->mod_init_module_ptr;
+				end = lm->mod_init_module_ptr + lm->mod_init_size;
+			} else if (IN_MODULE_PERCPU(value, lm)) {
+				base = lm->mod_percpu;
+				end = lm->mod_percpu + lm->mod_percpu_size;
+			} else
+				continue;
+		}
 
 		if ((value >= base) && (value < end)) {
 			if (lmp) 
-- 
2.31.1

--
Crash-utility mailing list
Crash-utility@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/crash-utility
Contribution Guidelines: https://github.com/crash-utility/crash/wiki




[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux