From 2510665231d9ca6c5b00f7c648c840a4e3bbb6ed Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Thu, 24 Dec 2020 17:42:08 +0200 Subject: [PATCH] qemu: use a higher fallback value if sysctl vm.mmap_min_addr is not readable. Issue https://github.com/termux/termux-packages/issues/6172. --- .../0013-mmap_min_addr-fallback.patch | 17 +++++++++++++++++ packages/qemu-system-x86-64-headless/build.sh | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 packages/qemu-system-x86-64-headless/0013-mmap_min_addr-fallback.patch diff --git a/packages/qemu-system-x86-64-headless/0013-mmap_min_addr-fallback.patch b/packages/qemu-system-x86-64-headless/0013-mmap_min_addr-fallback.patch new file mode 100644 index 000000000..be0e65f7d --- /dev/null +++ b/packages/qemu-system-x86-64-headless/0013-mmap_min_addr-fallback.patch @@ -0,0 +1,17 @@ +diff -uNr qemu-5.2.0/linux-user/main.c qemu-5.2.0.mod/linux-user/main.c +--- qemu-5.2.0/linux-user/main.c 2020-12-08 18:59:44.000000000 +0200 ++++ qemu-5.2.0.mod/linux-user/main.c 2020-12-24 17:41:07.982481916 +0200 +@@ -770,7 +770,13 @@ + * If we're in a chroot with no /proc, fall back to 1 page. + */ + if (mmap_min_addr == 0) { ++#ifdef __ANDROID__ ++ // Go with 8 pages (32768 bytes) as default value for Android (Termux). ++ // Issue https://github.com/termux/termux-packages/issues/6172. ++ mmap_min_addr = qemu_host_page_size * 8; ++#else + mmap_min_addr = qemu_host_page_size; ++#endif + qemu_log_mask(CPU_LOG_PAGE, + "host mmap_min_addr=0x%lx (fallback)\n", + mmap_min_addr); diff --git a/packages/qemu-system-x86-64-headless/build.sh b/packages/qemu-system-x86-64-headless/build.sh index bbd38d20d..9a12cf891 100644 --- a/packages/qemu-system-x86-64-headless/build.sh +++ b/packages/qemu-system-x86-64-headless/build.sh @@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="A generic and open source machine emulator and virtualiz TERMUX_PKG_LICENSE="LGPL-2.1" TERMUX_PKG_MAINTAINER="Leonid Pliushch " TERMUX_PKG_VERSION=1:5.2.0 -TERMUX_PKG_REVISION=1 +TERMUX_PKG_REVISION=2 TERMUX_PKG_SRCURL=https://download.qemu.org/qemu-${TERMUX_PKG_VERSION:2}.tar.xz TERMUX_PKG_SHA256="cb18d889b628fbe637672b0326789d9b0e3b8027e0445b936537c78549df17bc" TERMUX_PKG_DEPENDS="attr, glib, libbz2, libc++, libcap-ng, libcurl, libgcrypt, libiconv, libjpeg-turbo, liblzo, libnfs, libpixman, libpng, libssh, ncurses, qemu-common, resolv-conf, zlib"