UPSTREAM: x86/tls: Validate TLS entries to protect espfix

Installing a 16-bit RW data segment into the GDT defeats espfix.
AFAICT this will not affect glibc, Wine, or dosemu at all.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: stable@vger.kernel.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: security@kernel.org <security@kernel.org>
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: Ingo Molnar <mingo@kernel.org>

BUG=chromium:439158
TEST=lumpy build & boot, sigreturn PoC runs without failures

(cherry picked from commit 41bdc78544b8a93a9c6814b8bbbfef966272abbe)
Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-on: https://chromium-review.googlesource.com/236052
Tested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Commit-Queue: Aviv Keshet <akeshet@chromium.org>

(cherry picked from ToT)
Signed-off-by: Kees Cook <keescook@chromium.org>
Change-Id: I6b0777aad884a30937bc4d123de346314425a402
Reviewed-on: https://chromium-review.googlesource.com/236905
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
1 file changed