summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-02-01 12:37:54 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-02-01 12:37:54 +0100
commitb834fad4a5b7fb6bd642769ed8803d0a65e50b00 (patch)
tree79af97589c3f6f86646f50c3dd3e2e18f6b4a9b3 /external
parent5997121a51e240c762b4d002d7d16b94ac13d4a1 (diff)
external/breakpad: Work around -fsanitize=alignment
...as seen in the scenario described in 5997121a51e240c762b4d002d7d16b94ac13d4a1 "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
Diffstat (limited to 'external')
-rw-r--r--external/breakpad/UnpackedTarball_breakpad.mk10
-rw-r--r--external/breakpad/ubsan.patch21
2 files changed, 31 insertions, 0 deletions
diff --git a/external/breakpad/UnpackedTarball_breakpad.mk b/external/breakpad/UnpackedTarball_breakpad.mk
index 445047bc7d87..108004ddee36 100644
--- a/external/breakpad/UnpackedTarball_breakpad.mk
+++ b/external/breakpad/UnpackedTarball_breakpad.mk
@@ -9,6 +9,8 @@
$(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_add_patches,breakpad,\
@@ -18,4 +20,12 @@ $(eval $(call gb_UnpackedTarball_add_patches,breakpad,\
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:
diff --git a/external/breakpad/ubsan.patch b/external/breakpad/ubsan.patch
new file mode 100644
index 000000000000..f4204516eed4
--- /dev/null
+++ b/external/breakpad/ubsan.patch
@@ -0,0 +1,21 @@
+--- 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;