chiark / gitweb /
string-util: rework memory_erase() to not use GCC optimize attribute (#3812)
authorMichael Biebl <mbiebl@gmail.com>
Wed, 27 Jul 2016 03:32:37 +0000 (05:32 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 5 Jul 2017 06:50:49 +0000 (08:50 +0200)
commitb3ba37e13ca5fda7de81196b87b12e069d563665
treee69bc287395a519304cd383b0e72a6a80a32bab9
parente4b8356a39a6afcc0b1439397f8c3790332def12
string-util: rework memory_erase() to not use GCC optimize attribute (#3812)

"#pragma GCC optimize" is merely a convenience to decorate multiple
functions with attribute optimize. And the manual has this to say about
this attribute:

  This attribute should be used for debugging purposes only. It
  is not suitable in production code.

Some versions of GCC also seem to have a problem with this pragma in
combination with LTO, resulting in ICEs.

So use a different approach (indirect the memset call via a volatile
function pointer) as implemented in openssl's crypto/mem_clr.c.

Closes: #3811
src/basic/string-util.c