Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-7741

Fix misaligned address in crc32-x86.c

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.1, 4.4.8, 5.0.2, 5.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • 2
    • Storage - Ra 2021-07-12

      Fallout of errors coming from new UBSAN Build variants in WT-7552. Within src/checksum/x86/crc32-x86.c.

      [2021/06/28 05:05:12.512] ../src/checksum/x86/crc32-x86.c:62:46: runtime error: load of misaligned address 0x7f3a02f2a014 for type 'const uint64_t' (aka 'const unsigned long'), which requires 8 byte alignment
       [2021/06/28 05:05:12.512] 0x7f3a02f2a014: note: pointer points here
       [2021/06/28 05:05:12.512]   54 68 65 20 71 75 69 63  6b 20 62 72 6f 77 6e 20  66 6f 78 20 6a 75 6d 70  73 20 6f 76 65 72 20 74
       [2021/06/28 05:05:12.512]               ^
       [2021/06/28 05:05:12.512]     #0 0x7f3a01dc45ff in __wt_checksum_hw /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/../src/checksum/x86/crc32-x86.c:62:46
       [2021/06/28 05:05:12.512]     #1 0x42338f in main /data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/test/csuite/../../../test/csuite/wt2695_checksum/main.c:108:10
       [2021/06/28 05:05:12.512]     #2 0x7f3a0044dbf6 in __libc_start_main /build/glibc-S9d2JN/glibc-2.27/csu/../csu/libc-start.c:310
       [2021/06/28 05:05:12.512]     #3 0x4036c9 in _start (/data/mci/ca8a7d950f1bf956b286e945a18a82e9/wiredtiger/build_posix/test/csuite/test_wt2695_checksum+0x4036c9)
       [2021/06/28 05:05:12.512] FAIL test_wt2695_checksum (exit status: 1)
      

      The error is pointing towards this line.

          p64 = (const uint64_t *)p;
          /* Checksum in 8B chunks. */
          for (nqwords = len / sizeof(uint64_t); nqwords; nqwords--) {
              __asm__ __volatile__(".byte 0xF2, 0x48, 0x0F, 0x38, 0xF1, 0xF1"
                                   : "=S"(crc)
                                   : "0"(crc), "c"(*p64));
              p64++;
          }
      

      Verify with UBSAN build again once fixed.

            Assignee:
            alexey.anisimov@mongodb.com Alexey Anisimov (Inactive)
            Reporter:
            jie.chen@mongodb.com Jie Chen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: