From 1be446cb5fbc442103dbb54279f3cc3a61b4c0ff Mon Sep 17 00:00:00 2001 From: Kazuhito Hagio Date: Wed, 20 Jan 2021 15:16:24 +0900 Subject: [PATCH 09/13] Fix "sys [-t]|mod -S" after "mod -t" when crash runs with -s option 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 whether 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 Signed-off-by: Lianbo Jiang --- 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.17.1