Commit Graph

178 Commits

Author SHA1 Message Date
Mikhail Zaslonko
6547d1ae4c zdump/ngdump: Add error messages and debug trace logs
Add debug trace logs for ngdump_read_meta_from_device().

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2025-07-29 18:23:49 +02:00
Mikhail Zaslonko
5d2c93bc7a zdump/dfi: Get online cpu count based on lowcore_ptr array
In case of missing dfi_cpu_info in the dump, obtain the number of online
cpus of the dumped system based on the number of present entries in the
lowcore_ptr array (if vmcoreinfo is available).

Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2025-05-05 17:20:37 +02:00
Mikhail Zaslonko
f1055a62e3 zdump: Remove unused structures and prototypes from dfi.h
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2025-05-05 17:20:37 +02:00
Mikhail Zaslonko
9f9dddddd4 zdump: Drop build_arch for s390 DASD dumps
The build_arch field in s390 DASD dump header has originally been used to
indicate whether the dump tool has been built on s390 or s390x system.
Since no other architectures but s390x are supported for Linux on z, do
not process build_arch attribute. Bail out if any build architecture other
than ARCH_64 has been detected in s390_ext or s390mv_ext DASD dump header.
Remove build architecture line from 'zgetdump -i' output:
  Build arch.........: s390x (64 bit)
The man file for zgetdump is updated accordingly.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2025-04-07 17:42:18 +02:00
Mikhail Zaslonko
f821a3c174 zdump: Drop support of 32-bit dump architecture
- Initialize dump and dump-tool architecture to DFI_ARCH_64 at the start
  of dfi_init() and dt_init() respectively.
- Bail out if any dump architecture other than ARCH_64 has been detected
  in s390_ext or s390mv_ext DASD dump header.
- Remove redundant dfi_arch_set() and dt_arch_set() functions.
- Get rid of l.arch local variables in dfi* and dt* source files and
  drop dfi_arch() function.
- Drop the usage of DFI_ARCH_32 and compeletely remove DFI_ARCH_UNKNOWN.
- Drop special register and lowcore processing functions used
  for DFI_ARCH_32.
- Drop df_s390_from_dfi_arch() and df_s390_to_dfi_arch() funcitons.
- Update the man file for zgetdump.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2025-04-07 17:42:18 +02:00
Mikhail Zaslonko
ee4cb78dc2 zdump: Drop non-extended multi-volume DASD dump support
Since DASD standalone dumper does not support non-extended s390
multi-volume dumps for years, drop zgetdump support of non-extended s390_mv
DASD dumps and dump-tools:
- Merge dfi_s390mv_ext and dt_s390mv_ext with related dfi_s390mv and
  dt_s390mv counterparts.
- Update DFI and DT vectors of supported dump formats and dump-tools
  removing dfi_s390mv and dt_s390mv entries and keeping dt_s390mv_ext and
  dfi_s390mv_ext ones for s390_mv extended dump and dump-tool accordingly.
- Remove dfi_s390mv.c and dt_s390mv.c sources and update the Makefile.
- Make dfi_s390mv_ext_init() and dfi_s390mv_info() static.
- Remove magic number relevant to non-extended s390_mv DASD dumper.
- Completely drop DASD dumper version 5 case in df_s390_dumper_read().

Note: Since non-extended s390 multi-volume dumps can reside on DASD
partitions only and cannot be produced via DFO interface, we can drop this
dump format entirely.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2025-04-07 17:42:18 +02:00
Mikhail Zaslonko
6f82c5792a zdump: Drop support of non-extended single volume DASD dumpers
Since DASD standalone dumper does not support non-extended s390 dump
format for years, drop zgetdump support of non-extended s390 single volume
DASD dump-tool:
- Merge dt_390sv_ext.c and dt_s390sv.c counterparts.
- Update DT vector of supported dump tools removing dt_s390sv entry and
  keeping dt_s390sv_ext entry for s390 single volume extended dump tool.
- Remove dt_s390sv.c source and update the Makefile accordingly.
- Remove magic constants relevant to non-extended s390 single volume DASD
  dumper.
- Drop s390 single volume DASD dumper version 5 in df_s390_dumper_read().

