crash/0017-vmware-Improve-output-when-we-fail-to-read-vmware-vm.patch
Lianbo Jiang d2b8160311 Fix for irq/tree issues
Upstream commits:
b76e116c50ff ("vmware: Improve output when we fail to read vmware 'vmsn' file")
d17d51a92a3a ("Exclude zero entries from do_maple_tree() return value")
38d35bd1423c ("Fix "irq [-a|-s]" options on Linux 6.5-rc1 and later")
f0b59524624b ("Fix segmentation fault by "tree -s" option with Maple Tree")

Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
2023-07-13 10:06:48 +08:00

134 lines
5.0 KiB
Diff

From b76e116c50ffc228ebc08eb8de35019320679257 Mon Sep 17 00:00:00 2001
From: Dave Wysochanski <dwysocha@redhat.com>
Date: Thu, 6 Jul 2023 10:53:18 -0400
Subject: [PATCH 1/4] vmware: Improve output when we fail to read vmware 'vmsn'
file
Today if crash fails to read some structure in a vmware 'vmsn' file,
it will throw an "No such file or directory" message. Such a generic
message does not give any clue as to the problem, but instead sounds
like the file may not exist when it does, for example:
$ crash ./vmcore.vmsn ./vmlinux
crash 8.0.3
...
crash: vmw: Failed to read './vmcore.vmsn': [Error 2] No such file or directory
crash: ./vmcore.vmsn: initialization failed
$ ls -l ./vmcore.vmsn
-rwxrwxrwx. 7 myuser mygroup 12128999 Jul 4 07:21 ./vmcore.vmsn
Improve the above error message so we at least know which portion
of the file crash had difficulty reading. After this patch, the
above error looks like:
crash: vmw: Failed to read 'cptgroupdesc' from file './vmcore.vmsn': [Error 2] No such file or directory
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
---
vmware_guestdump.c | 8 ++++----
vmware_vmss.c | 24 ++++++++++++------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/vmware_guestdump.c b/vmware_guestdump.c
index cf818e588a60..5be26c8e2e90 100644
--- a/vmware_guestdump.c
+++ b/vmware_guestdump.c
@@ -117,8 +117,8 @@ is_vmware_guestdump(char *filename)
}
if (fread(&hdr, sizeof(struct guestdumpheader), 1, fp) != 1) {
- error(INFO, LOGPRX"Failed to read '%s': [Error %d] %s\n",
- filename, errno, strerror(errno));
+ error(INFO, LOGPRX"Failed to read '%s' from file '%s': [Error %d] %s\n",
+ "guestdumpheader", filename, errno, strerror(errno));
fclose(fp);
return FALSE;
}
@@ -204,8 +204,8 @@ vmware_guestdump_init(char *filename, FILE *ofp)
for (i = 0; i < vmss.num_vcpus; i++) {
if (fread(&vs, sizeof(struct vcpu_state), 1, fp) != 1) {
- error(INFO, LOGPRX"Failed to read '%s': [Error %d] %s\n",
- filename, errno, strerror(errno));
+ error(INFO, LOGPRX"Failed to read '%s' from file '%s': [Error %d] %s\n",
+ "vcpu_state", filename, errno, strerror(errno));
result = FALSE;
goto exit;
}
diff --git a/vmware_vmss.c b/vmware_vmss.c
index f6c5f32ea4c0..8121ab64a99a 100644
--- a/vmware_vmss.c
+++ b/vmware_vmss.c
@@ -39,8 +39,8 @@ is_vmware_vmss(char *filename)
}
if (fread(&hdr, sizeof(cptdumpheader), 1, fp) != 1) {
- error(INFO, LOGPRX"Failed to read '%s': [Error %d] %s\n",
- filename, errno, strerror(errno));
+ error(INFO, LOGPRX"Failed to read '%s' from file '%s': [Error %d] %s\n",
+ "cptdumpheader", filename, errno, strerror(errno));
fclose(fp);
return FALSE;
}
@@ -86,8 +86,8 @@ vmware_vmss_init(char *filename, FILE *ofp)
}
if (fread(&hdr, sizeof(cptdumpheader), 1, fp) != 1) {
- error(INFO, LOGPRX"Failed to read '%s': %s [Error %d] %s\n",
- filename, errno, strerror(errno));
+ error(INFO, LOGPRX"Failed to read '%s' from file '%s': [Error %d] %s\n",
+ "cptdumpheader", filename, errno, strerror(errno));
result = FALSE;
goto exit;
}
@@ -112,8 +112,8 @@ vmware_vmss_init(char *filename, FILE *ofp)
}
if (fread(grps, sizeof(cptgroupdesc), grpsize, fp) != grpsize) {
- error(INFO, LOGPRX"Failed to read '%s': [Error %d] %s\n",
- filename, errno, strerror(errno));
+ error(INFO, LOGPRX"Failed to read '%s' from file '%s': [Error %d] %s\n",
+ "cptgroupdesc", filename, errno, strerror(errno));
result = FALSE;
goto exit;
}
@@ -225,8 +225,8 @@ vmware_vmss_init(char *filename, FILE *ofp)
idx[0] < vmss.num_vcpus) {
int cpu = idx[0];
if (fread(vmss.regs64[cpu], VMW_GPREGS_SIZE, 1, fp) != 1) {
- error(INFO, LOGPRX"Failed to read '%s': [Error %d] %s\n",
- filename, errno, strerror(errno));
+ error(INFO, LOGPRX"Failed to read '%s' from file '%s': [Error %d] %s\n",
+ name, filename, errno, strerror(errno));
break;
}
DEBUG_PARSE_PRINT((ofp, "\n"));
@@ -237,8 +237,8 @@ vmware_vmss_init(char *filename, FILE *ofp)
int cpu = idx[0];
DEBUG_PARSE_PRINT((ofp, "\t=> "));
if (fread(&vmss.regs64[cpu]->cr[0], VMW_CR64_SIZE, 1, fp) != 1) {
- error(INFO, LOGPRX"Failed to read '%s': [Error %d] %s\n",
- filename, errno, strerror(errno));
+ error(INFO, LOGPRX"Failed to read '%s' from file '%s': [Error %d] %s\n",
+ name, filename, errno, strerror(errno));
break;
}
for (j = 0; j < VMW_CR64_SIZE / 8; j++)
@@ -257,8 +257,8 @@ vmware_vmss_init(char *filename, FILE *ofp)
break;
}
if (fread(&idtr, sizeof(idtr), 1, fp) != 1) {
- error(INFO, LOGPRX"Failed to read '%s': [Error %d] %s\n",
- filename, errno, strerror(errno));
+ error(INFO, LOGPRX"Failed to read '%s' from file '%s': [Error %d] %s\n",
+ name, filename, errno, strerror(errno));
break;
}
DEBUG_PARSE_PRINT((ofp, "\n"));
--
2.37.1