patch: art mmap fix; re-add los patches & applying

Taken from: https://android.googlesource.com/platform/art/+/673bd2c638ed82bbe71cf7d645d433973a624e4f
This commit is contained in:
2026-09-13 22:06:14 +02:00
parent 9a2ac445a9
commit 2a12828ef6
2 changed files with 32 additions and 0 deletions
+3
View File
@@ -49,6 +49,9 @@ do_build() {
repo sync -c -j"$(nproc)"
fi
rlte_print "Applying patches"
apply_patches "$ROOT/patches/los"
export LC_ALL=C LANG=C USE_CCACHE=1 CCACHE_DIR="$ROOT/.ccache" \
JACK_SERVER=false JACK_NO_SERVER=1 \
JACK_REPOSITORY="$ROOT/.jack-repository" TOP="$PWD" \
@@ -0,0 +1,29 @@
From: rubenslte-builder <builder@rubenslte>
Date: Sat, 13 Sep 2026 21:00:00 +0200
Subject: [PATCH 1/1] art-mem-map-fix-mmap-on-kernel-518
Workaround for mmap error when building on Linux kernel 5.18+.
Adds MAP_FIXED_NOREPLACE in MapFileAtAddress (host builds only,
guarded by #if !defined(ART_TARGET)), forcing the kernel to honor
the expected address instead of mapping at a different one.
Fixes: android-review.googlesource.com/c/platform/art/+/673bd2c638ed82bbe71cf7d645d433973a624e4f
Bug: 23318356
---
diff --git a/art/runtime/mem_map.cc b/art/runtime/mem_map.cc
index b9d51c1..f034a3d 100644
--- a/art/runtime/mem_map.cc
+++ b/art/runtime/mem_map.cc
@@ -393,7 +393,12 @@
DCHECK(ContainedWithinExistingMap(expected_ptr, byte_count, error_msg))
<< ((error_msg != nullptr) ? *error_msg : std::string());
flags |= MAP_FIXED;
+#if !defined(ART_TARGET)
+ } else if (expected_ptr) {
+#define MAP_FIXED_NOREPLACE 0x100000
+ flags |= MAP_FIXED_NOREPLACE;
+#endif
} else {
CHECK_EQ(0, flags & MAP_FIXED);
// Don't bother checking for an overlapping region here. We'll
// check this if required after the fact inside CheckMapRequest.