Note: We still need support of non-extended s390 dump format since such
output dump files can be produced by 'zgetdump -f s390' via dfo_s390. Thus,
both dfi_s390 and dfi_s390_ext DFI vector entries remain in order to
process s390 dumps files as well as s390_ext dumps on the DASD partition.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2025-04-07 17:42:18 +02:00
Mikhail Zaslonko
2c5d4073a7 zdump: Drop support of obsolete dumps and dumpers
Drop support of obsolete dump and dump-tool versions (single-volume DASD,
FBA and Tape) in order to simplify zgetdump logic:
- CCW dumpers written in assembler instructions as well as stage2 dumpers
  of size less than 0x3000 (STAGE2_DUMPER_SIZE_V1 or STAGE2_DUMPER_SIZE_V2)
  haven't been used for years. Remove its traces completely as a cleanup.
  Keep the last version (version 5) of non-extended DASD dumper as well as
  newer extended DASD dumpers.
- Rename STAGE2_DUMPER_SIZE_V3 and STAGE2_DUMPER_SIZE_ZLIB constants.
- Drop support of non-extended s390 dumps of version < 5. Dump files
  of s390 format version 5 can be still produced by zgetdump (dfo_s390).
- Drop excessive dump version checking in df_s390_cpu_info_add() and
  df_s390_hdr_add() considering that obsolete s390 dumps of version lower
  than 5 no longer supported.
- Use cpu_cnt field in s390 dump header instead of the s390 dump version to
  indicate no cpu info available (DFI_CPU_CONTENT_NONE) for dfo_s390.
- Make df_s390_dumper_read() return error code upon unknown dumper
  version/magic detection.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2025-04-07 17:42:18 +02:00
Mikhail Zaslonko
7bd159de1d zdump: Add support for eckd_mv dumper v2
Use STAGE2_DUMPER_SIZE_MV size for eckd_mv dumper v2
in df_s390_dumper_read() to verify the dump tool.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2025-01-28 17:25:19 +01:00
Mikhail Zaslonko
30dc1a5ddd zdump/dfi_vmdump: Consider vmdump requested memory ranges
At the moment the memory range of processed vmdump always corresponds to
the highest defined byte (q v storage) obtained from Address Space
Information Block ignoring memory ranges specified in CP vmdump command.
This might lead to the invalid dump size calculation upon conversion to
s390 format.
Use Requested Range Table from ASIZBK to identify actual memory ranges
being dumped. Consider the end of the highest memory range as a vmdump
upper limit (dump memory size). In case no range table entries present
fall back to the original method using 'storage_size_def_store' value.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-11-22 17:15:59 +01:00
Mikhail Zaslonko
e2ee24b3ac zdump/df_vmdump: Rename vmd_asibk_64_new structure to vmd_asizbk
Rename vmd_asibk_64_new structure to vmd_asizbk to be in sync with CP
notations:
https://www.vm.ibm.com/pubs/cp730/ASIBK.HTML
Add ASIZBK magic number constant and magic number verification step.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Acked-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-11-22 17:15:58 +01:00
Mikhail Zaslonko
f23c207622 zdump/df_vmdump: Fix the layout of vmd_asibk_64_new structure
The struct vmd_asibk_64_new representing Address Space Information Block
(ASZIBK) does not match the control block format form CP reference:
https://www.vm.ibm.com/pubs/cp730/ASIBK.HTML
Adjust the layout of vmd_asibk_64_new structure to be in sync with CP
control block format.
Introduce vmd_otble structure used for range table entries, reflecting
the related CP control block:
https://www.vm.ibm.com/pubs/cp730/OLTBLE.HTML

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-11-22 17:15:58 +01:00
Mikhail Zaslonko
649f1bc084 zdump/df_vmdump: Adjust comment lines for magic constants
Remove duplicate hex notation in comments.
Append EBCDIC string notation comment to the constant define line.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Acked-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-11-22 17:15:58 +01:00
Mikhail Zaslonko
03340afe88 zdump/dfi_vmdump: Add extra trace logs for vmdump processing
Add extra trace logs for vmdump processing.
Log number of Index Pages, Bit-Key Pages and actual stored pages in the
vmdump.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2024-10-25 11:57:44 +02:00
Mikhail Zaslonko
b7ac46b98b zdump/dfi_vmdump: Fix Index Page processing for vmdump DFI
According to vmdump format, each bit of the Index page represents a Bit-Key
page and indicates if that Bit-Key page exists.
Due to the bug in vmdump64big_init() only 4096 bits of the Index Page were
processed instead of 32768. Thus for vmdumps of guests with defined storage
above 64G we could have invalid memory_start_record calculated. This ruins
the VMDUMP mem chunk read callback function.
One of the problem symptoms reported was missing UTS data in
'zgetdump -i' output caused by inability to locate OS_INFO in the dump.

