串扰漏洞

近年来,有关英特尔处理器中各种漏洞的大量报告开始出现其中最著名的是Spectre和Meltdown,它们基于推测性命令执行的实现中的错误。2020年6月,出现了有关名为Crosstalk的新漏洞的消息

与上述漏洞不同,串扰是一个从一个核心到另一个核心的数据传输漏洞。因此,旨在克服内核中的推测性执行泄漏的漏洞保护程序无法防范串扰。要了解这种数据泄漏的本质,您需要知道什么是推测性指令执行,处理器管道如何工作以及如何在内核之间传输数据。让我们简要地谈谈每个主题。

投机计算

处理器对指令的推测执行是在指令级别检测并行性的硬件方法之一。同时为程序执行的多个路径进行计算。最简单的示例是条件分支中两个分支的推测性评估。

输送带

, , . , . , , . 16 . , 8 .

?

x86 . , . Vrije Universiteit Amsterdam , . , - MDS (Model-Specific-Registers) RDMSR WRMSR. . userspace CPUID, RDRAND RDSEED.

, DRNG , bootguard . Crosstalk , , , RDRAND RDSEED.

RDRAND RDSEED

RDRAND , digital random number generator (DRNG), . DRNG , . RDSEED , .. RNG.

, RIDL, , : Line Fill Buffer, Load Ports, Store Buffer.

Line Fill Buffer (LFB) L1 Cache ( ) - L1 Cache. , , , LFB . . LFB.

Store Buffer .

Load Ports I/O . , Load Ports .

Crosstalk

Crosstalk . , . , , , LFB, , . . , . , , , .

FLUSH + RELOAD

inline int probe(char *adrs) {
  volatile unsigned long time;

  asm __volatile__ (
    "  mfence             \n"
    "  lfence             \n"
    "  rdtsc              \n"
    "  lfence             \n"
    "  movl %%eax, %%esi  \n"
    "  movl (%1), %%eax   \n"
    "  lfence             \n"
    "  rdtsc              \n"
    "  subl %%esi, %%eax  \n"
    "  clflush 0(%1)      \n"
    : "=a" (time)
    : "c" (adrs)
    :  "%esi", "%edx");
  return time;
}

RIDL LFB, . FLUSH + RELOAD, ( ) FLUSH, , . - . , LFB. ( load), pagefault. , , LFB. , FLUSH + RELOAD. , . , , , . - , LFB.

CPUID

pid_t pid = fork();
if (pid == 0) {
    while (1)
        asm volatile(
            "mov %0, %%eax\n"
            "cpuid\n"
            ::"r"(CPUID_LEAF):"eax","ebx","ecx","edx");
}

for(size_t offset = BEGIN_OFFSET; offset < BEGIN_OFFSET + 4; ++offset) {
    // ...
    for(size_t i(0); i < ITERS; ++i) {
        flush(reloadbuffer);
        tsx_leak_read_normal(leak + offset, reloadbuffer);
        reload(reloadbuffer, results);
    }
}

, CPUID. . MDS. RIDL. . , . FLUSH + RELOAD , . , CPUID 4 , CROSSTALK. , CROSSTALK

. RDSEED. , RDSEED 0, . RDSEED . , , RDRAND RDSEED, - RDSEED. , . , . , , FLUSH + RELOAD.

, , , . , CPUID, . , RDRAND RDSEED , . , LFB. MDS , (hyperthread), , .

, . , , . , , . , , , RDRAND, RDSEED EGETKEY. , , , .

Crosstalk , , . MDS ( , ). , , - . , , . , , MDS.




All Articles