我正在通过 Undefined Behavior Sanitizer 运行一些更新。消毒剂正在产生一条我不太明白的消息:
kalyna.cpp:1326:61: runtime error: load of address 0x0000016262c0 with insufficient space for an object of type 'const uint32_t'
0x0000016262c0: note: pointer points here
20 8b c1 1f a9 f7 f9 5c 53 c4 cf d2 2f 3f 52 be 84 ed 96 1b b8 7a b2 85 e0 96 7d 5d 70 ee 06 07
^
有问题的代码试图通过触摸缓存行范围内的地址来使缓存定时攻击更加困难。第 1326 行是reinterpret_cast
:
// In KalynaTab namespace
uint64_t S[4][256] = {
...
};
...
// In library's namespace
const int cacheLineSize = GetCacheLineSize();
volatile uint32_t _u = 0;
uint32_t u = _u;
for (unsigned int i=0; i<256; i+=cacheLineSize)
u &= *reinterpret_cast<const uint32_t*>(KalynaTab::S+i);
为什么 santizier 声称 auint32_t u
没有足够的空间来容纳 a uint32_t
?
或者,我是否正确解析了错误消息?这就是sanitzier抱怨的事情吗?如果我解析不正确,那么消毒剂在抱怨什么?
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
$ gcc --version
gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)