From 833cadc0a11f0a061cc8057ee56debe89e412973 Mon Sep 17 00:00:00 2001 From: Tobias Sargeant Date: Wed, 18 Jan 2017 15:19:51 +0000 Subject: Add API to skip dump if crashing thread doesn't reference a given module This CL makes it possible to skip a dump if the crashing thread doesn't have any pointers to a given module. The concrete use case is WebView where we would like to skip generating microdump output when webview is unreferenced by the stack and thus cannot be responsible for the crash in a way that would be debuggable. The range of interesting addresses is chosen by examining the process mappings to find the one that contains a pointer that is known to be in the right shared object (i.e. an appropriately chosen function pointer) passed from the client. If the extracted stack does not contain a pointer in this range, then we do not generate a microdump. If the stack extraction fails, we still generate a microdump (without a stack). BUG=664460 Change-Id: If19406a13168264f7751245fc39591bd6cdbf5df Reviewed-on: https://chromium-review.googlesource.com/419476 Reviewed-by: Robert Sesek Reviewed-by: Primiano Tucci --- src/client/linux/minidump_writer/linux_dumper.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/client/linux/minidump_writer/linux_dumper.h') diff --git a/src/client/linux/minidump_writer/linux_dumper.h b/src/client/linux/minidump_writer/linux_dumper.h index c3c79926..0e20209b 100644 --- a/src/client/linux/minidump_writer/linux_dumper.h +++ b/src/client/linux/minidump_writer/linux_dumper.h @@ -103,6 +103,11 @@ class LinuxDumper { const wasteful_vector &threads() { return threads_; } const wasteful_vector &mappings() { return mappings_; } const MappingInfo* FindMapping(const void* address) const; + // Find the mapping which the given memory address falls in. Unlike + // FindMapping, this method uses the unadjusted mapping address + // ranges from the kernel, rather than the ranges that have had the + // load bias applied. + const MappingInfo* FindMappingNoBias(uintptr_t address) const; const wasteful_vector& auxv() { return auxv_; } // Find a block of memory to take as the stack given the top of stack pointer. @@ -111,6 +116,19 @@ class LinuxDumper { // stack_top: the current top of the stack bool GetStackInfo(const void** stack, size_t* stack_len, uintptr_t stack_top); + // Test whether |stack_copy| contains a pointer-aligned word that + // could be an address within a given mapping. + // stack_copy: a copy of the stack to check. |stack_copy| might + // not be word aligned, but it represents word aligned + // data copied from another location. + // stack_len: the length of the allocation pointed to by |stack_copy|. + // sp_offset: the offset relative to stack_copy that reflects the + // current value of the stack pointer. + // mapping: the mapping against which to test stack words. + bool StackHasPointerToMapping(const uint8_t* stack_copy, size_t stack_len, + uintptr_t sp_offset, + const MappingInfo& mapping); + PageAllocator* allocator() { return &allocator_; } // Copy content of |length| bytes from a given process |child|, -- cgit v1.2.1