Hi, Kazu
在 2021年01月21日 01:00, crash-utility-request(a)redhat.com 写道:
Date: Wed, 20 Jan 2021 06:16:24 +0000
From: HAGIO KAZUHITO(?????) <k-hagio-ab(a)nec.com>
To: "crash-utility(a)redhat.com" <crash-utility(a)redhat.com>
Subject: [Crash-utility] [PATCH] Fix "sys [-t]|mod -S" after "mod
-t"
when crash runs with -s option
Message-ID:
<OSBPR01MB199187BDE9E90C416DF2B327DDA20(a)OSBPR01MB1991.jpnprd01.prod.outlook.com>
Content-Type: text/plain; charset="iso-2022-jp"
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:
Hmm, I also ran into a similar issue with an old vmcore, that can be reproduced
with the following steps:
crash> history
[1] mod -S 3.10.0-957.el7.x86_64
[2] mod -s dm_service_time
[3] set scope st_create
[4] mod -d dm_service_time
[5] mod -sr dm_service_time
[6] set scope st_create
[7] sys
[8] set scope st_create
And after the step[7] "sys" command, the step[8] will definitely fail. But
step[6]
is successful before the "sys" command.
Seems that it should be another issue.
Thanks.
Lianbo
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(a)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