Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-22713

AlignedBuilder exhibits UB via misaligned loads/stores

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: MMAPv1
    • Fully Compatible
    • ALL
    • Hide

      Run any jscore test with MMAPv1 as the storage engine.

      Show
      Run any jscore test with MMAPv1 as the storage engine.

      See https://github.com/mongodb/mongo/blob/742f15bfcf2173103498a81f56503c9746b4e93d/src/mongo/db/storage/mmap_v1/aligned_builder.h#L83-L99

      The undefined behavior sanitizer complains:

      [MongoDFixture:job0] src/mongo/db/storage/mmap_v1/aligned_builder.h:99:9: runtime error: store to misaligned address 0x7fb230306004 for type 'unsigned long long', which requires 8 byte alignment
      [MongoDFixture:job0] 0x7fb230306004: note: pointer points here
      [MongoDFixture:job0]   fd ff ff ff 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
      [MongoDFixture:job0]               ^
      [MongoDFixture:job0]     #0 0x1a380bb in mongo::AlignedBuilder::appendNum(unsigned long long) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/storage/mmap_v1/aligned_builder.h:99:9
      [MongoDFixture:job0]     #1 0x1a380bb in mongo::dur::FileCreatedOp::_serialize(mongo::AlignedBuilder&) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/storage/mmap_v1/durop.cpp:121
      [MongoDFixture:job0]     #2 0x1a21bc2 in mongo::dur::_PREPLOGBUFFER(mongo::dur::JSectHeader&, mongo::AlignedBuilder&) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp:185:10
      [MongoDFixture:job0]     #3 0x1a21bc2 in mongo::dur::PREPLOGBUFFER(mongo::dur::JSectHeader&, mongo::AlignedBuilder&) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp:198
      [MongoDFixture:job0]     #4 0x1a0deeb in mongo::dur::durThread() /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/storage/mmap_v1/dur.cpp:744:17
      [MongoDFixture:job0]     #5 0x7fb23238c02f  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xb902f)
      [MongoDFixture:job0]     #6 0x7fb2320bc6a9 in start_thread /build/buildd/glibc-2.21/nptl/pthread_create.c:333
      

      Note that these are also not endian clean

            Assignee:
            backlog-server-platform DO NOT USE - Backlog - Platform Team
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: