From a0223af40e00834704acd2897e9385563af2e6e1 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Mon, 30 Jan 2017 16:07:38 +0000 Subject: chromium: update the MADFREE patch (glibc 2.24) --- chromium/build/patches/chromium_madv_free.patch | 33 ++++++++++++++----------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/chromium/build/patches/chromium_madv_free.patch b/chromium/build/patches/chromium_madv_free.patch index 2867c796..b06627ff 100644 --- a/chromium/build/patches/chromium_madv_free.patch +++ b/chromium/build/patches/chromium_madv_free.patch @@ -1,15 +1,18 @@ -diff -up chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp.madv_free chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp ---- chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp.madv_free 2016-08-15 13:07:29.279655676 -0400 -+++ chromium-52.0.2743.116/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp 2016-08-15 13:08:38.447317416 -0400 -@@ -41,6 +41,11 @@ - #include - #include - -+#if OS(LINUX) && defined(MADV_FREE) -+// Added in Linux 4.5, but it breaks the sandbox. -+#undef MADV_FREE -+#endif -+ - #ifndef MADV_FREE - #define MADV_FREE MADV_DONTNEED - #endif +Taken from Gentoo: +https://gitweb.gentoo.org/repo/gentoo.git/tree/www-client/chromium/files/chromium-glibc-2.24.patch + +--- a/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp.orig 2017-01-05 20:50:56.329369189 +0000 ++++ b/third_party/WebKit/Source/wtf/allocator/PageAllocator.cpp 2017-01-05 20:51:32.926099779 +0000 +@@ -242,6 +242,12 @@ + ASSERT(!(len & kSystemPageOffsetMask)); + #if OS(POSIX) + int ret = madvise(addr, len, MADV_FREE); ++ if (ret != 0 && errno == EINVAL) { ++ // MADV_FREE only works on Linux 4.5+ . If request failed, ++ // retry with older MADV_DONTNEED . Note that MADV_FREE ++ // being defined at compile time doesn't imply runtime support. ++ ret = madvise(addr, len, MADV_DONTNEED); ++ } + RELEASE_ASSERT(!ret); + #else + setSystemPagesInaccessible(addr, len); -- cgit v1.2.3-65-gdbad