From d76e1ae7e0526eefc88596355aa2816782d09e51 Mon Sep 17 00:00:00 2001 From: hmtheboy154 Date: Sun, 8 Oct 2023 04:22:53 -0400 Subject: [PATCH] Revert "Android: fix building errors" Disable debugging will cause crash with a FORTIFY failure: Abort message: 'FORTIFY: fprintf: null FILE*' rax 0000000000000000 rbx 0000000000000d14 rcx 00007c3d0749069f rdx 0000000000000006 r8 0000000000000000 r9 0000000000000000 r10 00007ffdefe13030 r11 0000000000000217 r12 0000000000000000 r13 0000000000000000 r14 00007ffdefe13028 r15 0000000000000d14 rdi 0000000000000d14 rsi 0000000000000d14 rbp 000000000000009d rsp 00007ffdefe13020 rip 00007c3d0749069f backtrace: #00 pc 000000000005f69f /apex/com.android.runtime/lib64/bionic/libc.so (abort+191) (BuildId: cbf2c6babf4ce509f78a7963e811ace3) #01 pc 00000000000612f0 /apex/com.android.runtime/lib64/bionic/libc.so (__fortify_fatal(char const*, ...)+160) (BuildId: cbf2c6babf4ce509f78a7963e811ace3) #02 pc 00000000000c5d9a /apex/com.android.runtime/lib64/bionic/libc.so (fprintf+282) (BuildId: cbf2c6babf4ce509f78a7963e811ace3) #03 pc 000000000002bc72 /system/bin/efibootmgr (log_+178) (BuildId: 0e8d9a0cd8994623ec86c1005c9d5e8b) #04 pc 000000000002ab87 /system/bin/efibootmgr (_format_acpi_dn+583) (BuildId: 0e8d9a0cd8994623ec86c1005c9d5e8b) #05 pc 0000000000029f63 /system/bin/efibootmgr (efidp_format_device_path+515) (BuildId: 0e8d9a0cd8994623ec86c1005c9d5e8b) #06 pc 000000000001a1a0 /system/bin/efibootmgr (show_vars+336) (BuildId: 0e8d9a0cd8994623ec86c1005c9d5e8b) #07 pc 0000000000018e3a /system/bin/efibootmgr (main+7578) (BuildId: 0e8d9a0cd8994623ec86c1005c9d5e8b) #08 pc 0000000000050d19 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+89) (BuildId: cbf2c6babf4ce509f78a7963e811ace3) So we need to bring debugging to Android. Our target to support is 11+ so we got memfd_create. Also for fopencookie() we can use https://gitlab.com/Conan_Kudo/portable-fopencookie This reverts commit 79c490e0c7e334691339f8ac54cec5fa81a139ac. --- src/error.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/error.c b/src/error.c index 9530e22c..a1c3fa77 100644 --- a/src/error.c +++ b/src/error.c @@ -141,10 +141,8 @@ efi_error_pop(void) static int efi_verbose; static FILE *efi_errlog, *efi_dbglog; -#ifndef ANDROID static int efi_dbglog_fd = -1; static intptr_t efi_dbglog_cookie; -#endif static int log_level; void PUBLIC @@ -153,7 +151,6 @@ efi_set_loglevel(int level) log_level = level; } -#ifndef ANDROID static ssize_t dbglog_write(void *cookie, const char *buf, size_t size) { @@ -219,7 +216,6 @@ dbglog_close(void *cookie UNUSED) errno = EBADF; return -1; } -#endif void PUBLIC efi_error_clear(void) @@ -249,7 +245,6 @@ efi_error_fini(void) static void CONSTRUCTOR efi_error_init(void) { -#ifndef ANDROID ssize_t bytes; cookie_io_functions_t io_funcs = { .write = dbglog_write, @@ -266,7 +261,6 @@ efi_error_init(void) efi_dbglog_cookie = 0; efi_dbglog = fopencookie((void *)efi_dbglog_cookie, "a", io_funcs); -#endif } FILE PUBLIC *