overlay/www-client/chromium/files/chromium-135-map_droppable-glibc.patch
github-actions[bot] 1296c8b923
Some checks failed
Docker / updater-base-image (push) Waiting to run
Test / elint (push) Failing after 18s
www-client/chromium: sync with upstream
2025-02-15 00:03:09 +00:00

27 lines
1.4 KiB
Diff

https://github.com/FireBurn/chromium/commit/28dc20e11a6f6e6d176fc3ed0b74b405112ecb2d
From: Mike Lothian <mike@fireburn.co.uk>
Date: Wed, 12 Feb 2025 14:33:50 +0000
Subject: [PATCH] Add MAP_DROPPABLE to syscall_parameters_restrictions.cc
--- a/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+++ b/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
@@ -34,6 +34,10 @@
#include "sandbox/linux/system_headers/linux_syscalls.h"
#include "sandbox/linux/system_headers/linux_time.h"
+#if !defined(MAP_DROPPABLE)
+#define MAP_DROPPABLE 0x08 // Zero memory under memory pressure.
+#endif
+
#if BUILDFLAG(IS_LINUX) && !defined(__arm__) && !defined(__aarch64__) && \
!defined(PTRACE_GET_THREAD_AREA)
// Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
@@ -236,7 +240,7 @@ ResultExpr RestrictMmapFlags() {
// TODO(davidung), remove MAP_DENYWRITE with updated Tegra libraries.
const uint64_t kAllowedMask = MAP_SHARED | MAP_PRIVATE | MAP_ANONYMOUS |
MAP_STACK | MAP_NORESERVE | MAP_FIXED |
- MAP_DENYWRITE | MAP_LOCKED |
+ MAP_DENYWRITE | MAP_LOCKED | MAP_DROPPABLE |
kArchSpecificAllowedMask;
const Arg<int> flags(3);
return If((flags & ~kAllowedMask) == 0, Allow()).Else(CrashSIGSYS());