Hello Marton Greber, Zoltan Martonka, Kudu Jenkins,

I'd like you to reexamine a change. Please visit

    http://gerrit.cloudera.org:8080/22977

to look at the new patch set (#2).

Change subject: [arm64] Fix SIGBUS errors for atomic operations
......................................................................

[arm64] Fix SIGBUS errors for atomic operations

The following error occurs when running `bin/cbtree-test
--gtest_filter=TestCBTree.TestLeafNode` in an Rocky ARM environment.

*** Aborted at 1748486900 (unix time) try "date -d @1748486900" if you are 
using GNU date ***
PC: @                0x0 (unknown)
*** SIGBUS (@0xffffc794b2af) received by PID 32172 (TID 0xffff838a0040) from 
PID 18446744072762995375; stack trace: ***
    @     0xffff83f0e890 google::(anonymous namespace)::FailureSignalHandler()
    @     0xffff853b07a0 ([vdso]+0x79f)
    @           0x279efc kudu::tablet::btree::VersionField::Lock()
    @           0x2815e4 kudu::tablet::btree::NodeBase<>::Lock()
    @           0x2788a4 kudu::tablet::btree::TestCBTree::InsertInLeaf<>()
    @           0x269d18 
kudu::tablet::btree::TestCBTree_TestLeafNode_Test::TestBody()
    @     0xffff83de0608 
testing::internal::HandleExceptionsInMethodIfSupported<>()
    @     0xffff83dd2348 testing::Test::Run()
    @     0xffff83dd24e8 testing::TestInfo::Run()
    @     0xffff83dd2b90 testing::TestSuite::Run()
    @     0xffff83dd7274 testing::internal::UnitTestImpl::RunAllTests()
    @     0xffff83dd25f0 testing::UnitTest::Run()
    @     0xffff85335f84 (unknown)
    @     0xffff853353e4 (unknown)
    @     0xffff838e7280 __libc_start_call_main
    @     0xffff838e7358 __libc_start_main_alias_2
    @           0x2698b0 _start
Bus error

This commit resolves critical SIGBUS crashes that occurred on architectures
with strict alignment requirements (e.g., ARM). The bus errors stemmed from
misaligned memory accesses during atomic operations on version fields in
the concurrent B-tree implementation.

Key changes made:
1. Added explicit 8-byte alignment for AtomicVersionValue fields using
   alignas(8) to guarantee proper alignment for std::atomic<uint64_t>
2. Enhanced node allocation to enforce maximum alignment requirements
3. Added static assertions to validate type sizes and alignments
4. Added a new compile flag '__rocky_el9_arm__' for the changes

The root cause was that versionPlaceholder_ in packed NodeBase structures
could become misaligned, violating architectural requirements for atomic
operations on uint64_t. This was particularly problematic on ARM platforms
which strictly enforce alignment for atomic accesses.

Testing recommendations:
1. Validate on ARM platforms that previously exhibited SIGBUS errors
2. Run with ASan/TSan to detect any residual memory/threading issues
3. Verify with the original test case (TestCBTree_TestLeafNode_Test)

These changes ensure atomic operations always occur on properly aligned
memory addresses, maintaining cross-platform compatibility while preserving
the concurrent B-tree's lock-free reading capabilities.

Change-Id: I6f8ea46308f942ded97d93d27ae466fd13a31b53
---
M CMakeLists.txt
M src/kudu/tablet/concurrent_btree.h
2 files changed, 48 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/77/22977/2
--
To view, visit http://gerrit.cloudera.org:8080/22977
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I6f8ea46308f942ded97d93d27ae466fd13a31b53
Gerrit-Change-Number: 22977
Gerrit-PatchSet: 2
Gerrit-Owner: KeDeng <[email protected]>
Gerrit-Reviewer: KeDeng <[email protected]>
Gerrit-Reviewer: Kudu Jenkins (120)
Gerrit-Reviewer: Marton Greber <[email protected]>
Gerrit-Reviewer: Zoltan Martonka <[email protected]>

Reply via email to