From 4c01a9c389ffcfb29bb1c2a4239804019eddc3d6 Mon Sep 17 00:00:00 2001 From: "benchan@chromium.org" Date: Mon, 2 Feb 2015 23:27:27 +0000 Subject: Handle failures of copying process data from a core file. When LinuxCoreDumper fails to copy process data from a core file, it fills the return buffer with a repeated sequence of a special marker. However, MinidumpWriter doesn't know about that and may incorrectly interpret the data. In many cases, MinidumpWriter simply copies the gibberish data to the minidump, which isn't too bad. However, the gibberish data may cause MinidumpWriter to behave badly in some other cases. For example, when MinidumpWriter tries to iterate through the linked list of all loaded DSOs via the r_map field of a r_debug struct, if the linked list is filed with the special marker, the code keeps iterating through the same address. This CL addresses the issue by having LinuxCoreDumper::CopyFromProcess() returns a Boolean value to indicate if the expected data is found from the core file. MinidumpWriter can then decide how to handle that. BUG=chromium:453484 TEST=Run core2md with the test data attached to chromium:453484. R=mark@chromium.org Review URL: https://breakpad.appspot.com/4724002 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1420 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/client/linux/minidump_writer/linux_core_dumper.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/client/linux/minidump_writer/linux_core_dumper.cc') diff --git a/src/client/linux/minidump_writer/linux_core_dumper.cc b/src/client/linux/minidump_writer/linux_core_dumper.cc index 3eab44db..b8d90af6 100644 --- a/src/client/linux/minidump_writer/linux_core_dumper.cc +++ b/src/client/linux/minidump_writer/linux_core_dumper.cc @@ -74,7 +74,7 @@ bool LinuxCoreDumper::BuildProcPath(char* path, pid_t pid, return true; } -void LinuxCoreDumper::CopyFromProcess(void* dest, pid_t child, +bool LinuxCoreDumper::CopyFromProcess(void* dest, pid_t child, const void* src, size_t length) { ElfCoreDump::Addr virtual_address = reinterpret_cast(src); // TODO(benchan): Investigate whether the data to be copied could span @@ -84,7 +84,9 @@ void LinuxCoreDumper::CopyFromProcess(void* dest, pid_t child, // If the data segment is not found in the core dump, fill the result // with marker characters. memset(dest, 0xab, length); + return false; } + return true; } bool LinuxCoreDumper::GetThreadInfoByIndex(size_t index, ThreadInfo* info) { -- cgit v1.2.1