Bug 205663
Summary: | AVX register corruption from signal delivery | ||
---|---|---|---|
Product: | Platform Specific/Hardware | Reporter: | Austin Clements (austin) |
Component: | x86-64 | Assignee: | platform_x86_64 (platform_x86_64) |
Status: | RESOLVED CODE_FIX | ||
Severity: | normal | CC: | alexander, anthony.louis.eden, bp, brho, cheetah-kbt, cks-kernelbugs, code, dvyukov, fweimer, gmarwan.berkani, grizzlyuser, ian, jbuchert+kbugs, josharian, ncopa, nrain.season2y, paul.richards, synixaco |
Priority: | P1 | ||
Hardware: | x86-64 | ||
OS: | Linux | ||
Kernel Version: | 5.2 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: | Reproducer |
Description
Austin Clements
2019-11-26 16:52:07 UTC
FYI, as mentioned, this only happens when the kernel is compiled with GCC 9. The file that matters is arch/x86/kernel/fpu/signal.c. The difference seems to be that with GCC 9 the address of the thread-local variable used for test_thread_flag is cached across the function. With GCC 8 the address of the variable is reloaded each time the variable is referenced. If the retry loop that calls fault_in_pages_writeable can cause a change in kernel threads, then with GCC 9 the call to test_thread_flag in the second and subsequent loop iterations may look at the wrong thread flag. I don't know if this is the problem but it seems worth mentioning. I can confirm that the patch posted by Sebastian Andrzej Siewior at https://lkml.org/lkml/2019/11/27/304 fixes the issue both in our C reproducer and in our original Go reproducer. (Sorry, I'm not subscribed to LKML, so I can't reply there, and I'm on an airplane, so it's hard to get subscribed :) Regarding the question about the "Debugged-by" line in the patch, debugging was a joint effort between myself (Austin Clements <austin@google.com>), David Chase <drchase@golang.org>, and Ian Lance Taylor <ian@airs.com>. Fix queued on its way upstream: https://git.kernel.org/tip/59c4bd853abcea95eccc167a7d7fd5f1a5f47b98 Thanks to everyone involved! |