Skip to content

core: Disable check for already deleted object.#11334

Merged
pcanal merged 1 commit intoroot-project:masterfrom
pcanal:master-11330
Sep 28, 2022
Merged

core: Disable check for already deleted object.#11334
pcanal merged 1 commit intoroot-project:masterfrom
pcanal:master-11330

Conversation

@pcanal
Copy link
Copy Markdown
Member

@pcanal pcanal commented Sep 8, 2022

On some platform operator delete taints the memory, so even right after the deletion the information stored by ~TObject is already erased. On those platform we no longer rely on the kNotDelete bit hack and rely on the system (which has tainted the memory assumingly for a reason) to detect the use-after-delete problems.

Introduce 2 new functions.

TObject::IsDestructed (used by TClonesArray) that detects that the destructor has been run and is active in all configuration. This should be used if the code knows that the memory has not been freed/deleted.

ROOT::Detail::HasBeenDeleted(TObject*) with returns true if the platform does not taint the memory and if the kNotDeleted is not set (in all other case, it returns false)

This fixes #11330

@phsft-bot
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

@phsft-bot
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

@pcanal pcanal changed the title core: Disable test for already deleted object. core: Disable check for already deleted object. Sep 9, 2022
@phsft-bot
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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
Copy link
Copy Markdown

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

@root-project root-project deleted a comment from phsft-bot Sep 9, 2022
@root-project root-project deleted a comment from phsft-bot Sep 9, 2022
@root-project root-project deleted a comment from phsft-bot Sep 9, 2022
@root-project root-project deleted a comment from phsft-bot Sep 9, 2022
@root-project root-project deleted a comment from phsft-bot Sep 9, 2022
@root-project root-project deleted a comment from phsft-bot Sep 9, 2022
@root-project root-project deleted a comment from phsft-bot Sep 9, 2022
@root-project root-project deleted a comment from phsft-bot Sep 9, 2022
@phsft-bot
Copy link
Copy Markdown

@phsft-bot
Copy link
Copy Markdown

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2022-09-09T01:51:17.373Z] C:\build\workspace\root-pullrequests-build\build\bin\libNet.dll : fatal error LNK1120: 1 unresolved externals [C:\build\workspace\root-pullrequests-build\build\net\net\Net.vcxproj]
  • [2022-09-09T01:55:10.720Z] C:\build\workspace\root-pullrequests-build\build\bin\libHist.dll : fatal error LNK1120: 1 unresolved externals [C:\build\workspace\root-pullrequests-build\build\hist\hist\Hist.vcxproj]

Copy link
Copy Markdown
Member

@Axel-Naumann Axel-Naumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's talk :-)

@phsft-bot
Copy link
Copy Markdown

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

@pcanal
Copy link
Copy Markdown
Member Author

pcanal commented Sep 13, 2022

The code was updated to replace the MockTObject with friendship.

@phsft-bot
Copy link
Copy Markdown

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

Errors:

  • [2022-09-13T19:20:49.937Z] stderr: error: Failed to merge in the changes.
  • [2022-09-13T19:20:56.504Z] CMake Error at /home/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1088 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11/cxx14.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2022-09-13T19:21:00.004Z] CMake Error at /Users/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1088 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu18.04/nortcxxmod.
Running on sft-ubuntu-1804-2.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2022-09-13T19:21:01.447Z] stderr: error: Failed to merge in the changes.
  • [2022-09-13T19:21:06.119Z] CMake Error at /mnt/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1088 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-ubuntu2004/python3.
Running on root-ubuntu-2004-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2022-09-13T19:20:58.541Z] stderr: error: Failed to merge in the changes.
  • [2022-09-13T19:21:06.414Z] CMake Error at /home/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1088 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Errors:

  • [2022-09-13T19:21:02.003Z] stderr: error: Failed to merge in the changes.
  • [2022-09-13T19:21:23.927Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1088 (message):

@phsft-bot
Copy link
Copy Markdown

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
Copy link
Copy Markdown

Build failed on ROOT-ubuntu2004/python3.
Running on root-ubuntu-2004-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1015/cxx17.
Running on macitois21.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@pcanal pcanal requested a review from Axel-Naumann September 15, 2022 17:53
Copy link
Copy Markdown
Member

@Axel-Naumann Axel-Naumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But see comments

@phsft-bot
Copy link
Copy Markdown

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
Copy link
Copy Markdown

Build failed on mac11/cxx14.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-09-20T20:36:35.738Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'N' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
  • [2022-09-20T20:36:35.738Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'N' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
  • [2022-09-20T20:36:35.738Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'iStride' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
  • [2022-09-20T20:36:35.738Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'iStride' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]

Failing tests:

@phsft-bot
Copy link
Copy Markdown

Build failed on mac1015/cxx17.
Running on macitois22.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-09-21T03:34:25.893Z] /Volumes/HD2/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'N' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
  • [2022-09-21T03:34:25.894Z] /Volumes/HD2/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'N' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
  • [2022-09-21T03:34:25.894Z] /Volumes/HD2/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'iStride' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
  • [2022-09-21T03:34:25.894Z] /Volumes/HD2/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'iStride' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]

@pcanal
Copy link
Copy Markdown
Member Author

pcanal commented Sep 21, 2022

@phsft-bot build

@phsft-bot
Copy link
Copy Markdown

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

On some platform operator delete taints the memory, so even right after the deletion the information
stored by ~TObject is already erased.  On those platform we no longer rely on the kNotDelete bit hack
and rely on the system (which has tainted the memory assumingly for a reason) to detect the
use-after-delete problems.

Introduce 2 new functions.

TObject::IsDestructed (used by TClonesArray) that detects that the destructor has been run and is
active in all configuration.  This should be used if the code knows that the memory has not been
freed/deleted.

ROOT::Detail::HasBeenDeleted(TObject*) with returns true if the platform does not taint the memory
and if the kNotDeleted is not set (in all other case, it returns false)

This fixes root-project#11330
@phsft-bot
Copy link
Copy Markdown

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
Copy link
Copy Markdown

Build failed on mac11/cxx14.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Warnings:

  • [2022-09-21T15:16:22.573Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'N' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
  • [2022-09-21T15:16:22.573Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'N' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]
  • [2022-09-21T15:16:22.573Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'iStride' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
  • [2022-09-21T15:16:22.573Z] /Users/sftnight/build/workspace/root-pullrequests-build/root/tmva/sofie/inc/TMVA/ROperator_Softmax.hxx:97:21: warning: variable 'iStride' is used uninitialized whenever '&&' condition is false [-Wsometimes-uninitialized]

@phsft-bot
Copy link
Copy Markdown

Build failed on windows10/cxx14.
Running on null:C:\build\workspace\root-pullrequests-build
See console output.

Failing tests:

@pcanal
Copy link
Copy Markdown
Member Author

pcanal commented Sep 22, 2022

@phsft-bot build

@phsft-bot
Copy link
Copy Markdown

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

@eguiraud eguiraud removed their request for review September 27, 2022 14:48
@pcanal pcanal merged commit 94a44fe into root-project:master Sep 28, 2022
@pcanal pcanal deleted the master-11330 branch September 28, 2022 01:00
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.

[core] kNotDeleted mechanism is broken on some platforms

4 participants