patch: fix 0001

This commit is contained in:
2026-09-18 20:42:33 +02:00
parent 0c89915970
commit 7acccdbc37
+6 -21
View File
@@ -1,23 +1,9 @@
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;
--- a/art/runtime/mem_map.cc 2026-09-17 09:32:04.741988772 +0200
+++ b/art/runtime/mem_map.cc 2026-09-17 09:32:26.208150692 +0200
@@ -393,6 +393,11 @@
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
@@ -26,4 +12,3 @@ Bug: 23318356
} 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.