qemu: use a higher fallback value if sysctl vm.mmap_min_addr is not readable.

Issue https://github.com/termux/termux-packages/issues/6172.
This commit is contained in:
Leonid Pliushch 2020-12-24 17:42:08 +02:00
parent 377da94e12
commit 2510665231
No known key found for this signature in database
GPG Key ID: 45F2964132545795
2 changed files with 18 additions and 1 deletions

View File

@ -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);

View File

@ -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 <leonid.pliushch@gmail.com>"
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"