From bb62878def6c6fd8eb75da7e0a9854f04cef4f79 Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Sat, 10 Apr 2021 16:59:23 +0300 Subject: [PATCH] inetutils: disable fdsan for "whois" https://github.com/termux/termux-packages/issues/5980 --- packages/inetutils/build.sh | 2 +- packages/inetutils/disable-fdsan.patch | 30 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 packages/inetutils/disable-fdsan.patch diff --git a/packages/inetutils/build.sh b/packages/inetutils/build.sh index e4f11c8ec..519bce7d2 100644 --- a/packages/inetutils/build.sh +++ b/packages/inetutils/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Collection of common network programs" TERMUX_PKG_LICENSE="GPL-3.0" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION=1.9.4 -TERMUX_PKG_REVISION=10 +TERMUX_PKG_REVISION=11 TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/inetutils/inetutils-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=849d96f136effdef69548a940e3e0ec0624fc0c81265296987986a0dd36ded37 TERMUX_PKG_DEPENDS="readline" diff --git a/packages/inetutils/disable-fdsan.patch b/packages/inetutils/disable-fdsan.patch new file mode 100644 index 000000000..d7f7dc0d2 --- /dev/null +++ b/packages/inetutils/disable-fdsan.patch @@ -0,0 +1,30 @@ +diff -uNr inetutils-1.9.4/whois/whois.c inetutils-1.9.4.mod/whois/whois.c +--- inetutils-1.9.4/whois/whois.c 2015-03-31 18:40:50.000000000 +0300 ++++ inetutils-1.9.4.mod/whois/whois.c 2021-04-10 16:58:42.989309373 +0300 +@@ -49,6 +49,9 @@ + #include + #include "xalloc.h" + ++#include ++#include ++ + /* Global variables */ + int sockfd, verb = 0; + struct obstack query_stk; +@@ -207,6 +210,16 @@ + char *qstring; + char *p; + ++ // For Android 11+. ++ void *lib_handle = dlopen("libc.so", RTLD_LAZY); ++ if (lib_handle) { ++ void (*set_fdsan_error_level)(enum android_fdsan_error_level newlevel) = dlsym(lib_handle, "android_fdsan_set_error_level"); ++ if (set_fdsan_error_level) { ++ set_fdsan_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED); ++ } ++ dlclose(lib_handle); ++ } ++ + set_program_name (argv[0]); + + #ifdef ENABLE_NLS