When looking up a symble using kvm_nlist(3), we need to prepend an

underscore.  This fixes acpidump on arm64.  How this ever worked before
is unclear, but part of the puzzle is that we didn't properly check the
return value of the kvm_nlist(3) calls.  So fix that too.

ok deraadt@, mglocker@
This commit is contained in:
kettenis 2022-09-11 10:40:35 +00:00
parent 9cfac7781e
commit c3c82401f1
1 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $OpenBSD: acpidump.c,v 1.24 2021/07/12 15:09:20 beck Exp $ */
/* $OpenBSD: acpidump.c,v 1.25 2022/09/11 10:40:35 kettenis Exp $ */
/*
* Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
* All rights reserved.
@ -714,8 +714,8 @@ efi_acpi_addr(void)
kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, NULL);
if (kd == NULL)
goto on_error;
nl[0].n_name = "efi_acpi_table";
if (kvm_nlist(kd, nl) == -1)
nl[0].n_name = "_efi_acpi_table";
if (kvm_nlist(kd, nl) != 0)
goto on_error;
if (kvm_read(kd, nl[0].n_value, &table, sizeof(table)) == -1)
goto on_error;
@ -746,7 +746,7 @@ efi_acpi_addr(void)
if (kd == NULL)
goto on_error;
nl[0].n_name = "_bios_efiinfo";
if (kvm_nlist(kd, nl) == -1)
if (kvm_nlist(kd, nl) != 0)
goto on_error;
if (kvm_read(kd, nl[0].n_value, &ptr, sizeof(ptr)) == -1)
goto on_error;