Fixes: 067dd5c7ef ("zdump: Add vmdump dfi for vmdump format to elf format")
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2024-10-25 11:57:18 +02:00
Mikhail Zaslonko
279070fa43 zdump/ngdump: Fix seek error on 'zgetdump -d'
When checking CDL formatted DASD for installed dump-tool (zgetdump -d),
we might stumble upon an 'empty' boot record pointer in the volume label
filled with bytes of 0x40 (EBCDIC spaces). This leads to the following
seek error reported:

  # zgetdump -d /dev/dasdb
  zgetdump: Could not seek "/dev/dasdb" (Invalid argument)

Check for empty boot record and return proper error code by
ngdump_get_eckd_part_num() in order to end up with a regular
"No dump tool found" message.

Fixes: f3bcd94524 ("zdump: Add zgetdump -d support for ECKD ldipl-dump")
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2024-10-01 12:16:19 +02:00
Mikhail Zaslonko
d8f504f271 zdump/dfi: Fix vm_info_get() check for non-VR kernel
Since the following kernel commit:
"32db401965f1 s390/mm: Pin identity mapping base to zero"
we can have zero identity_base value in os_info. This makes zgetdump
check for non-VR kernel in vm_info_get() incorrect what leads to missing
data (e.g. UTS kernel version) in 'zgetdump -i' output.
Check for zero kaslr_offset value instead (like crash and makedumpfile
do) in order to identify non-VR kernel.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2024-10-01 12:16:19 +02:00
Mikhail Zaslonko
a95bad6c87 zdump/dfo_s390: Support s390 DFO for vr-kernel dumps
Since memory chunks can overlap for vr-kernel dumps stored in elf
format (ngdump, zfcpdump), we need to consider this when converting to
s390 dump output format. For that sort DFI memory chunks by start
address and adjust dfo_s390 logic for identifying memory gaps.
Otherwise we might end up with bogus DFO memory chunks being created.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2024-09-13 19:15:01 +02:00
Mikhail Zaslonko
4b19b9d950 zdump/dfi_s390: Get rid of device type check for s390_ext dump
Simplify ioctl error processing logic for "BLKSSZGET" operation.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2024-08-01 14:26:06 +02:00
Mikhail Zaslonko
6d15850480 zdump: Use os_info data to convert dump vaddr to paddr
For vr-kernel dumps use the offsets stored in os_info entries for
virt to phys address conversion when dump virtual address is to be
read, (e.g. vmcoreinfo symbols) using similar method as implemented
in crash-utility.
It is mainly required for reading "init_uts_ns" symbol and, in case
of crashed kdump, "lowcore_ptr" symbol along with a pointers to the
lowcore of every CPU.

Acked-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-06-24 16:23:24 +02:00
Mikhail Zaslonko
858da9af57 zdump: Use os_info.h from include/boot
Get rid of duplicate os_info definitions in dfi_vmcoreinfo.c

Acked-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-06-24 16:23:24 +02:00
Mikhail Zaslonko
613353cd33 zdump/dfi_elf: Support core dumps of vr-kernels
Support vmcore based dumps (ngdump, zfcpdump) with uncoupled physical and
virtual addresses. For that we just remove p_paddr != p_vaddr sanity check
for elf load headers.

