From daf7f43135a13b3a82b2e3b497d56530b43ca985 Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Sun, 29 Jan 2023 13:11:30 +0100 Subject: [PATCH] LibELF: Add EM_AARCH64 as expected architecture for ELF validation --- Userland/Libraries/LibELF/Validation.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Userland/Libraries/LibELF/Validation.cpp b/Userland/Libraries/LibELF/Validation.cpp index be76b0b3dfa..c577e016292 100644 --- a/Userland/Libraries/LibELF/Validation.cpp +++ b/Userland/Libraries/LibELF/Validation.cpp @@ -59,12 +59,12 @@ bool validate_elf_header(ElfW(Ehdr) const& elf_header, size_t file_size, bool ve return false; } - auto expected_machine = EM_X86_64; - auto expected_machine_name = "x86-64"; + auto expected_machines = Array { EM_X86_64, EM_AARCH64 }; + auto expected_machine_names = Array { "x86-64"sv, "aarch64"sv }; - if (expected_machine != elf_header.e_machine) { + if (!expected_machines.span().contains_slow(elf_header.e_machine)) { if (verbose) - dbgln("File has unknown machine ({}), expected {} ({})!", elf_header.e_machine, expected_machine_name, expected_machine); + dbgln("File has unknown machine ({}), expected {} ({})!", elf_header.e_machine, expected_machine_names.span(), expected_machines.span()); return false; }