From patchwork Fri Jan 4 17:49:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 10748607 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56A5818A6 for ; Fri, 4 Jan 2019 17:49:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 480B128536 for ; Fri, 4 Jan 2019 17:49:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3CA4628581; Fri, 4 Jan 2019 17:49:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E68A28536 for ; Fri, 4 Jan 2019 17:49:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2554A8E00FC; Fri, 4 Jan 2019 12:49:53 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 16BF88E00AE; Fri, 4 Jan 2019 12:49:53 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F231A8E00FB; Fri, 4 Jan 2019 12:49:52 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by kanga.kvack.org (Postfix) with ESMTP id B0CA48E00AE for ; Fri, 4 Jan 2019 12:49:52 -0500 (EST) Received: by mail-pg1-f198.google.com with SMTP id f125so30907065pgc.20 for ; Fri, 04 Jan 2019 09:49:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=joJF368Np4hyYPGtZW0+tmh51hcAhGZud2aX7N6K1w4=; b=m2S70KLEqxz3AfRj3nYlRqFbyjTtBcFSWwlUAXum+XL59XJyQ8uK0X5JXXVxCgMXC0 njBo0i4LryALk+Zhon4+11xZG3KaG3KgMRPs+aiJtMGkW1JhfYsBaEcpwL5VFdjJuu+l n9b4J+iy1EYwx15jb6WqvAbQk7OXMRSVDM+64I1YYN1JDbl79kyD98Li5FjhJ1x9ZXDg NWeXzVmTxIpP3Lqr10A0qB2VzNlZvOXa80TlcFYh2acEp4NLGVxuKlIxM/DlEECL+vZY myGV93pKA29B8LMf0Ox3HAKP4MupsVkwsYL2NadPl+iGa+cQxiqoe3exi6NJYu7UGo6Q 0JaQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dave@ray.jf.intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=dave@ray.jf.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: AJcUuke1C4eKpGX3QvtYLViNyFnY7pl+bqDxOVBIjNB9NWM1C15xMLHR Ep7udi6kDwwk1pUATdamWAM6IwsV9cNByYw7RlYrae6lAMSXFDPu7BLqN8Tn59Xx0UJzNd7RacJ PLdTFT7rU95w74jKk9+CKDQhqPQp8H78s3KomeWKjbSzOCeh8VCzZYoTKB3SkUZhzjQ== X-Received: by 2002:a63:34c3:: with SMTP id b186mr2346295pga.184.1546624192300; Fri, 04 Jan 2019 09:49:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN4ePmq4YrMOqpK02cRzBk4YhAKmJZ21QGJjzkQD8QXxgfFiMfjH5XTSPBaYB2wuSbfag7lK X-Received: by 2002:a63:34c3:: with SMTP id b186mr2346261pga.184.1546624191402; Fri, 04 Jan 2019 09:49:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546624191; cv=none; d=google.com; s=arc-20160816; b=fxbFDwSbvtHG9CYNICLwA2+y1EywDLVXIglqaGjawdONpwBN27DrUNRt19pOv3E5iL KEkLaOLmGp3Z+Vg52LKg8lzyV39539gKiIxDxpXv4+tI1D63+a8wODmf62KmqWYsQdHQ VnhrsKJriwVjzFyLJQNZ4sY70XSu6ZLgFCL6Lu+4ZYRPK+0YwuIZpY/CKl/8CYjRmgmH sYtbzLPmjlUj2eQz66OT1nSM0zguMbaFn68tNJu9X0ryCarV0XYuR8D8PcQ4MMMelr4I h9lB5oP1EhrtAH4FKtnPhcB63L595e6VIrrAztXHnFtYozF1AMmo6zHADlC1kTMYsYQo tK6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=joJF368Np4hyYPGtZW0+tmh51hcAhGZud2aX7N6K1w4=; b=MCUYhB2kY4Bdv8uaqFiwf972jsVWxG+HtYB+1364GyNqG8nScfwDGiaMPjX7h+72Gj SS+bvXPntI8BSERZfnvdOWLAfZRzBqLBNkK2n37PAWbmeaL03ecA37PcPYkj9Ip9pNlM jhGCcwrActkQUe1+n14vVTY/uj9xLwQqCTk1+/Mbsa7lzvNV/ZE9fmzqVMW77GhQvybO b7ZBcFFYU/jCnbivz7WwOnyyzW/fpZ0cpxVaJM/AVWnDc3215w0aIc+0GY8QqTatKQP+ /UwhM0H9ncakaVMKYsSJlLgUgfDTb+Bpb2e+4APSudnss9c5VCalbeOyipgIk9qq8zw7 k08A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dave@ray.jf.intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=dave@ray.jf.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga02.intel.com (mga02.intel.com. [134.134.136.20]) by mx.google.com with ESMTPS id u69si17338498pfj.219.2019.01.04.09.49.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 09:49:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dave@ray.jf.intel.com designates 134.134.136.20 as permitted sender) client-ip=134.134.136.20; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dave@ray.jf.intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=dave@ray.jf.intel.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jan 2019 09:49:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,439,1539673200"; d="scan'208";a="105550121" Received: from unknown (HELO ray) ([10.251.0.234]) by orsmga006.jf.intel.com with ESMTP; 04 Jan 2019 09:49:50 -0800 Received: by ray (Postfix, from userid 1000) id 6B487E063E; Fri, 4 Jan 2019 09:49:50 -0800 (PST) From: Dave Hansen To: dave.hansen@intel.com Cc: x86@kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , Paolo Bonzini , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 2/5] x86/mpx: remove bounds exception code Date: Fri, 4 Jan 2019 09:49:40 -0800 Message-Id: <1546624183-26543-3-git-send-email-dave.hansen@linux.intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1546624183-26543-1-git-send-email-dave.hansen@linux.intel.com> References: <1546624183-26543-1-git-send-email-dave.hansen@linux.intel.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Dave Hansen MPX is being removed from the kernel due to a lack of support in the toolchain going forward (gcc). Remove the other user-visible ABI: signal handling. This code should basically have been inactive after the prctl()s were removed, but there may be some small ABI remnants from this code. Remove it. This, along with the prctl() removal is probably what we should apply first. Signed-off-by: Dave Hansen --- arch/x86/kernel/traps.c | 74 ------------------------------------------------- 1 file changed, 74 deletions(-) diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 9b7c4ca..85cccad 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c @@ -57,8 +57,6 @@ #include #include #include -#include -#include #include #include @@ -433,8 +431,6 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code) dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) { - const struct mpx_bndcsr *bndcsr; - RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU"); if (notify_die(DIE_TRAP, "bounds", regs, error_code, X86_TRAP_BR, SIGSEGV) == NOTIFY_STOP) @@ -444,76 +440,6 @@ dotraplinkage void do_bounds(struct pt_regs *regs, long error_code) if (!user_mode(regs)) die("bounds", regs, error_code); - if (!cpu_feature_enabled(X86_FEATURE_MPX)) { - /* The exception is not from Intel MPX */ - goto exit_trap; - } - - /* - * We need to look at BNDSTATUS to resolve this exception. - * A NULL here might mean that it is in its 'init state', - * which is all zeros which indicates MPX was not - * responsible for the exception. - */ - bndcsr = get_xsave_field_ptr(XFEATURE_MASK_BNDCSR); - if (!bndcsr) - goto exit_trap; - - trace_bounds_exception_mpx(bndcsr); - /* - * The error code field of the BNDSTATUS register communicates status - * information of a bound range exception #BR or operation involving - * bound directory. - */ - switch (bndcsr->bndstatus & MPX_BNDSTA_ERROR_CODE) { - case 2: /* Bound directory has invalid entry. */ - if (mpx_handle_bd_fault()) - goto exit_trap; - break; /* Success, it was handled */ - case 1: /* Bound violation. */ - { - struct task_struct *tsk = current; - struct mpx_fault_info mpx; - - if (mpx_fault_info(&mpx, regs)) { - /* - * We failed to decode the MPX instruction. Act as if - * the exception was not caused by MPX. - */ - goto exit_trap; - } - /* - * Success, we decoded the instruction and retrieved - * an 'mpx' containing the address being accessed - * which caused the exception. This information - * allows and application to possibly handle the - * #BR exception itself. - */ - if (!do_trap_no_signal(tsk, X86_TRAP_BR, "bounds", regs, - error_code)) - break; - - show_signal(tsk, SIGSEGV, "trap ", "bounds", regs, error_code); - - force_sig_bnderr(mpx.addr, mpx.lower, mpx.upper); - break; - } - case 0: /* No exception caused by Intel MPX operations. */ - goto exit_trap; - default: - die("bounds", regs, error_code); - } - - return; - -exit_trap: - /* - * This path out is for all the cases where we could not - * handle the exception in some way (like allocating a - * table or telling userspace about it. We will also end - * up here if the kernel has MPX turned off at compile - * time.. - */ do_trap(X86_TRAP_BR, SIGSEGV, "bounds", regs, error_code, 0, NULL); }