Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2305194pxb; Fri, 17 Sep 2021 06:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRzNV893KOEucS+Yb8vA5xVzBI2C6ciZ+DNpGFLnH8zJX+XmIuj6X5pd51naQiTfHJssK/ X-Received: by 2002:a05:6402:897:: with SMTP id e23mr12768807edy.366.1631887118606; Fri, 17 Sep 2021 06:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631887118; cv=none; d=google.com; s=arc-20160816; b=YMTTk/IjGTpSlldWVMpf/V9ByPruyC5jD7hmajCLYBi9cx8TVHL/tB3EdtsIttDe7I G1b9aF6reM4Xo77M43KdREjQVuwe4Q1ALrLm1TxrflyQywbpA7zt02cEeIAcowo8VnQk Y4926JzD/dLZUbVJfTdJnqjCDY1pVdQ3okgbNxXy0TUFvNbsFRaeMfgawp40kpjhQ8rf 1FCn/FL9pWjg0W1EpNwpN6aQPm4vV4E81sOdw2Vz/1/EuVhqxuT7ZW0LqcmTOTtpfK4r HmImCQu/H9eGskU8pdhoNaQrZ7WFoVpVEXxt5gNAwkx2/m0YALBqBH3HrsaQQok78S6R lujA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=ld2o6zZK0OVuVhEFfg2/2mMyUsX2dhU9nHxj5zadJPQ=; b=JN3rzKsIKayPFfl7FKt+ZYWlgbwEZq5Ejio8XIK5pqcYDiU5UIC5be4NNdf5Pdddyv QTv4LKNIvIv/+/AJd+HYBrdsV4DtfD6q4bOMBxoSMzrb4w9Wea7gOclcZxZOQXbNLY4E 0IWrNt53TsUk91I3Dj8CQWh+wIzuaZ/sRGTKudleJrZQYZxEFenM9nY9l1AM52arExj7 s1LGZn0bNgJuduxaoJ1ee4EDyqiFWv5QcaY8cWNdnCYIQvHj3aInozUKETaxHEuPYOSR dYR+P9rXKGFgPQWvyjavuonbW+oaiXUQQW0fxpjCLZ6Pf2Tx5MZ8+L5rrmvVgwWaVviU TA6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BwV0qJCn; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w10si8782012ejv.584.2021.09.17.06.58.14; Fri, 17 Sep 2021 06:58:38 -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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BwV0qJCn; dkim=neutral (no key) header.i=@linutronix.de; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343652AbhIQKmI (ORCPT + 99 others); Fri, 17 Sep 2021 06:42:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231364AbhIQKmI (ORCPT ); Fri, 17 Sep 2021 06:42:08 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50655C061574 for ; Fri, 17 Sep 2021 03:40:46 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1631875243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ld2o6zZK0OVuVhEFfg2/2mMyUsX2dhU9nHxj5zadJPQ=; b=BwV0qJCnvIZAw4VrpMaO5od5CWTtv36FqP20MIwVfhB/18swgbUwKKPfS5pN4WqmIeyEBv 73Pn6dSVEeIHifj7zJZy0ioipMVRitjkhQksTEzv+/5zYgWzXHmvkf3dqD9EfGpdBcPKyf ayXjL38BV3SIFj5dM7ITq9OnoCd+pxZkFEGDxH5CC9p5usYw2xuXDlzI7vA7DuVbyUaj/1 MhS6TXA5lagKBrtvJZYJwnVyrEM4baGHaLf8Ckhv2mNtAdUGIIf/F78WgTnwTyx9SMrVSD RCF/KvtWu1A6mAYJZteU6d+MabjisM6UzwNyV1ZljHsI/D7Qcx6Mtk3E/v9ksQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1631875243; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ld2o6zZK0OVuVhEFfg2/2mMyUsX2dhU9nHxj5zadJPQ=; b=HazHRQ0v3z+ZjuPXcfNL1xAwODsrzm8BkxqHp09vG54Uolfsn84OAE7oYI+62e8MoPsqAR YUoF4wHHcQLMxwCQ== To: Peter Zijlstra , Ondrej Zary Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Linus Torvalds Subject: Re: [PATCH] x86/iopl: Fake iopl(3) CLI/STI usage In-Reply-To: References: <202109151423.43604.linux@zary.sk> <202109162227.17415.linux@zary.sk> <20210916210509.GG4323@worktop.programming.kicks-ass.net> <202109171011.31916.linux@zary.sk> Date: Fri, 17 Sep 2021 12:40:43 +0200 Message-ID: <87pmt78oyc.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 17 2021 at 11:20, Peter Zijlstra wrote: > Subject: x86/iopl: Fake iopl(3) CLI/STI usage > From: Peter Zijlstra > Date: Thu, 16 Sep 2021 23:05:09 +0200 > > Since commit c8137ace5638 ("x86/iopl: Restrict iopl() permission > scope") it's possible to emulate iopl(3) using ioperm(), except for > the CLI/STI usage. > > Userspace CLI/STI usage is very dubious (read broken), since any > exception taken during that window can lead to rescheduling anyway (or > worse). The IOPL(2) manpage even states that usage of CLI/STI is highly > discouraged and might even crash the system. > > Of course, that won't stop people and HP has the dubious honour of > being the first vendor to be found using this in their hp-health > package. > > In order to enable this 'software' to still 'work', have the #GP treat > the CLI/STI instructions as NOPs when iopl(3). Warn the user that > their program is doing dubious things. > > Fixes: a24ca9976843 ("x86/iopl: Remove legacy IOPL option") > Reported-by: Ondrej Zary > Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Thomas Gleixner