Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp1239217ybm; Sat, 30 May 2020 03:00:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbdRGGsdGGLR3zlBlpapVafLrWR2ayqt7VRI0vSYl+JR/19VY45RoogM5YU09ERHl1+0mu X-Received: by 2002:a17:906:f257:: with SMTP id gy23mr757341ejb.370.1590832810735; Sat, 30 May 2020 03:00:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590832810; cv=none; d=google.com; s=arc-20160816; b=XXSpLaz/DRP0FmuorIxK4pRhJU6efSJuswgL8fQsp8123q2sLUsUvu0Ak7hCQRoWVl nu6DUCEDPpw3M5AcaQ6Kbhx93Vu1fUs7tjgrt8Oa34bZKWv63sHGtZE715lsuyLzFQSY Sn/O9uI7ufaq3eo6EYYwrC3HBgzHlpy4/jBNJWi6j+6WQUeUSfIuWGSwUDhPtEKa/8CH oeKImGfmnEl1mShushJYbuLOkNeVNrUwQNlnJCRO4wNxs6QkoiETDvEjl5xgizPJZPEg MfPxW+ArE/tj+pTLwWy6m7+Bo+KincENSsR/VWtlzLCtdZs5d+tt0D/kKrnrnZa3D8+H j7Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=cBcEnrulZ9PW2EfvVyhUKH4A/3W+T5ttpIG+e4oPxv8=; b=o/tPlCbdlUt1IDIRGDu/JBnMKOLx92aQYegLFk/B50kG2B8c70vVsmmPJCfaW8C0oH IXknfSXBqbdlnbLNWUaZD+r52qgFG5642YpTJkzgbQAobswRbEGkyFnTQyI02sDY1a23 59I0ysPg1akgOwFHjAQ/nsIbgPXmSJocOZyhKw/nqKZR6WSWU0rCwZ57X41hC1uvLdWB SdtFd688IGrDSLSloqirPMbrp7YjEywV6vS8KyQYKeWPvqjW4oNpV5ppm/l1opIMEHG1 WM6rUDR32yFo+L/IKfxrwI9g/uWi7xWO9//2xUJ3ryztoSXd/xqNO8tv7PQt5LzbTGRp aXZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z6si7462686ejb.147.2020.05.30.02.59.48; Sat, 30 May 2020 03:00:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729055AbgE3J5u (ORCPT + 99 others); Sat, 30 May 2020 05:57:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728990AbgE3J5e (ORCPT ); Sat, 30 May 2020 05:57:34 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5756DC03E969; Sat, 30 May 2020 02:57:34 -0700 (PDT) Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1jeyF4-0002sH-0m; Sat, 30 May 2020 11:57:26 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id 9537E1C0489; Sat, 30 May 2020 11:57:22 +0200 (CEST) Date: Sat, 30 May 2020 09:57:22 -0000 From: "tip-bot2 for Lai Jiangshan" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/entry] x86/hw_breakpoint: Prevent data breakpoints on per_cpu cpu_tss_rw Cc: Lai Jiangshan , "Peter Zijlstra (Intel)" , Thomas Gleixner , x86 , LKML In-Reply-To: <20200526014221.2119-4-laijs@linux.alibaba.com> References: <20200526014221.2119-4-laijs@linux.alibaba.com> MIME-Version: 1.0 Message-ID: <159083264246.17951.4135007103117136248.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/entry branch of tip: Commit-ID: 9a06f99a03a0f961047bbae4ee80ce9265757bfe Gitweb: https://git.kernel.org/tip/9a06f99a03a0f961047bbae4ee80ce9265757bfe Author: Lai Jiangshan AuthorDate: Fri, 29 May 2020 23:27:31 +02:00 Committer: Thomas Gleixner CommitterDate: Sat, 30 May 2020 10:00:06 +02:00 x86/hw_breakpoint: Prevent data breakpoints on per_cpu cpu_tss_rw cpu_tss_rw is not directly referenced by hardware, but cpu_tss_rw is accessed in CPU entry code, especially when #DB shifts its stacks. If a data breakpoint would be set on cpu_tss_rw.x86_tss.ist[IST_INDEX_DB], it would cause recursive #DB ending up in a double fault. Add it to the list of protected items. Signed-off-by: Lai Jiangshan Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Thomas Gleixner Link: https://lkml.kernel.org/r/20200526014221.2119-4-laijs@linux.alibaba.com Link: https://lkml.kernel.org/r/20200529213320.897976479@infradead.org --- arch/x86/kernel/hw_breakpoint.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index f859095..f311bbf 100644 --- a/arch/x86/kernel/hw_breakpoint.c +++ b/arch/x86/kernel/hw_breakpoint.c @@ -255,6 +255,15 @@ static inline bool within_cpu_entry(unsigned long addr, unsigned long end) if (within_area(addr, end, (unsigned long)get_cpu_gdt_rw(cpu), GDT_SIZE)) return true; + + /* + * cpu_tss_rw is not directly referenced by hardware, but + * cpu_tss_rw is also used in CPU entry code, + */ + if (within_area(addr, end, + (unsigned long)&per_cpu(cpu_tss_rw, cpu), + sizeof(struct tss_struct))) + return true; } return false;