analyzer icon indicating copy to clipboard operation
analyzer copied to clipboard

Fix regression tests with fortify source

Open sim642 opened this issue 3 years ago • 1 comments

Using _FORTIFY_SOURCE (and the optimization required for it), regression tests can be run with:

gobopt='--set pre.cppflags[+] -D_FORTIFY_SOURCE=2 --set pre.cppflags[+] -O3' ./scripts/update_suite.rb

I used these options to debug MacOS failures following #696, since apparently MacOS seems to do some fortification by default (and thus use alternative built-in bounds-checked versions of some special functions using macro definitions).

Failures

As of writing, this causes 8 tests to fail:

  • [ ] 04/71 memset_direct_rc
  • [ ] 18/04 no-open
  • [ ] 18/05 open-mode
  • [ ] 18/11 2if
  • [ ] 18/20 loop-close
  • [ ] 18/21 for-i
  • [ ] 18/27 open-error
  • [ ] 18/33 multi-ptr-open

TODO

  • [ ] Add (unlocked?) CI job to run tests also with fortification on Linux

sim642 avatar Apr 27 '22 10:04 sim642

04/71 memset_direct_rc is just because the the fortified version replaces memset with a macro that calls an inline function instead, so the race location ends up being there, not where the macro was expanded from. Not sure if there's anything to do about that.

The fileUse analysis ones are probably because it doesn't handle some _chk versions of the functions.

sim642 avatar Apr 27 '22 10:04 sim642