Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753275AbcCGRR4 (ORCPT ); Mon, 7 Mar 2016 12:17:56 -0500 Received: from mail-ob0-f194.google.com ([209.85.214.194]:36752 "EHLO mail-ob0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752807AbcCGRRr (ORCPT ); Mon, 7 Mar 2016 12:17:47 -0500 MIME-Version: 1.0 In-Reply-To: References: Date: Mon, 7 Mar 2016 12:17:46 -0500 Message-ID: Subject: Re: [PATCH v2 07/10] x86/entry: Vastly simplify SYSENTER TF handling From: Brian Gerst To: Andy Lutomirski Cc: "the arch/x86 maintainers" , Linux Kernel Mailing List , Borislav Petkov , Oleg Nesterov , Andrew Cooper Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1049 Lines: 24 On Sun, Mar 6, 2016 at 12:52 AM, Andy Lutomirski wrote: > Due to a blatant design error, SYSENTER doesn't clear TF. As a result, > if a user does SYSENTER with TF set, we will single-step through the > kernel until something clears TF. There is absolutely nothing we can > do to prevent this short of turning off SYSENTER [1]. > > Simplify the handling considerably with two changes: > > 1. We already sanitize EFLAGS in SYSENTER to clear NT and AC. We can > add TF to that list of flags to sanitize with no overhead whatsoever. > > 2. Teach do_debug to ignore single-step traps in the SYSENTER prologue. What is wrong with the current method of clearing TF and setting TIF_SINGLESTEP on the first debug trap? This patch actually increases complexity because it has to check for a range of addresses rather than just the first instruction, plus it has to singlestep all the way through the SYSENTER prologue. Unless there is an actual issue with TIF_SINGLESTEP, I don't think this patch is an improvement. -- Brian Gerst