Kaydet (Commit) b834fad4 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

external/breakpad: Work around -fsanitize=alignment

...as seen in the scenario described in 5997121a
"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
üst 5997121a
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
$(eval $(call gb_UnpackedTarball_UnpackedTarball,breakpad)) $(eval $(call gb_UnpackedTarball_UnpackedTarball,breakpad))
$(eval $(call gb_UnpackedTarball_set_patchlevel,breakpad,0))
$(eval $(call gb_UnpackedTarball_set_tarball,breakpad,$(BREAKPAD_TARBALL))) $(eval $(call gb_UnpackedTarball_set_tarball,breakpad,$(BREAKPAD_TARBALL)))
$(eval $(call gb_UnpackedTarball_add_patches,breakpad,\ $(eval $(call gb_UnpackedTarball_add_patches,breakpad,\
...@@ -18,4 +20,12 @@ $(eval $(call gb_UnpackedTarball_add_patches,breakpad,\ ...@@ -18,4 +20,12 @@ $(eval $(call gb_UnpackedTarball_add_patches,breakpad,\
external/breakpad/breakpad-stackwalk.patch.1 \ external/breakpad/breakpad-stackwalk.patch.1 \
)) ))
ifeq ($(COM_IS_CLANG),TRUE)
ifneq ($(filter -fsanitize=%,$(CC)),)
$(eval $(call gb_UnpackedTarball_add_patches,breakpad, \
external/breakpad/ubsan.patch \
))
endif
endif
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
--- 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;
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