Skip to content

Conversation

@srh
Copy link
Contributor

@srh srh commented Oct 16, 2023

Description

This is a best effort fix to avoid some unaligned memory accesses that have cropped up in testing 32-bit ARM code. This avoids crashes that occur when running 32-bit ARM binaries on a 64-bit kernel.

This will probably improve the performance of 32-bit ARM on a 32-bit Linux kernel, because supposedly the kernel traps the error and fixes up the memory read. Or so I've read. That could matter if anybody has that running on some rPi somewhere.

I checked by disassembly -- this does not affect x86-64 code generation on g++, except maybe for copy() calls in debug mode -- nor would we expect it to.

With this fix I got 32-bit ARM debug binaries to run successfully on a 64-bit ARM system.

For what it's worth, I ran into some unrelated issue with release binaries, possibly some sort of cross-compiling/linking snafu as it was a segfault in libc, so I didn't test that.

It also should be noted that I built with -DRDB_NO_BACKTRACES=1 to avoid another libc (or libexecinfo?) segfault in the debug binary, which calls libc or libexecinfo's backtrace() preemptively in some cases (for debugging purposes).

srh added 3 commits October 3, 2023 16:02
alignas(1) makes no change to btree_internal_pair -- its member
btree_key_t, or its being packed, already has that effect.
@srh srh merged commit 94cc766 into rethinkdb:v2.4.x Oct 16, 2023
@srh srh deleted the srh/aligned branch October 16, 2023 20:20
@srh srh added this to the 2.4.4 milestone Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant