From c3c82401f1ca742355f6d614ac731ead72a80852 Mon Sep 17 00:00:00 2001 From: kettenis Date: Sun, 11 Sep 2022 10:40:35 +0000 Subject: [PATCH] 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@ --- usr.sbin/acpidump/acpidump.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.sbin/acpidump/acpidump.c b/usr.sbin/acpidump/acpidump.c index e08a6edada9..8171b8f9bed 100644 --- a/usr.sbin/acpidump/acpidump.c +++ b/usr.sbin/acpidump/acpidump.c @@ -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 * 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; -- 2.20.1