office-gobmx/external/breakpad/ubsan.patch
Stephan Bergmann b834fad4a5 external/breakpad: Work around -fsanitize=alignment
...as seen in the scenario described in 5997121a51
"Support signal handlers registered with SA_SIGINFO", first

> src/client/linux/minidump_writer/directory_reader.h:82:19: runtime error: member access within misaligned address 0x7f3f8235c2cc for type 'struct kernel_dirent', which requires 8 byte alignment
> 0x7f3f8235c2cc: note: pointer points here
>   10 02 00 00 d8 f8 3b 00  00 00 00 00 01 00 00 00  00 00 00 00 18 00 2e 00  00 00 00 04 02 c7 3b 00

and then

> src/client/linux/minidump_writer/linux_dumper.cc:382:19: runtime error: member access within misaligned address 0x7f96c225d7bc for type 'google_breakpad::MappingInfo', which requires 8 byte alignment
> 0x7f96c225d7bc: note: pointer points here
>   20 0a 32 30 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
>               ^

Change-Id: I7f739567879093a404bee3e351ce9e8257676183
2017-02-01 12:37:54 +01:00

21 lines
742 B
Diff

--- src/client/linux/minidump_writer/directory_reader.h
+++ src/client/linux/minidump_writer/directory_reader.h
@@ -96,7 +96,7 @@
const int fd_;
bool hit_eof_;
unsigned buf_used_;
- uint8_t buf_[sizeof(struct kernel_dirent) + NAME_MAX + 1];
+ uint8_t buf_[sizeof(struct kernel_dirent) + NAME_MAX + 1] __attribute__ ((aligned (__BIGGEST_ALIGNMENT__)));
};
} // namespace google_breakpad
--- src/common/memory.h
+++ src/common/memory.h
@@ -75,6 +75,7 @@
if (!bytes)
return NULL;
+ bytes = (bytes + (__BIGGEST_ALIGNMENT__ - 1)) & ~(__BIGGEST_ALIGNMENT__ - 1);
if (current_page_ && page_size_ - page_offset_ >= bytes) {
uint8_t *const ret = current_page_ + page_offset_;
page_offset_ += bytes;