root icon indicating copy to clipboard operation
root copied to clipboard

[libNewDelete] Over-align the allocation.

Open pcanal opened this issue 3 years ago • 5 comments

By leveraging std::max_align_t, insure that the return addressed (offset-ed compared to the address allocated by TStorage::ObjectAlloc) is still well aligned.

In https://root-forum.cern.ch/t/libnew-so-and-tcanvas/51039/8, executing in rootn.exe:

TMapFile *mf=TMapFile::Create("test.map","recreate") TH1 *h=new TH1F("test","test",100,-5,5) h->Fill (0) h->Draw()

led to a segmentation fault in

during the execution of:

=> 0x00007ffff2a62a12 <+162>: movaps %xmm0,0x10(%r12)

with an address that was ending in '8'. When allocating the TMethodCall, the address returned was aligned on a 16 bit boundary but the memory counting over-allocating was shifting the address by 'only' 8 bits, leading to a mis-aligned access by this vector memcpy.

pcanal avatar Aug 10 '22 15:08 pcanal

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14 How to customize builds

phsft-bot avatar Aug 10 '22 15:08 phsft-bot

Build failed on ROOT-debian10-i386/soversion. Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build See console output.

Warnings:

  • [2022-08-10T16:20:09.495Z] /home/sftnight/build/workspace/root-pullrequests-build/root/core/newdelete/src/NewDelete.cxx:110:29: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘unsigned int’} [-Wsign-compare]
  • [2022-08-10T16:20:09.495Z] /home/sftnight/build/workspace/root-pullrequests-build/root/core/newdelete/src/NewDelete.cxx:110:29: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘unsigned int’} [-Wsign-compare]
  • [2022-08-10T16:20:09.495Z] /home/sftnight/build/workspace/root-pullrequests-build/root/core/newdelete/src/NewDelete.cxx:422:16: warning: comparison Scanning dependencies of target coreconttestUnit
  • [2022-08-10T16:20:09.495Z] /home/sftnight/build/workspace/root-pullrequests-build/root/core/newdelete/src/NewDelete.cxx:110:29: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘unsigned int’} [-Wsign-compare]

phsft-bot avatar Aug 10 '22 16:08 phsft-bot

Build failed on ROOT-performance-centos8-multicore/cxx17. Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build See console output.

Failing tests:

phsft-bot avatar Aug 10 '22 16:08 phsft-bot

Starting build on ROOT-debian10-i386/soversion, ROOT-performance-centos8-multicore/cxx17, ROOT-ubuntu18.04/nortcxxmod, ROOT-ubuntu2004/python3, mac1015/cxx17, mac11/cxx14, windows10/cxx14 How to customize builds

phsft-bot avatar Aug 10 '22 19:08 phsft-bot

Build failed on ROOT-performance-centos8-multicore/cxx17. Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build See console output.

Failing tests:

phsft-bot avatar Aug 10 '22 20:08 phsft-bot

Thanks, std::max_align_t is indeed what memory code should align for (plus it gets rid of the split between 32- and 64-bit code paths).

hahnjo avatar Aug 12 '22 07:08 hahnjo

Failures are unrelated.

pcanal avatar Aug 12 '22 21:08 pcanal