From 2a12828ef682e8cf67e82037d771dfa8f9deffd6 Mon Sep 17 00:00:00 2001 From: Emil Kosz Date: Sun, 13 Sep 2026 21:47:51 +0200 Subject: [PATCH] patch: art mmap fix; re-add los patches & applying Taken from: https://android.googlesource.com/platform/art/+/673bd2c638ed82bbe71cf7d645d433973a624e4f --- build_los-14.1.sh | 3 ++ ...1-art-mem-map-fix-mmap-on-kernel-518.patch | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 patches/los/0001-art-mem-map-fix-mmap-on-kernel-518.patch diff --git a/build_los-14.1.sh b/build_los-14.1.sh index d34f909..c8b233e 100755 --- a/build_los-14.1.sh +++ b/build_los-14.1.sh @@ -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" \ diff --git a/patches/los/0001-art-mem-map-fix-mmap-on-kernel-518.patch b/patches/los/0001-art-mem-map-fix-mmap-on-kernel-518.patch new file mode 100644 index 0000000..5fed49a --- /dev/null +++ b/patches/los/0001-art-mem-map-fix-mmap-on-kernel-518.patch @@ -0,0 +1,29 @@ +From: rubenslte-builder +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.