[Crash-utility] [PATCH] Fix "sys [-t]|mod -S" after "mod -t" when crash runs with -s option

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Wed Jan 20 06:16:24 UTC 2021


When crash runs with -s option, SIZE(taint_flag) and OFFSET(tnt_false)
are not set during initialization.  If the "mod -t" option is executed,
it sets the former but does not set the latter.  After that, the "sys"
command uses OFFSET(tnt_false) without setting it, because it checks
only if SIZE(taint_flag) is set.

Without the patch, the "sys [-t]" and "mod -S" options after "mod -t"
option fail with the error message:

  sys: invalid structure member offset: tnt_false
       FILE: kernel.c  LINE: 11203  FUNCTION: show_kernel_taints_v4_10()

Signed-off-by: Kazuhito Hagio <k-hagio-ab at nec.com>
---
 kernel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel.c b/kernel.c
index 272e0d8751cf..5fcd86575be5 100644
--- a/kernel.c
+++ b/kernel.c
@@ -11160,7 +11160,8 @@ show_kernel_taints_v4_10(char *buf, int verbose)
 	ulong tainted_mask, *tainted_mask_ptr;
 	struct syment *sp;
 
-	if (!VALID_STRUCT(taint_flag)) {
+	if (!(VALID_STRUCT(taint_flag) &&
+	     VALID_MEMBER(tnt_true) && VALID_MEMBER(tnt_false))) {
 		STRUCT_SIZE_INIT(taint_flag, "taint_flag");
 		MEMBER_OFFSET_INIT(tnt_true, "taint_flag", "true");
 		MEMBER_OFFSET_INIT(tnt_false, "taint_flag", "false");
-- 
2.18.4





More information about the Crash-utility mailing list