diff --git a/base/android/linker/modern_linker_jni.cc b/base/android/linker/modern_linker_jni.cc index 1ed6a3fd7f9315..5bd7ee6ca6d199 100644 --- a/base/android/linker/modern_linker_jni.cc +++ b/base/android/linker/modern_linker_jni.cc @@ -312,7 +312,8 @@ bool CopyAndRemapRelocations(const LoadedLibraryMetadata& metadata, int* fd) { } memcpy(relro_copy_addr, relro_addr, metadata.relro_size); - int retval = mprotect(relro_copy_addr, metadata.relro_size, PROT_READ); + int retval = + HANDLE_EINTR(mprotect(relro_copy_addr, metadata.relro_size, PROT_READ)); if (retval) { LOG_ERROR("Cannot call mprotect()"); close(shared_mem_fd); diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc index d74cf2bc510ca9..709b38fb62449c 100644 --- a/base/files/file_util_posix.cc +++ b/base/files/file_util_posix.cc @@ -1257,7 +1257,7 @@ BASE_EXPORT bool IsPathExecutable(const FilePath& path) { CHECK_GE(sizeof(pagesize), sizeof(sysconf_result)); void* mapping = mmap(nullptr, pagesize, PROT_READ, MAP_SHARED, fd.get(), 0); if (mapping != MAP_FAILED) { - if (mprotect(mapping, pagesize, PROT_READ | PROT_EXEC) == 0) + if (HANDLE_EINTR(mprotect(mapping, pagesize, PROT_READ | PROT_EXEC)) == 0) result = true; munmap(mapping, pagesize); } diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc index a8b1f0bdf95b0b..fea91101dd0a5f 100644 --- a/base/process/launch_posix.cc +++ b/base/process/launch_posix.cc @@ -413,7 +413,7 @@ Process LaunchProcess(const std::vector& argv, // any hidden calls to malloc. void *malloc_thunk = reinterpret_cast(reinterpret_cast(malloc) & ~4095); - mprotect(malloc_thunk, 4096, PROT_READ | PROT_WRITE | PROT_EXEC); + HANDLE_EINTR(mprotect(malloc_thunk, 4096, PROT_READ | PROT_WRITE | PROT_EXEC)); memset(reinterpret_cast(malloc), 0xff, 8); #endif // 0 diff --git a/chromeos/hugepage_text/hugepage_text.cc b/chromeos/hugepage_text/hugepage_text.cc index 0effaca10a5fb0..10b99aed48892a 100644 --- a/chromeos/hugepage_text/hugepage_text.cc +++ b/chromeos/hugepage_text/hugepage_text.cc @@ -14,6 +14,7 @@ #include "base/bit_cast.h" #include "base/logging.h" +#include "base/posix/eintr_wrapper.h" // CHROMEOS_ORDERFILE_USE is a flag intended to use orderfile // to link Chrome. Only when orderfile is used, we will use hugepages. @@ -134,7 +135,7 @@ static void MremapHugetlbText(void* vaddr, const size_t hsize) { NoAsanAlignedMemcpy(haddr, vaddr, hsize); // change mapping protection to read only now that it has done the copy - if (mprotect(haddr, hsize, PROT_READ | PROT_EXEC)) { + if (HANDLE_EINTR(mprotect(haddr, hsize, PROT_READ | PROT_EXEC))) { PLOG(INFO) << "can not change protection to r-x, fall back to small page"; munmap(haddr, hsize); return; diff --git a/components/gwp_asan/client/guarded_page_allocator_posix.cc b/components/gwp_asan/client/guarded_page_allocator_posix.cc index 60aa7c75c822e2..868617af679d24 100644 --- a/components/gwp_asan/client/guarded_page_allocator_posix.cc +++ b/components/gwp_asan/client/guarded_page_allocator_posix.cc @@ -7,6 +7,7 @@ #include #include "base/check.h" +#include "base/posix/eintr_wrapper.h" namespace gwp_asan { namespace internal { @@ -25,7 +26,8 @@ void GuardedPageAllocator::UnmapRegion() { } void GuardedPageAllocator::MarkPageReadWrite(void* ptr) { - int err = mprotect(ptr, state_.page_size, PROT_READ | PROT_WRITE); + int err = + HANDLE_EINTR(mprotect(ptr, state_.page_size, PROT_READ | PROT_WRITE)); PCHECK(err == 0) << "mprotect"; }