Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp705587pxb; Tue, 2 Feb 2021 16:11:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzpqK9B6xAIYGPZDVGRz2R0etPCdQAXXN1Cy0FtJ0BcQ/vYSudGohkhqBeTXKaSzVjzqjr X-Received: by 2002:a17:906:7d4f:: with SMTP id l15mr482309ejp.95.1612311066323; Tue, 02 Feb 2021 16:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612311066; cv=none; d=google.com; s=arc-20160816; b=zdZopEzVkON1eC67R1LzL+d+vO2uoQ8naAqjqXIqQe5R/QAr3aruCA5mUmshA1Ixsu ZfcDm6G9XzgfB430luXLYXcxFuKLCvC3WvP2pUzKzaYOyW8uS5mBK34nmz+OvnBEHTKw TW4pLcOQG6lSozBAh4SmDI9epJDBy/Er+OvsC18CmKsihrCMhOrUGos3TbeDOKvOkCoA iQ1LQJJwFbIasaLUNcTL4K0588JgSu6mis+COhTuINHajjSDU3KfNkpptdrzr5am966h l9U1lm9d0xP51Y3DkDi9vBDe/4YzfX9FKokNZIwDIeDChld2l3TesiZNmiYBAYYbGidm M0hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=wUurNA9VhndOPP6gfhXBN1JbTKtpFDXXD0/WIc6R26Q=; b=BmOeXxvwYjy4uiDuFFKzMfcD7ktSNOBjDUCirn9m9MlmT3J1HEIz3ZpbFIph4u8En5 WP+dQQ1+Le7oSEzqhcYlb7Tu9Zu3l/4Jy2wdr9YTe93tjY876EDqpuCq9d2jrv19VrmR YIUfPLI65ZZuQCenByu0jYbOJkDMzXX6/qW8kjlWaGtaTseEJdsTSFCiduwGIOWo/Ib2 DdvMWuIntwciFVmayIKgqG/TYFYbrbpc0UbEYdtWmvaXfB5UEmKhMeaL3OeiawG94BLc Wvp+J2iAIEvBHsTBnDHbPWIuWh2VNrIxcbfABLXKGHYh8iEoSoB4KvpMRyCMi2UXddpT +PBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Q+gyF53u; 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 m26si204869edp.501.2021.02.02.16.10.41; Tue, 02 Feb 2021 16:11:06 -0800 (PST) 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=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=Q+gyF53u; 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 S237711AbhBBRuL (ORCPT + 99 others); Tue, 2 Feb 2021 12:50:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237749AbhBBRrJ (ORCPT ); Tue, 2 Feb 2021 12:47:09 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 431BCC06174A for ; Tue, 2 Feb 2021 09:46:27 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id f14so7030003ejc.8 for ; Tue, 02 Feb 2021 09:46:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wUurNA9VhndOPP6gfhXBN1JbTKtpFDXXD0/WIc6R26Q=; b=Q+gyF53uYybQ7VU8537+gYM+aGyprhjPmxAfLGnXP6OwT0GUtgTrUly1i2fwhFGjtq p8whi96zlLUuqYC2XLni6OtAlLqCFkUCNoE29gm7ZNiukEuBRSs16ly47hZcjG6mcf6W YYvDPxx/KBKbT4jC9DYrUXZosFGn5i6Xf3mWMFX+1Qr7C65VszwwhvahhMB2NecwsZzI e3RqPl7eS6e+HVxxdVcQDLle6L5RSDpa1rJm+u/OFMeLblLfAyT40bK/SRA5AhfI1W1U CrxE+ACZJOsvAUYzBKsXKBmEsSRk8P5lses045BxA80LjvV+151v8gAD+DbIAjYVFUu2 jitQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wUurNA9VhndOPP6gfhXBN1JbTKtpFDXXD0/WIc6R26Q=; b=s1dU5vB+FscoGyVOnuhscTg7Pzc+bsVw/m/XugUnWxj7Sro4y5SzlnyrWuqx2uCZdG U/VB1HzR5iBCmviM71xqogfjNscUO5vxZUZijQi0wiZBaZSvv/30NrGUKWJNpXKGpwIZ wD3zZP8N9LzaI+kquu+l62xmC9WK0Xv0AWdANw76QkR3/AokeypIEEsk10U/kzXxCVlZ Pqt5RHMs6I/T0lpaXW0GTaYDiS3ITEGH+42KkpUCCAeG9o9IH90VLU5F3QsrOr0QkVKE cY1mdnX9q7yhMAIGY08chbfgvlg2mQSmh5cmK6H/MkHg8YHF0VYow5m6BLo6Nxg2kxiH P8zg== X-Gm-Message-State: AOAM533VKcNgqKYrVdpsUnvyMCLfRCC+U6JEp8KAwnMGsdEe92FFP5b3 2O8CC/6Cj0FH0NGpdVfdbiGTKa5ewf3LRlpj8Bmu8A== X-Received: by 2002:a17:906:8252:: with SMTP id f18mr2377108ejx.418.1612287985906; Tue, 02 Feb 2021 09:46:25 -0800 (PST) MIME-Version: 1.0 References: <20210130002438.1872527-1-ben.widawsky@intel.com> <20210130002438.1872527-9-ben.widawsky@intel.com> <20210201181845.GJ197521@fedora> <20210201183455.3dndfwyswwvs2dlm@intel.com> In-Reply-To: From: Dan Williams Date: Tue, 2 Feb 2021 09:46:23 -0800 Message-ID: Subject: Re: [PATCH 08/14] taint: add taint for direct hardware access To: Konrad Rzeszutek Wilk Cc: Ben Widawsky , linux-cxl@vger.kernel.org, Linux ACPI , Linux Kernel Mailing List , linux-nvdimm , Linux PCI , Bjorn Helgaas , Chris Browy , Christoph Hellwig , Ira Weiny , Jon Masters , Jonathan Cameron , Rafael Wysocki , Randy Dunlap , Vishal Verma , daniel.lll@alibaba-inc.com, "John Groves (jgroves)" , "Kelley, Sean V" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 1, 2021 at 6:50 PM Konrad Rzeszutek Wilk wrote: > > On Mon, Feb 01, 2021 at 11:01:11AM -0800, Dan Williams wrote: > > On Mon, Feb 1, 2021 at 10:35 AM Ben Widawsky wrote: > > > > > > On 21-02-01 13:18:45, Konrad Rzeszutek Wilk wrote: > > > > On Fri, Jan 29, 2021 at 04:24:32PM -0800, Ben Widawsky wrote: > > > > > For drivers that moderate access to the underlying hardware it is > > > > > sometimes desirable to allow userspace to bypass restrictions. Once > > > > > userspace has done this, the driver can no longer guarantee the sanctity > > > > > of either the OS or the hardware. When in this state, it is helpful for > > > > > kernel developers to be made aware (via this taint flag) of this fact > > > > > for subsequent bug reports. > > > > > > > > > > Example usage: > > > > > - Hardware xyzzy accepts 2 commands, waldo and fred. > > > > > - The xyzzy driver provides an interface for using waldo, but not fred. > > > > > - quux is convinced they really need the fred command. > > > > > - xyzzy driver allows quux to frob hardware to initiate fred. > > > > > > > > Would it not be easier to _not_ frob the hardware for fred-operation? > > > > Aka not implement it or just disallow in the first place? > > > > > > Yeah. So the idea is you either are in a transient phase of the command and some > > > future kernel will have real support for fred - or a vendor is being short > > > sighted and not adding support for fred. > > > > > > > > > > > > > > > > - kernel gets tainted. > > > > > - turns out fred command is borked, and scribbles over memory. > > > > > - developers laugh while closing quux's subsequent bug report. > > > > > > > > Yeah good luck with that theory in-the-field. The customer won't > > > > care about this and will demand a solution for doing fred-operation. > > > > > > > > Just easier to not do fred-operation in the first place,no? > > > > > > The short answer is, in an ideal world you are correct. See nvdimm as an example > > > of the real world. > > > > > > The longer answer. Unless we want to wait until we have all the hardware we're > > > ever going to see, it's impossible to have a fully baked, and validated > > > interface. The RAW interface is my admission that I make no guarantees about > > > being able to provide the perfect interface and giving the power back to the > > > hardware vendors and their driver writers. > > > > > > As an example, suppose a vendor shipped a device with their special vendor > > > opcode. They can enable their customers to use that opcode on any driver > > > version. That seems pretty powerful and worthwhile to me. > > > > > > > Powerful, frightening, and questionably worthwhile when there are > > already examples of commands that need extra coordination for whatever > > reason. However, I still think the decision tilts towards allowing > > this given ongoing spec work. > > > > NVDIMM ended up allowing unfettered vendor passthrough given the lack > > of an organizing body to unify vendors. CXL on the other hand appears > > to have more gravity to keep vendors honest. A WARN splat with a > > taint, and a debugfs knob for the truly problematic commands seems > > sufficient protection of system integrity while still following the > > Linux ethos of giving system owners enough rope to make their own > > decisions. > > > > > Or a more realistic example, we ship a driver that adds a command which is > > > totally broken. Customers can utilize the RAW interface until it gets fixed in a > > > subsequent release which might be quite a ways out. > > > > > > I'll say the RAW interface isn't an encouraged usage, but it's one that I expect > > > to be needed, and if it's not we can always try to kill it later. If nobody is > > > actually using it, nobody will complain, right :D > > > > It might be worthwhile to make RAW support a compile time decision so > > that Linux distros can only ship support for the commands the CXL > > driver-dev community has blessed, but I'll leave it to a distro > > developer to second that approach. > > Couple of thoughts here: I am compelled to challenge these assertions because this set is *more* conservative than the current libnvdimm situation which is silent by default about the vendor pasthrough. How can this be worse when the same scope of possible damage is now loudly reported rather than silent? > > - As distro developer (well, actually middle manager of distro > developers) this approach of raw interface is a headache. You've convinced me that this needs a compile time disable, is that not sufficient? > > Customers will pick it Why will they pick it when the kernel screams bloody murder at them when it gets used? > and use it since it is there and the poor > support folks will have to go through layers of different devices What layers willl support folks need to dig through when the WARN splat is clearly present in the log and the taint flag is visible in any future crash? > say (for example) to finally find out that some OEM firmware opcode > X is a debug facility for inserting corrupted data, while for another vendor > the same X opcode makes it go super-fast. None of these commands are in the fast path. > > Not that anybody would do that, right? Ha! We can look to libnvdimm + ndctl to see the trend. I have not encountered new competing manageability tool efforts, and the existing collisions between ndctl and ipmctl are resolving to defeature ipmctl where ndctl and the standard / native command path can do the job. > > - I will imagine that some of the more vocal folks in the community > will make it difficult to integrate these patches with these two > (especially this taint one). This will make the acceptance of these > patches more difficult than it should be. If you really want them, > perhaps make them part of another patchset, or a follow up ones. The patches are out now and no such pushback from others has arisen. I believe your proposal for compile-time disable is reasonable and would satisfy those concerns. > > - I still don't get why as a brand new community hacks are coming up > (even when the hardware is not yet there) instead of pushing back at > the vendors to have a clean up interface. I get in say two or three > years these things .. but from the start? I get your point about > flexibility, but it seems to me that the right way is not give open > RAW interface (big barndoor) but rather maintain the driver and grow > it (properly constructed doors) as more functionality comes about > and then adding it in the driver. > Again, WARN_TAINT and now the threat of vendor tools not being generally distributable across distro kernels that turn this off, is a more strict stance than libnvdimm where the worst fears have yet to come to fruition. In the meantime this enabling is useful for a validation test bench kernel for new hardware bringup while the upstream api formalization work continues.