Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp744747ybx; Thu, 7 Nov 2019 02:02:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzTUoWuiEa5BIrv+RJun4twHMFsTzEIT8cNpU7PR46jqQMpWP+m8NTBfe6K+37SnhDH/JWS X-Received: by 2002:a17:906:80c:: with SMTP id e12mr2156481ejd.59.1573120948575; Thu, 07 Nov 2019 02:02:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573120948; cv=none; d=google.com; s=arc-20160816; b=iqoaQYjZSr6LHGzt12VtA3cq3t+UgoZLvLtSZrhCYytFOEiOHsnBd/NP3bxuDOdlNW YTdk5VDkGTNQqabrYd8ya3cQwUEUUO+2r6V3uLyTgNMjvcidJKPzMLugQjuqCw8zvdMT +VMooC/vJLcdJ7KNcYv7QrQu7aacOzFaY6jD5VuBM1g7iZbeI5J4R2YbePf2K2aI6xrZ wwBi5o3gDtMnc8rGQKP7Pjn4EZtecN0rwsN+2tvrp4EvzDM7HkPqmnGdr22eCBd7TNzX Xk5uIqf/ue+3x/M+sYe6TrZRlgupwVaeVYKzGSEDHMs30cirLpHZgrGm1Qm3flWjfnlr fG5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=kXa57t27t34cWAqp0eTOOzty83onLqxo0D7gE/Fo4g8=; b=JmKeLdnJdOp27dBFHn2+U95m6/kHY6bcxa/eqM23rgk2HcgDOcUkcM/U4qPYotgV6j UbHTEaG89XQUe4y3pZ1QnGG0rVGiUxZ9jYohcsidR69YAwH4hsEMrqGotx1WLSl2P1KO /2Pf2sCJSMbM0qUARZ69Xm7UkW7ggjY5OIFEhJ5j/vFjOtLtsqZYBUlqhXPT2oNxMvGK /SaUc4+m2wQyqxghxEOoKhYl2kR8Uu/ggnjTKVjkw3RVFg16U6chlW8rtbPeTix8cc7T TpNpnFVJnNRvdc+r+FBvXM/Ag/+smdJlBTWkfPbGiFOpQHrCAdDmsHUkzPJNPchoUn44 4gIg== ARC-Authentication-Results: i=1; mx.google.com; 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 w18si1071524ejv.378.2019.11.07.02.01.53; Thu, 07 Nov 2019 02:02:28 -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; 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 S2387996AbfKGKAe (ORCPT + 99 others); Thu, 7 Nov 2019 05:00:34 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:47027 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387659AbfKGKAe (ORCPT ); Thu, 7 Nov 2019 05:00:34 -0500 Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iSeaa-0002nO-I8; Thu, 07 Nov 2019 11:00:28 +0100 Date: Thu, 7 Nov 2019 11:00:27 +0100 (CET) From: Thomas Gleixner To: Willy Tarreau cc: Ingo Molnar , Linus Torvalds , LKML , the arch/x86 maintainers , Stephen Hemminger , Juergen Gross , Sean Christopherson , "H. Peter Anvin" Subject: Re: [patch 5/9] x86/ioport: Reduce ioperm impact for sane usage further In-Reply-To: <20191107091704.GA15536@1wt.eu> Message-ID: References: <20191106193459.581614484@linutronix.de> <20191106202806.241007755@linutronix.de> <20191107082541.GF30739@gmail.com> <20191107091704.GA15536@1wt.eu> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 7 Nov 2019, Willy Tarreau wrote: > On Thu, Nov 07, 2019 at 09:25:41AM +0100, Ingo Molnar wrote: > > I.e. the model I'm suggesting is that if a task uses ioperm() or iopl() > > then it should have a bitmap from that point on until exit(), even if > > it's all zeroes or all ones. Most applications that are using those > > primitives really need it all the time and are using just a few ioports, > > so all the tracking doesn't help much anyway. > > I'd go even further, considering that any task having called ioperm() > or iopl() once is granted access to all 64k ports for life: if the task > was granted access to any port, it will be able to request access for any > other port anyway. And we cannot claim that finely filtering accesses > brings any particular reliability in my opinion, considering that it's > generally possible to make the system really sick by starting to play > with most I/O ports. So for me that becomes a matter of trusted vs not > trusted task. Then we can simply have two pages of 0xFF to describe > their I/O access bitmap. > > > On a related note, another simplification would be that in principle we > > could also use just a single bitmap and emulate iopl() as an ioperm(all) > > or ioperm(none) calls. Yeah, it's not fully ABI compatible for mixed > > ioperm()/iopl() uses, but is that ABI actually being relied on in > > practice? > > You mean you'd have a unified map for all tasks ? In this case I think > it's simpler and equivalent to simply ignore the values in the calls > and grant full perms to the 64k ports range after the calls were > validated. I could be totally wrong and missing something obvious > though. Changing ioperm(single port, port range) to be ioperm(all) is going to break a bunch of test cases which actually check whether the permission is restricted to a single I/O port or the requested port range. Thanks, tglx