Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2246464pxa; Mon, 24 Aug 2020 09:03:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyU+TqHPOfycqaWPuKw1BMBJA+eNMKGUnNcd1537LAOBjyfyHL1Fjok2W1vqO75q5zfuzOc X-Received: by 2002:a05:6402:206a:: with SMTP id bd10mr5819195edb.321.1598285031303; Mon, 24 Aug 2020 09:03:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598285031; cv=none; d=google.com; s=arc-20160816; b=zLfIkpeNNaNq/1J5ueRBjPaihigQRUk6OthdB0cXrjaplwvLQ8op7OGU9QJ85XbRd8 CTekPadpYqagWDRXx/WHMpGjzaBoeCgPFm1ga2T3s+rORYNucsnY114IR17XAPOIMY3f HdJu0G0FKV9N8+OxxV8LYEmVNuL2n4OPJKLYhhC2PPal0DC1WXOX1SA6TPh7m8LDgG9A lBubrElJy7znbh+9fTPYYnPjSd4hRL6S3OJVJrdZMfS2SR6iukQy4y5gn6w9TJoPrx6Q 5LBwUvjHuRlwEuCzUp06Y/YzFlcLAdAZWGZT5IDKG4kERtqwmQH2cd43w66UzELNOWsU Yejg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=wo1WKRputxQ5WEmQk/gfcqmvWhqh/EvoPHmhOwUKjX8=; b=dl8mAnhjrMV3+S75HUzQRi11gY0sMHjXqWcL5GmWVcnMaEsx8L5UfwTLYGbpgJMlfv P1Kegu8GWWPslMgqH0CczsKFzq2B8vy5Wo8teSSsVciN2RLbuS+mReaRAsdMol0UXEeh sU+YF7BXMBWUVOEzOJLPS5V4bi6Wk2g/7SVPnpWHTwptA8+w6w6Hxe0k45ADEE2N9Gkw 6f6NMaXjHkuqWIOFb+zuihi7u0Fg0jPDwNQ7x94JmYTkqP7RYFeLBbCZDfACQwugJDBv BnkqJRSh0kdFWIPuVyIDp3xLaPvOuaRDGcEN27+WxCkIkIp9rVFCc4P2q7oG3cASaxI8 TX4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@eclypsium.com header.s=google header.b="faxhd+E/"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=eclypsium.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ok21si7644497ejb.373.2020.08.24.09.03.20; Mon, 24 Aug 2020 09:03:51 -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=@eclypsium.com header.s=google header.b="faxhd+E/"; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=eclypsium.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725962AbgHXQBO (ORCPT + 99 others); Mon, 24 Aug 2020 12:01:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725973AbgHXQAy (ORCPT ); Mon, 24 Aug 2020 12:00:54 -0400 Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B7B7C061573 for ; Mon, 24 Aug 2020 09:00:54 -0700 (PDT) Received: by mail-qv1-xf41.google.com with SMTP id cs12so3955374qvb.2 for ; Mon, 24 Aug 2020 09:00:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eclypsium.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wo1WKRputxQ5WEmQk/gfcqmvWhqh/EvoPHmhOwUKjX8=; b=faxhd+E/EzFyd/c68LZgtAVunAl5IlW4VnAzDC/LPPaQqJAjfXfz1Zv3ouYnuFvQbr Fjy+/maJndRntNt2Z9xRNria6z74hHH7EBXKX8IZyFXp4UfwR2+SPrDfbnftHoGu149l 5QW/NTTmJxaD9hFTK+idq2D4J0LAzu8R72eImcM1Ndmrm5R3+3rJQwtBz38Culyj77nf +ccE2m+1yVQXIaHoDgs0UyvdWHfZTO0g0ED4g/KnQr0M9DMO1m1zmiG6lbIsRZW8+Fze 9xYmeRGu6X5GUYF4sfN3U3reo8HXANvRGwyyoPHAUGtdnlAAc94bDTR8C4X77KmLP7kI kpdQ== 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=wo1WKRputxQ5WEmQk/gfcqmvWhqh/EvoPHmhOwUKjX8=; b=iO+gjEtfCmOTxBQH4qunTZM740C4R2c3EEkIGGs7QKHrxFgZBEbI0+NZlLaTww7Xr9 bw3KFfPa1lROnSE9pLaPoRdXhjdFxtLJ24xBo5tngsytc13W6NAPyOrffC4wXx5iC0PX JGmpl0tVHJzy3ENppeR9Jpr88RqOY6iYpC+fZTe/tc/paf6ZZ+nXbqu0yYlahHV3k+vF i3hhY8HUwrrdeHdefJRzvxUlrz+vTM38vOB0wOLjUxql2/qlUEwIgoVeRYAwU8Hc4Ick VIDiE8YZLX6aZA2LTBnCrxdi1LNGqIFsB9LAB7ov0cLKP1liAyXjqpfFj2ivqQLpl+UZ xj6A== X-Gm-Message-State: AOAM532QDdU3LyT+VHKAvpjR8GtBk+Gtgs/RdHXR0zQ0QDzwXKhL6/zX 3tvus/IxWEaVyNmIbU8DT/6jjbSY2i74Ir7XXMFrdg== X-Received: by 2002:ad4:55ca:: with SMTP id bt10mr5553951qvb.200.1598284853742; Mon, 24 Aug 2020 09:00:53 -0700 (PDT) MIME-Version: 1.0 References: <20200819065721.GA1375436@lahna.fi.intel.com> <20200819091123.GE1375436@lahna.fi.intel.com> <20200824082227.GU1375436@lahna.fi.intel.com> <20200824091542.GC1375436@lahna.fi.intel.com> <20200824094448.GE1375436@lahna.fi.intel.com> In-Reply-To: <20200824094448.GE1375436@lahna.fi.intel.com> From: Daniel Gutson Date: Mon, 24 Aug 2020 13:00:42 -0300 Message-ID: Subject: Re: [PATCH] mtd: spi-nor: intel-spi: Do not try to make the SPI flash chip writable To: Mika Westerberg Cc: Arnd Bergmann , Tudor Ambarus , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Boris Brezillon , linux-mtd , "linux-kernel@vger.kernel.org" , Alex Bazhaniuk , Richard Hughes , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 24, 2020 at 6:44 AM Mika Westerberg wrote: > > On Mon, Aug 24, 2020 at 11:31:40AM +0200, Arnd Bergmann wrote: > > On Mon, Aug 24, 2020 at 11:15 AM Mika Westerberg > > wrote: > > > On Mon, Aug 24, 2020 at 11:08:33AM +0200, Arnd Bergmann wrote: > > > > On Mon, Aug 24, 2020 at 10:22 AM Mika Westerberg > > > > wrote: > > > > > On Sat, Aug 22, 2020 at 06:06:03PM +0200, Arnd Bergmann wrote: > > > > > > On Wed, Aug 19, 2020 at 11:11 AM Mika Westerberg > > > > > > > > > > > > The mtd core just checks both the permissions on the device node (which > > > > > > default to 0600 without any special udev rules) and the MTD_WRITEABLE > > > > > > on the underlying device that is controlled by the module parameter > > > > > > in case of intel-spi{,-platform,-pci}.c. > > > > > > > > > > OK, thanks. > > > > > > > > > > Since we cannot really get rid of the module parameter (AFAIK there are > > > > > users for it), I still think we should just make the "writeable" to > > > > > apply to the PCI part as well. That should at least make it consistent, > > > > > and it also solves Daniel's case. > > > > > > > > Can you explain Daniel's case then? I still don't understand what he > > > > actually wants. > > > > > > > > As I keep repeating, the module parameter *does* apply to the pci > > > > driver front-end since it determines whether the driver will disallow > > > > writes to the mtd device without it. The only difference is that the pci > > > > driver will attempt to set the hardware bit without checking the > > > > module parameter first, while the platform driver does not. If the > > > > module parameter is not set however, the state of the hardware > > > > bit is never checked again. > > > > > > I think Daniel wants the PCI driver not to set the hardware bit by > > > default (same as the platform driver). > > > > Sure, but *why*? > > Because this is part of the platform firmware security check patch he is > also working on and, I guess making the flash chip writeable by default > is triggering some of the checks in that patch. Or something along those > lines ;-) Correct. I need these drivers to be enabled by default, but they are documented as "DANGEROUS", so I want to also split the driver in read-only mode and R/W mode. Currently, the driver is R/W, and this would be a little first step in that direction. -- Daniel Gutson Argentina Site Director Enginieering Director Eclypsium Below The Surface: Get the latest threat research and insights on firmware and supply chain threats from the research team at Eclypsium. https://eclypsium.com/research/#threatreport