Acked-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-06-24 16:23:24 +02:00
Mikhail Zaslonko
6c4171b775 zdump/dfi_s390: Adjust device type check for s390_ext dump
In order to allow loop devices usage for DASD dump emulation in fvt-tests,
do not bail out on ZG_TYPE_DASD device type returned by zg_type() for
s390_ext dump.

Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-06-24 16:23:24 +02:00
Mikhail Zaslonko
c7fd515790 zdump: Fix 'zgetdump -i' ioctl error on s390 formatted dump file
When dump is copied to the filesystem in s390 format, follow on
'zgetdump -i' can fail with ioctl error:

  # zgetdump /dev/dasdb1 -f s390 dump.s390
  Format Info:
      Source: s390_ext
      Target: s390

  Copying dump:
      00000001 / 00008192 MB
      00003688 / 00008192 MB
      00006646 / 00008192 MB
      00008192 / 00008192 MB
  Success: Dump has been copied

  # zgetdump -iVVVV dump.s390

  zgetdump: Operation "BLKSSZGET" failed on "dump.s390" (Inappropriate ioctl for device)

Call ioctl(BLKSSZGET) only for s390_ext dump format (dump can be
stored on DASD partition only, not on the filesystem). For s390 format
a blocksize is not required for dump processing since s390 dump data is
not compressed.

Fixes: 271b809495 ("zdump/dfi_s390: Support reading compressed s390_ext dumps")
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-06-24 16:23:24 +02:00
Steffen Eiden
c261db259b zdump: Use constant for CCK size
This will reduce code dependency to otherwise unused code in libpv.
This code will be removed with the next patch.

Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-05-27 16:54:10 +02:00
Mikhail Zaslonko
47b0960cc7 zdump: Make ngdump_get_part_path() public
Make ngdump_get_part_path() public in order for unit-tests to access it.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-03-15 15:11:34 +01:00
Mikhail Zaslonko
23e9156f43 s390_dump.h: Add DF_S390_DUMPER_MAGIC_SIZE constant
Add DF_S390_DUMPER_MAGIC_SIZE constant to s390_dump.h.
Use it instead of hardcoded length when processing dumper magics
in zgetdump code.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Acked-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-03-15 15:11:34 +01:00
Mikhail Zaslonko
8f99e7c4ea zdump: Move DUMPER_MAGIC constants to include/dump/s390_dump.h
Move DUMPER_MAGIC constants from df_s390.h to the global header
include/dump/s390_dump.h in order to reuse it in zipl code.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-03-15 15:11:34 +01:00
Mikhail Zaslonko
f3bcd94524 zdump: Add zgetdump -d support for ECKD ldipl-dump
Make 'zgetdump -d' to identify ldipl-dump tool (ngdump) installed on DASD
volume just like it does for NVMe ngdump.

Output sample:
-------------
Dump device info:
  Dump tool.........: Next Generation (NGDump) dump tool
  Version...........: 1
  Architecture......: s390x (64 bit)

Partition info:
  Partition number..: 2

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2024-03-15 15:11:34 +01:00
Mikhail Zaslonko
0e4d4da0e5 zdump: Update zgetdump man page
Update zgetdump man page with the information of compressed DASD dumps
support as well as new verbose 'zgetdump -i' output entries.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-09-27 18:29:07 +02:00
Mikhail Zaslonko
ca3cd51f91 zdump/dt_s390: Support new dumper version by 'zgetdump -d'
Add new dumper version support to 'zgetdump -d' command.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-09-27 18:29:06 +02:00
Mikhail Zaslonko
fda1e0d33d zdump: Move and rename DF_S390_DUMPER_SIZE constants
Move DF_S390_DUMPER_SIZE_* constants from zdump/df_s390.h to
boot/loaders_layout.h since ccw dumper size depends on the zipl boot
loader layout (to keep it all in one place).

Rename DF_S390_DUMPER_SIZE_* constants to STAGE2_DUMPER_SIZE_*

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-09-27 18:29:06 +02:00
Mikhail Zaslonko
1a850392bc zdump/df_s390: Update 'zgetdump -i' output with zlib info
Update verbose 'zgetdump -i' output with zlib info (internal zlib version
and zlib compression unit size).

The following new entriees are to be dispalyed:
	Zlib version.......: 1
	Zlib compression unit: 1 MB

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-09-27 18:29:06 +02:00
Mikhail Zaslonko
14a79eb142 zdump: Increase output buffer from 8 pages to 1 Mb
Increase the auxiliary buffer size from 8 pages to 1 megabyte in order to
significantly increase compressed dump processing speed.
For uncompressed dumps, the effect is minor.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-09-27 18:29:06 +02:00
Mikhail Zaslonko
271b809495 zdump/dfi_s390: Support reading compressed s390_ext dumps
Update dfi_s390.c to support reading of compressed dump segments.
For this, introduce a callback function for reading memory chunks
associated with compressed dump segments. Apart from the segment location
on disk this function requires the entry_offset array from the dump segment
header in order to process each compressed entry separately, thus allowing
fast seek processing for zgetdump (no need to decompress a big dump segment
to extract a single piece of data).

