Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp646292ybg; Fri, 12 Jun 2020 10:45:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMszUKPqfmbjyvIW/18U8jtgrL34Vl9NHjPr8u0hHuiFAYahMUUv7sU1LQ/f9yHJeHPV4c X-Received: by 2002:a17:906:7c58:: with SMTP id g24mr15058162ejp.205.1591983921957; Fri, 12 Jun 2020 10:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591983921; cv=none; d=google.com; s=arc-20160816; b=xvp0THVCM4DpCE8QGbsrHvs2RRDKbVGDPqqDj0gYUH+1HxbPYe5AEOFhW51owafdGb elBMmrSb/6OGmGU+WASaC9gAred7GNy7oTWhH8cUh+4YnrUgIYvQOxU9+6l/IZCDbc+O MsPSNTGURhsehFAeRXqx4s/+EwwBwjyVg6JFfr3cGGcZLEzgjr5IzmP0DLAwY4dVvXGq 20Luikqa4LgA3b2QA+dhWLSyIpxDXezqgY1xqMP/G1B4/9T9wiZreWUuPlrMvzUWtCdm zmCGV2PHniNXEr5ZLc2pbVlwOufHJ+yheNpH86uZquq7J0+YENi7UK493fs4H/8GanwM mOeQ== 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:ironport-sdr:ironport-sdr; bh=rhiLXzhibpk8OurMU1fqeByebmTk1oCM77SPU07Uji8=; b=oCpeF6/SEjFgvxsgwkrWsC3/3OZV5icuYrXRA98lwv2Nwts4HUdMx6+h+zwx+/63Il sudTNQCfbtkRMJpYZu3CGvAEPOt8lTGjpElSaEOE8vRE7N0CjxelS0m+dmsQjevOnYyJ hV6vlt7oE+/0/EpUPA6iAXbIsHoOn9wHmQWBGcsBkDD83tJhIYX02FON6Fi2uzl/kA69 4ykr4RRo96JZJnrLgmOiJObn1QkTzm3yycl8770JMiX7IYTOevto5OGIQhMMwqD3aDd9 BrJbe40GCs2A+WBcpxypw9G9YWZeUIept0+4CYB9msK4nKZcvkF+ZbRZdmXOORChdHHA Gmgw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d18si3849507edz.309.2020.06.12.10.44.58; Fri, 12 Jun 2020 10:45:21 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726272AbgFLRnJ (ORCPT + 99 others); Fri, 12 Jun 2020 13:43:09 -0400 Received: from mga17.intel.com ([192.55.52.151]:50155 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbgFLRnI (ORCPT ); Fri, 12 Jun 2020 13:43:08 -0400 IronPort-SDR: Gey2vFqDNLwq8mWskcfR2rYJ8SzcHHctWBJ3r70UIM/wn5Fixc08nisp91q/kXcapYbYc4qfR6 4YvLUtzkzIlw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2020 10:43:07 -0700 IronPort-SDR: 0Lbe9ZUz45hL+o9jfKw8BJKKb6Tbmv7wGJamhC/TkFjY7ubOLMpdOFLFnIfgrRMJzrdkE7Skjs fbNFXwlqHdbQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,504,1583222400"; d="scan'208";a="419537122" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.152]) by orsmga004.jf.intel.com with ESMTP; 12 Jun 2020 10:43:07 -0700 Date: Fri, 12 Jun 2020 10:43:07 -0700 From: Sean Christopherson To: Borislav Petkov Cc: x86-ml , Linus Torvalds , lkml Subject: Re: [RFC PATCH] x86/msr: Filter MSR writes Message-ID: <20200612174307.GD1026@linux.intel.com> References: <20200612105026.GA22660@zn.tnic> <20200612163406.GA1026@linux.intel.com> <20200612164602.GC22660@zn.tnic> <20200612165709.GB1026@linux.intel.com> <20200612170303.GD22660@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200612170303.GD22660@zn.tnic> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 12, 2020 at 07:03:03PM +0200, Borislav Petkov wrote: > On Fri, Jun 12, 2020 at 09:57:09AM -0700, Sean Christopherson wrote: > > DS_AREA takes a virtual (linear) address, i.e. the address can be legal from > > the CPUs perspective but still lead to a #PF due to the address not being > > mapped in the page tables. > > It's not that - peterz and tglx - and I assume you meant that too - you > all want to taint on the very *attempt* to WRMSR, regardless of whether > the MSR exists or not. > > I don't necessarily agree with that because I don't think we should > taint when the MSR doesn't exist but if you all want it, sure, whatever. > I don't care that deeply. The problem is a fault on WRMSR doesn't mean the MSR doesn't exist, it only means WRMSR faulted. WRMSR can for all intents and purpose trigger completely arbitrary microcode flows, e.g. WRMSR 0x79 can fundamentally change the behavior of the CPU. And it's not like the WRMSR->taint is atomic, e.g. changing a platform scoped MSR that affects voltage settings or something of that nature could easily tank the system on a successful WRMSR before the kernel can be marked tainted. > > So users don't have to unload and reload the module just to enable or > > disable writes. I don't think it changes the protections in any way, a > > priveleged user still needs to explicitly toggle the control. > > There's /sys/module/msr/parameters/. A privileged user can do whatever. > A non-privileged should not disable that. 0400 only allows a privelged user to read the parameter, e.g. for parameters that are snapshotted at module load time and/or changing the param while the module is running would cause breakage. 0600 allows a priveleged user to read and write the parameter, which AFAICT is safe here. 0644 allows a priveleged user to read and write the parameter, and allows an unpriveleged user to read the param. > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette