Skip to content

Commit

Permalink
libdrgn: accept flattened KDUMP format
Browse files Browse the repository at this point in the history
Support for the flattened KDUMP format was added in libkdumpfile-0.5.3.

Signed-off-by: Petr Tesarik <petr@tesarici.cz>
  • Loading branch information
ptesarik committed Nov 6, 2023
1 parent c18a1a9 commit 98d0690
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions libdrgn/program.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,9 @@ static struct drgn_error *has_kdump_signature(const char *path, int fd,
ssize_t r = pread_all(fd, signature, sizeof(signature), 0);
if (r < 0)
return drgn_error_create_os("pread", errno, path);
if (r >= FLATTENED_SIG_LEN
&& memcmp(signature, FLATTENED_SIGNATURE, FLATTENED_SIG_LEN) == 0) {
return drgn_error_create(DRGN_ERROR_INVALID_ARGUMENT,
"the given file is in the makedumpfile flattened "
"format, which drgn does not support; use "
"'makedumpfile -R newfile <oldfile' to reassemble "
"the file into a format drgn can read");
}
*ret = (r >= KDUMP_SIG_LEN
*ret = (r >= FLATTENED_SIG_LEN
&& memcmp(signature, FLATTENED_SIGNATURE, FLATTENED_SIG_LEN) == 0) ||
(r >= KDUMP_SIG_LEN
&& memcmp(signature, KDUMP_SIGNATURE, KDUMP_SIG_LEN) == 0);
return NULL;
}
Expand Down

0 comments on commit 98d0690

Please sign in to comment.