Commit fa5b85b9 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Chromium LUCI CQ

Disable MemoryMap.SelfLargeMapFile, MemoryMap.SelfLargeFiles and...

Disable MemoryMap.SelfLargeMapFile, MemoryMap.SelfLargeFiles and MemoryMap.SelfBasic when PartitionAlloc is used as malloc.

When PartitionAlloc is used as malloc, malloc() will cause mmap(). So while reading and parsing /proc/self/maps, we should avoid memory allocation.
If malloc() is invoked, the maps file will be updated and we will see parse error.

Bug: 1163794
Change-Id: Ifc008c1b23a37ec0405056cdfbe4582233c16d7c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2612872Reviewed-by: default avatarJoshua Peraza <jperaza@chromium.org>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Reviewed-by: default avatarBartek Nowierski <bartekn@chromium.org>
Commit-Queue: Takashi Sakamoto <tasak@google.com>
Cr-Commit-Position: refs/heads/master@{#842836}
parent 86474bf1
......@@ -39,3 +39,6 @@ Local Modifications:
- MultiprocessExec.MultiprocessExec is disabled when OS_POSIX and
BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) are defined. crbug.com/1153544
(third_party/crashpad/crashpad/test/multiprocess_exec_test.cc)
- MemoryMap.SelfLargeMapFile, SelfBasic, SelfLargeFiles are disabled when
BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) are defined. crbug.com/1163794
(third_party/crashpad/crashpad/util/linux/memory_map_test.cc)
......@@ -20,6 +20,7 @@
#include <sys/stat.h>
#include <unistd.h>
#include "base/allocator/buildflags.h"
#include "base/files/file_path.h"
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
......@@ -41,7 +42,20 @@ namespace crashpad {
namespace test {
namespace {
TEST(MemoryMap, SelfLargeFiles) {
// TODO(tasak): Disable SelfLargeFiles when PartitionAlloc is used as malloc.
// Because malloc() will cause new mmap() in the case. So while
// reading /proc/self/maps, any memory allocation will update the maps file and
// will cause "format_error". (e.g. GetDelim uses std::string. If std::string
// allocates memory internally (e.g. append and so on), map.Initialize() will
// fail.) To avoid this failue, firstly allocate a large buffer and read entire
// /proc/self/maps into the buffer. Next will parse data from the buffer and
// initialize MemoryMap. crbug.com/1163794.
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#define MAYBE_SelfLargeFiles DISABLED_SelfLargeFiles
#else
#define MAYBE_SelfLargeFiles SelfLargeFiles
#endif
TEST(MemoryMap, MAYBE_SelfLargeFiles) {
// This test is meant to test the handler's ability to understand files
// mapped from large offsets, even if the handler wasn't built with
// _FILE_OFFSET_BITS=64. ScopedTempDir needs to stat files to determine
......@@ -73,7 +87,14 @@ TEST(MemoryMap, SelfLargeFiles) {
ASSERT_TRUE(map.Initialize(&connection));
}
TEST(MemoryMap, SelfBasic) {
// TODO(tasak): Disable SelfBasic when PartitionAlloc is used as malloc.
// crbug.com/1163794. See SelfLargeFiles' comment.
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#define MAYBE_SelfBasic DISABLED_SelfBasic
#else
#define MAYBE_SelfBasic SelfBasic
#endif
TEST(MemoryMap, MAYBE_SelfBasic) {
ScopedMmap mmapping;
ASSERT_TRUE(mmapping.ResetMmap(nullptr,
getpagesize(),
......@@ -305,7 +326,14 @@ void ExpectMappings(const MemoryMap& map,
}
}
TEST(MemoryMap, SelfLargeMapFile) {
// TODO(tasak): Disable SelfLargeMapFile when PartitionAlloc is used as malloc.
// crbug.com/1163794. See SelfLargeFiles' comment.
#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#define MAYBE_SelfLargeMapFile DISABLED_SelfLargeMapFile
#else
#define MAYBE_SelfLargeMapFile SelfLargeMapFile
#endif
TEST(MemoryMap, MAYBE_SelfLargeMapFile) {
constexpr size_t kNumMappings = 1024;
const size_t page_size = getpagesize();
ScopedMmap mappings;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment