Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4018348ybg; Fri, 25 Oct 2019 12:09:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuKhOmiiPCCjrV13eH6SuXWBrQoozBYzXB6+/7mY4IUeeEUGcs3r+2iMmedU1WjH1e8bLX X-Received: by 2002:a17:906:4554:: with SMTP id s20mr5060296ejq.283.1572030590980; Fri, 25 Oct 2019 12:09:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572030590; cv=none; d=google.com; s=arc-20160816; b=wpjmUZi8nto6Dh0Fmn8avRsKbT0Junr/UwdCc6tTWgH76Ux2eKxklmEgi1n/P/jGOH Rr5NXWpYkmXeUnQhPGAy8irLMX7SwIIDcxXxcHdqlpTJWwBA30JzgDrlBy2yksvr//xX GT3YIWi47ZHc8L2vj56V0vuTBRqoRk9AA145HPhHlLLeUyrow3PY0D//9UDhH2k2e1Qu 2tvWqtIPd8pABuZT9onUvUSb/gjbTuaJB6xLtX3dS8HovyP9i8XK+4ohCBK8z6eUV8cE +6izvh9Xeu0WRUmlgL/kRuXh0N2U/UMJaMVFiSDOKF3Hxet6FtblmDWlSxAFUfaWaLIX Yt7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZtBs1/l6mBDyZtFIn5CV1kjtXQutizfGl/4BYEKqk5s=; b=N7qN3TLUltv45d1DTuIZ7MBRdMKvsCGpZLPXg8ODuiDtiTJouSdTd0+HKFahKoQ7dF alCtqVZR2h6wYRMollaYactDJjxe7tyr80f59ziwUhnxR2KHt7hwWG6j0DuAHziIdzBx 8ctF8SmYgLT1dYCy105jl2MAKX0T0uTM67DhFr5/dBcoVwQZzlV1Z/M+XCmcPIqnZrnx 0Gt2ziDTqFqPwll8xeEaL3hA1t8ZTNUpKnKgKC06mBMkUnF+MtT9K70hSbj5xsRTvl9N GMHZicfJUtBQ9tQjyv+3+iQ4xxucLOGjNNSZBebq4p0oD2n6E5Bud/bUVSoZi1hQxToy xk/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="cr/AzgsU"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si1713358ejx.102.2019.10.25.12.09.27; Fri, 25 Oct 2019 12:09:50 -0700 (PDT) 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=fail header.i=@infradead.org header.s=merlin.20170209 header.b="cr/AzgsU"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728968AbfJXVVN (ORCPT + 99 others); Thu, 24 Oct 2019 17:21:13 -0400 Received: from merlin.infradead.org ([205.233.59.134]:32874 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728941AbfJXVVN (ORCPT ); Thu, 24 Oct 2019 17:21:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZtBs1/l6mBDyZtFIn5CV1kjtXQutizfGl/4BYEKqk5s=; b=cr/AzgsUHzuuLdrtAYldm3B0z ZUT3crSYPW7skGAja72go1Gn3JmrRIDYXYdAUYoSdD/Fqwht/8/D4FplLIjNFbb341N9xhlYauKBj 26VLTellYCz1U3ReG+1izW9JrXvkY7GtBtMhPfIao8PAe/C+n6ln+abjjL0JTC+no/chVBJHI2GKJ EdYED71cXcjq6cyQuENIqBbIDxGS6qx2anCLbGdOdqHPcpR0Aislg6PTUeVnhoCLa8KsBvukT5Cml sKXcryyI5fnDIBdHtpcUkzJ+OvZWWtTTqnuoCzObmdqXNiqlfKWwbiQJEcchp/6jEkNsKyyCOygUe z+AGtug8w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iNkXb-0004gG-3p; Thu, 24 Oct 2019 21:21:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id CE337300EBF; Thu, 24 Oct 2019 23:20:06 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 719D02100B87C; Thu, 24 Oct 2019 23:21:05 +0200 (CEST) Date: Thu, 24 Oct 2019 23:21:05 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: Andy Lutomirski , Josh Poimboeuf , LKML , X86 ML , Will Deacon , Paolo Bonzini , kvm list , linux-arch , Mike Rapoport , Miroslav Benes Subject: Re: [patch V2 07/17] x86/entry/64: Remove redundant interrupt disable Message-ID: <20191024212105.GY4114@hirez.programming.kicks-ass.net> References: <20191023122705.198339581@linutronix.de> <20191023123118.296135499@linutronix.de> <20191023220618.qsmog2k5oaagj27v@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 24, 2019 at 10:52:59PM +0200, Thomas Gleixner wrote: > is just undefined behaviour and I personally consider it to be a plain bug. I concur. > Just for the record: This results in running a resulting or even completely > unrelated signal handler with interrupts disabled as well. > > Whatever we decide it is, leaving it completely inconsistent is not a > solution at all. The options are: > > 1) Always do conditional tracing depending on the user_regs->eflags.IF > state. > > 2) #1 + warn once when syscalls and exceptions (except NMI/MCE) happen > and user_regs->eflags.IF is cleared. > > 3a) #2 + enforce signal handling to run with interrupts enabled. > > 3b) #2 + set regs->eflags.IF. So the state is always correct from the > kernel POV. Of course that changes existing behaviour, but its > changing undefined and inconsistent behaviour. > > 4) Let iopl(level) return -EPERM if level == 3. > > Yeah, I know it's not possible due to regressions (DPKD uses iopl(3)), > but TBH that'd be the sanest option of all. > > Of course the infinite wisdom of hardware designers tied IN, INS, OUT, > OUTS and CLI/STI together on IOPL so we cannot even distangle them in > any way. > > The only way out would be to actually use a full 8K sized I/O bitmap, > but that's a massive pain as it has to be copied on every context > switch. > > Really pretty options to chose from ... If 4 is out (and I'm afraid it might be), then I'm on record for liking 3b.