Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp264016pxa; Wed, 19 Aug 2020 00:03:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpL3+rbHc+pyO+DzONLhggm1H6/KKgsuePOgMUGQJiHFiD9LXnvm2R9XAdhZmb9no2jueM X-Received: by 2002:a50:af86:: with SMTP id h6mr23816320edd.132.1597820625192; Wed, 19 Aug 2020 00:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597820625; cv=none; d=google.com; s=arc-20160816; b=x7/CE8FkKdBaxu6dfUybZN33NPkCk4Iq2Td4EnRzmsVGX+Ccg/ZKrTBDIPDBW+AVNV IWjdo2W4sgFXnCcOkQX0emq0vKfEEKcb9COtk8liW2diYEJz9u7Ma47QE/849A6vC0vt SdjYc3RTLcIsMw/tLe6wQSV0SIlnKCZmjCvLk8XczWbaQ8fgVsI3MoNtD5LzxaVgJpBz oKjlrDVhsAC3OflPR7h8eCD5UT6SwpaX95bKxT2N5SB6GWHiw317InO1GaQdXPmcVXNZ 3yxjNgDNPI2Ubws0NaZF6y9lmUiv7IcnUQWffhcxgavAgtEO6MOGuSAEP35jTXUHNsE8 Pa8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=Hl79WQijRnk5MxvskvsRFtdA/DX4LrNyjcXz80eUV/8=; b=shmHuoD7LLL5qal61Fqk7Ol8noillVJ+cPC0tl8fGKbqpgoHz3jZFPEb5OhYNbyUUk 5JjFozmEUm4QaD7T1xJNlYMCGgk1z1pcROh1pbaER9sQ2Jl3n74/AvQL6ik+JJZ1/Yh/ m/OdXMhG9tWWLOXBD9fxkbmO5Kk0Uy/RHHWEV0j/OD3n0WQEDLsbp0fyEKC5IoUq0NTU aHP3H82+wmb8Ce+zA34sRzBcvVH0vOsxjB9EfpMXYMVpHxfDtn/XNorY8tPLlz8G05af Yg1yvlHXco9SP8HWdjHXvz0/25uQG7AjDQ1GMZtIk+0kQvz7GGEvL/ohPJMfsZ8smT8t 6Lpg== 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 n11si14622730edy.433.2020.08.19.00.03.21; Wed, 19 Aug 2020 00:03:45 -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 S1728024AbgHSG6u (ORCPT + 99 others); Wed, 19 Aug 2020 02:58:50 -0400 Received: from mga01.intel.com ([192.55.52.88]:29640 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728089AbgHSG6p (ORCPT ); Wed, 19 Aug 2020 02:58:45 -0400 IronPort-SDR: QEgpoTTnnMkEDWCT7mowxzyeQu3AqxfAKML93F0IeXg5x2rkYPocK2SodPqhoIiv9wy1qmKPpd ei4gQEX/McEQ== X-IronPort-AV: E=McAfee;i="6000,8403,9717"; a="173107488" X-IronPort-AV: E=Sophos;i="5.76,330,1592895600"; d="scan'208";a="173107488" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2020 23:57:26 -0700 IronPort-SDR: mpXpKRmaLdaHbRyBhNIUX8gOdfa2tGzXchNdovhuh6Zk9QzF9XL14EXa4z+iNhNamAMOSSCJ7u BbEn9v8VddRg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,330,1592895600"; d="scan'208";a="400736106" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.163]) by fmsmga001.fm.intel.com with SMTP; 18 Aug 2020 23:57:22 -0700 Received: by lahna (sSMTP sendmail emulation); Wed, 19 Aug 2020 09:57:21 +0300 Date: Wed, 19 Aug 2020 09:57:21 +0300 From: Mika Westerberg To: Daniel Gutson 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 Subject: Re: [PATCH] mtd: spi-nor: intel-spi: Do not try to make the SPI flash chip writable Message-ID: <20200819065721.GA1375436@lahna.fi.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 18, 2020 at 12:55:59PM -0300, Daniel Gutson wrote: > > If you care about other (malicious) code writing to the driver, please explain > > what the specific attack scenario is that you are worried about, and > > why you think > > this is not sufficient. What code would be able to write to the device > > if not the > > device driver itself? > > Maybe Mika can answer this better, but what I'm trying to do is to > limit the possibility of > damage, as explained in the Kconfig: > "Intel PCH/PCU SPI flash PCI driver (DANGEROUS)" > "Say N here unless you know what you are doing. Overwriting the > SPI flash may render the system unbootable." Right, the PCI part of the driver unconditionally (and wrongly) tried to set the chip writeable. What this whole thing tries to protect is that the user does not accidentally write to the flash chip. It contains BIOS and other important firmware so touching it (if it is not locked in the BIOS side) may potentially brick the system. That's why we also require that command line parameter so the user who knows what he or she is doing can enable it for writing. Actually thinking about this bit more, to make PCI and the platform parts consistent we can make the "writeable" control this for the PCI part as well. So what if we add a callback to struct intel_spi_boardinfo that the PCI driver populates and then the "core" driver uses to enable writing when "writeable" is set to 1.