Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp185421imu; Mon, 26 Nov 2018 09:32:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/WwySbLo81IF8+nPcfIRUWyRmxgqzNjejyO0EwgA815KsdVojWKlYW08OnX7O6HA5gKDvQE X-Received: by 2002:a63:1d1d:: with SMTP id d29mr24517307pgd.49.1543253532389; Mon, 26 Nov 2018 09:32:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543253532; cv=none; d=google.com; s=arc-20160816; b=f8laWnnG2qWP9xUrNLquf+BgPIB01rJY/1MOINfuPCXGW8bzj9pc6pc1JlG5VHvyDJ dUkF5aF46cYDGkrSdsQn1JZA5BiDBfzInySylV2MQGAYS1PqxhP+Fvi3nIPB7AFNhv7B U5Uh9t934RIuZi5FQl4hRHyf8gZRshqp6A0CuepNlKBW0TtC1tWR5w12oSkW6DT1G9ET uf8bbZ0gvlC0xGyEQNluxJGAm6xMFudZpk1jltnL5ZO8CFX/Yl4nsACnaYO1n0FRBi9/ 2dN7UxBPKX9QyJNZ2NZb9FhvP+dJCGKbl9z6ZO2wxcSwU9LZ+NQQFtg7khPih5bxGtdS 3fRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:mime-version :message-id:date:dkim-signature; bh=2uvYqwo8b0d15h+35lgIxvtd3vHLDG6JsoJ+bhXgr5M=; b=qXTRG0RZpLKt9LRNZnwRilupn1dIkjIg08fOu3nFbvu7W1ndJYxUUKH16QMkylemra OylxfficsyJChKMH7UdeWQ2LN4mUGCIteMt4LRvVDUPy0WvdgY1q4fruyVpK05ZAHdSJ rAUbMjJQT3rYUvUJNgD9eWTgzd7Lv0KwrVtYP1nyzRob147lyBqe7qYKMZ4D+mRASjB4 ag0RGzZxLr5pw5kwttJsbwXTZ+/0ixXUKIi8k4YvmL2q31LBBtBsXOp0mlhU1UF+3J1S K7H42CA2USCfl63crw8lPm2EMleJJAozdbZGPyNkkR/231x4qFJ/dNLZ+3oErvV6uorH OKLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=R3anh+9C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c3si790643pgi.370.2018.11.26.09.31.20; Mon, 26 Nov 2018 09:32:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=R3anh+9C; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726745AbeK0EWE (ORCPT + 99 others); Mon, 26 Nov 2018 23:22:04 -0500 Received: from mail-qk1-f201.google.com ([209.85.222.201]:32870 "EHLO mail-qk1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726255AbeK0EWE (ORCPT ); Mon, 26 Nov 2018 23:22:04 -0500 Received: by mail-qk1-f201.google.com with SMTP id 80so20096686qkd.0 for ; Mon, 26 Nov 2018 09:27:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=2uvYqwo8b0d15h+35lgIxvtd3vHLDG6JsoJ+bhXgr5M=; b=R3anh+9CYkNOdHKx/t0Js6QRHN0H3wJhaUFe39j7ELxRdo3kQLWljIhaXciPQkbp36 qtE9nmJmVCSfNaOBjyVx8qOy+M8Tx22ds74m1E6aHiu18x3q9oN6bGXpC1iAuv+8Pzjv U3v9E+c/1GwT/+dIDL+P6XQkPeirUpFOONDOn0zy+oU9H52e0Ry/WREvGDqoqzXs3NYy xeko7wlvYtG/hDLz7GRIZ4XFGjUSx/Y9k81qZ1gRXQ7Eyl2Ofb+y3YX74QEGyQkszEUD EXDlez6Aq1+rvv+JyXaeXHnkU5tuVDnq+N20kHfwhSlHJiRjQ9LKo5srhDUMat8omQDb mtJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=2uvYqwo8b0d15h+35lgIxvtd3vHLDG6JsoJ+bhXgr5M=; b=FBw+Vn4yPms3rWeoFjkDt8AVjapBoKFnHRcLPj8lvpxCA72t48LWCL+OOPmx0ZvjHc OO7NU1Ea9VA1uxbxc4AcIHcW+feF/SGyBVcXgdKRRZCrrFKVa9tVdtgj7khRATMhcRA4 AjQxYh7ku/UrO98cmlf8QJrTTJsZiEH36E4pXtbjIhfqw3tRCZ1uRmbawtc4bprattKv E6S2Q+k56acP18oNfvmiYWNa2KoDqoRd1awfQd2bA9hWt3pyk/KJfI+X9AMJ/+gARcnq JJ62fY0wsHh7DswArjaz7QQbCVzlwIPvaoL+7B3Qk29I4u0hoNPYawTQ4HzOJV1RwJfq dqwQ== X-Gm-Message-State: AGRZ1gLL9zX0KPfCgb5Po7SDY0Mr/hdQqFitPCJkCWPdteiQbiuyWZ1A /0/O9b9Rvz8Ng1GcX/BUsQ5E3Fa5xQ== X-Received: by 2002:aed:23fd:: with SMTP id k58mr17514268qtc.39.1543253237335; Mon, 26 Nov 2018 09:27:17 -0800 (PST) Date: Mon, 26 Nov 2018 18:27:06 +0100 Message-Id: <20181126172706.184008-1-jannh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c-goog Subject: [PATCH] x86/fpu: XRSTOR is expected to raise #GP From: Jann Horn To: Thomas Gleixner , Ingo Molnar , Borislav Petkov , jannh@google.com Cc: Sebastian Andrzej Siewior , Andy Lutomirski , kernel-hardening@lists.openwall.com, "Naveen N. Rao" , linux-kernel@vger.kernel.org, "H. Peter Anvin" , x86@kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 75045f77f7a7 ("x86/extable: Introduce _ASM_EXTABLE_UA for uaccess fixups") incorrectly replaced the fixup entry for XSTATE_OP with a user-#PF-only fixup. However, XRSTOR can also raise #GP when the supplied address points to userspace memory. Change it back. Reported-by: Sebastian Andrzej Siewior Fixes: 75045f77f7a7 ("x86/extable: Introduce _ASM_EXTABLE_UA for uaccess fixups") Signed-off-by: Jann Horn --- arch/x86/include/asm/fpu/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h index 5f7290e6e954..69dcdf195b61 100644 --- a/arch/x86/include/asm/fpu/internal.h +++ b/arch/x86/include/asm/fpu/internal.h @@ -226,7 +226,7 @@ static inline void copy_fxregs_to_kernel(struct fpu *fpu) "3: movl $-2,%[err]\n\t" \ "jmp 2b\n\t" \ ".popsection\n\t" \ - _ASM_EXTABLE_UA(1b, 3b) \ + _ASM_EXTABLE(1b, 3b) \ : [err] "=r" (err) \ : "D" (st), "m" (*st), "a" (lmask), "d" (hmask) \ : "memory") -- 2.20.0.rc0.387.gc7a69e6b6c-goog