In addition, split mem_chunks_add_ext() in several functions.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-09-27 18:29:06 +02:00
Mikhail Zaslonko
7b68552359 zdump: Use global header s390_dump.h
Instead of using its own DF_S390_ constants and df_s390_ structs
in df_s390.h, include those from "dump/s390_dump.h" in order to minimize
duplicates. Adjust the code, where required, to use <stdint> types
instead of those defined in zt_common.h (e.g. use uint64_t instead of u64).

Adjust zdump include statements.

Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Reviewed-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2023-09-27 18:29:06 +02:00
Marc Hartmayer
de88b1c71b common.mak: introduce PKG_CONFIG
Introduce `PKG_CONFIG` Makefile variable. This helps for
cross-compilation.

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:31:51 +02:00
Marc Hartmayer
4bba1058c6 Declare pkg-config as required
`pkg-config` is a well established tool and all of our required
libraries do provide .pc files. Therefore let's declare `pkg-config` as
required and use it. In addition, remove now useless code.

Reviewed-by: Benjamin Block <bblock@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-05-30 13:31:20 +02:00
Thomas Richter
b8fff9b750 libvmdump: Remove libvmdump and vmconvert
The library libvmdump is written in C++ and uses exception handling
and class inheritance. The tools vmur and vmconnect are compiled using
the C++ compiler for linking with the libvmdump library.

With integration of vmdump file support into the zgetdump tool and
the removal of vmur vmdump file conversion support there is no need
anymore the vmconvert tool.
With removal of the tool vmconvert, the libvmdump library written in C++
has no more user and can be deleted.

Remove the vmconvert command from the zgetdump man page.

Remove the directories libvmdump and vmconvert and adjust the Makefile.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Suggested-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-01-27 14:12:38 +01:00
Thomas Richter
067dd5c7ef zdump: Add vmdump dfi for vmdump format to elf format
Add support for vmdump 64big format to the zgetdump utility.
The result is an elf file suitable for tool crash.
This patch adds file dfi_vmdump.c to handle conversion from
z/VM vmdump format to the internal memory representation of this tool.
Therefore both output formats elf and s390 are supported as target
of the conversion.

The vmdump file formats 32bit and 64bit are not supported anymore.
They have been obsolete since CP version 5.1 (end of service since
30-Sep-2009).

Vector register set is not part of a vmdump file and can not be
displayed.

Output before:
 # zgetdump ~/vmdump-0383
 zgetdump: No valid dump found on "/root/vmdump-0383"
 #

Output after:
 # ./zgetdump ~/vmdump-0383 ~/vmdump-0383.elf
 Format Info:
  Source: vmdump
  Target: elf

 Copying dump:
  00000000 / 00000379 MB
  00000379 / 00000379 MB

 Success: Dump has been copied
 # file ~/vmdump-0383.elf
 /root/vmdump-0383.elf: ELF 64-bit MSB core file, IBM S/390, version 1 \
	 .... (SYSV), SVR4-style, from 'vmlinux'
 #

 # ./zgetdump -i ~/vmdump-0383
 General dump info:
  Dump format........: vmdump
  Version............: 2
  UTS node name......: s8360046.lnxne.boe
  UTS kernel release.: 6.1.0-rc2-d-perf+
  UTS kernel version.: #1 SMP Fri Oct 28 09:42:13 CEST 2022
  System arch........: s390x (64 bit)
  CPU count (online).: 2
  CPU count (real)...: 2
  Dump memory range..: 2048 MB

 Memory map:
  0000000000000000 - 000000007fffffff (2048 MB)
 #

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Reviewed-by: Mikhail Zaslonko <zaslonko@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2023-01-27 14:12:38 +01:00
Marc Hartmayer
7babd82e6f zgetdump/Makefile: don't use .check_dep_zgetdump as linker input
The `.check_dep_zgetdump` file is used to cache the result of the
dependency checks and should not be used as input for linking or
anything else. Let's add it as dependency for the objects file. This
shouldn't cause any problems since the Makefile rule for object files is
defined in `common.mak` as follows:

