[Crash-utility] [PATCH 1/1] Calculate offset to field 'init_uts_ns.name'

Alexander Egorenkov egorenar at linux.ibm.com
Wed Sep 16 08:12:22 UTC 2020


The offset has changed in linux-next (v5.9.0) from 4 to 0 because
there is no more 'kref' member variable at the beginning of 'init_uts_ns'.
The change was introduced with commit 9a56493f6942c0e2df1579986128721da96e00d8.
To handle both cases correctly, calculate the offset at run time instead.

Signed-off-by: Alexander Egorenkov <egorenar at linux.ibm.com>
---
 kernel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel.c b/kernel.c
index 21bd1eb..13942b9 100644
--- a/kernel.c
+++ b/kernel.c
@@ -237,7 +237,7 @@ kernel_init()
                 	sizeof(struct new_utsname), "system_utsname", 
 			RETURN_ON_ERROR);
 	else if (symbol_exists("init_uts_ns"))
-		readmem(symbol_value("init_uts_ns") + sizeof(int),
+		readmem(symbol_value("init_uts_ns") + ANON_MEMBER_OFFSET("uts_namespace","name"),
 			KVADDR,  &kt->utsname, sizeof(struct new_utsname), 
 			"init_uts_ns", RETURN_ON_ERROR);
 	else
-- 
2.26.2




More information about the Crash-utility mailing list