From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B9BAC433EF for ; Fri, 17 Sep 2021 10:40:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05782611CA for ; Fri, 17 Sep 2021 10:40:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343709AbhIQKmJ (ORCPT ); Fri, 17 Sep 2021 06:42:09 -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