%.o: %.c
	$(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@

Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/147
Fixes: 8d8d5e9746 ("zdump: Fix Makefile dependencies")
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>
2022-12-20 08:17:20 +01:00
Steffen Eiden
d030874050 libpv: disallow glib features from after 2.56
Enforce that the first glib.h include is done via glib-helper.h for libpv
so that glib version checks are in place.

Change zdump and pvattest such that they never include glibstuff before
libpv/glib-helper.h

Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2022-12-15 11:33:46 +01:00
Steffen Eiden
394a6dd5ea zdump: replace atomic refcount with atomic int
(Atomic) refcounting was introduced in glib2.58.
We want to support v2.56 as well, so replace it with int and the atomic
operations introduced in glib 2.4.

Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/146
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
2022-12-15 11:26:11 +01:00
Marc Hartmayer
8d8d5e9746 zdump: Fix Makefile dependencies
The Makefile target `check_dep_fuse` was declared as .PHONY and
therefore it was always rebuilt. This caused zgetdump to always be
relinked. While at it, remove the non-existent Makefile target
`check_dep_zlib` and add the cache files to `.gitignore`.

Closes: https://github.com/ibm-s390-linux/s390-tools/issues/144
Fixes: e537ab902e ("zdump: Makefile: add basic libpv support")
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-11-29 17:03:57 +01:00
Marc Hartmayer
8a1db94d37 zdump: add missing newlines for log messages
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-11-29 17:03:57 +01:00
Marc Hartmayer
1911cba130 zdump: check provided sizes for reasonableness
Check the dump provided sizes for reasonableness. This avoids that a
corrupted dump leads to allocation of large buffers on the heap.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-11-29 17:03:57 +01:00
Marc Hartmayer
f4ed0b0ec6 zdump: check size before mmap'ing
Verify that the size is large enough before doing the mmap. Otherwise
this can result in a SIGBUS signal if there is an attempt to access a
page that lies beyond the end of the mapped file (see `man 2 mmap`).

Fixes: 8fa1b5a00b ("zdump: dfi: add support to read Protected Virtualization dumps")
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-11-29 17:03:57 +01:00
Marc Hartmayer
6e42c527d7 zdump: pv_process_pglist: convert assertions into errors
Corrupted dumps might have invalid page states. Therefore, let's convert
the assertions into errors.

Fixes: 8fa1b5a00b ("zdump: dfi: add support to read Protected Virtualization dumps")
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-11-29 17:03:57 +01:00
Eduard Shishkin
cf5f373142 zipl: Rename component_type enum
Rename component_type enum from COMPONENT_* to COMPONENT_TYPE_*

Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-11-29 17:03:57 +01:00
Marc Hartmayer
8fa1b5a00b zdump: dfi: add support to read Protected Virtualization dumps
Sometimes dumping a virtual machine from the outside is the only way to
get the data that is needed. This can be the case if a dumping mechanism
like kdump hasn't been configured or data needs to be fetched at a
specific point. Dumping a protected guest from the outside without help
from FW/HW doesn't yield sufficient data to be useful. Hence we have
introduced Protected Virtualization (PV) dump support - also named
confidential dump support.

The confidential dump support works by integrating the firmware into the
dump process. New Ultravisor calls (UVC) are used to initiate the dump
process, dump CPU data, dump memory state and lastly complete the dump
process. The guest's data is fully encrypted and can only be decrypted
by the entity that owns the customer communication key (CCK) for the
dumped guest. The output format is very similar the normal s390 vmcore
ELF format, it's only enriched by new sections where the returned data
from the UVC "Complete Configuration Dump" and the UVC "Dump
Configuration Storage State" is stored. The encrypted CPU data is stored
in a new note type `NT_S390_PV_CPU_DATA`. The old note types do still
exists but without any confidential data stored. The memory data is
stored in the LOAD segment as usual but for PV dumps it's fully AES-XTS
encrypted.

This commit adds support for reading/decrypting PV guest dumps to
zgetdump by introducing a new DFI input module (`dfi_pv_elf.c`). For
specifying the customer communication key a new command line option
`--key` is added.

Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2022-11-03 17:45:38 +01:00