Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1127360pxb; Thu, 4 Mar 2021 04:08:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJy/tow0WqpYuf1MHCPfjxMYVcJ8YGoJEYrqu6sVRSwRfSLsY0mv93jRZMFzlPAYPWBWNlDh X-Received: by 2002:a50:eb49:: with SMTP id z9mr4097796edp.234.1614859738520; Thu, 04 Mar 2021 04:08:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614859738; cv=none; d=google.com; s=arc-20160816; b=qM/HFeF9dnAfwGafKv49wQfamW9rI4COWKwQpFqXPbWp9U+kNgpuGL8NVC9KIlsBvq wj1OUkKDP/erBoMYTTzP3qxHkVi0EJ6qopv+3l3BCSmDtVfrtzgDjtnh1/yEiwVMIXM5 TJwnVQbCxmk5k5i6kDXqeNWtHlJb4QjDNEKu4mnwZiQ1oKVNJPGrCFGUaDqAEcjKo74q t7ZvV9cJ0Gj0BmEwhjyVnS/vR/YgwoMYMiwMA/nDyDUVT2p9LrPaCiZ0ebCeIiCxu8DR 3pFXhmovF60zbtyhyxBiGFIFDWo+DktKgR16sHLMQMJdx5A8Td72iS06WHxEeThCfSQe bV8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=/zGoKk8qWDY1+vBXmPYXj/QOZ0hmmrXvBvyyTnfjTa0=; b=cf+wbBqiersGypcxtoob/xelaM8NyT+FvgMZjWdvHRJJOTKn0IMNRt/pZtVDaPFkfq 7mnMcDUN6FqoXHWO0XIgAySzWhnnkIcBwnboBgDEMZAc2clbKvXgknky3ohngUEv4rsF /vc7rjS+zfrx3swbVS6BE6HqzBVLdPfTTEDv5REQbLHDqkQSGCOemNlsT1ULmmYAn0Or 57tc8bjOtpPy915v4WgtaWfn8JlyVTeuCxzD4qmEbNwdAUHK49+cTS8rEqQiwqh4JD/b xlmjypjGdkr5LKFns/ZNUd6sZRt191zSrCrkleTo76w+3fatHQVtfRcJPL/sTYR8JEO8 be4w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si16033681eje.495.2021.03.04.04.08.35; Thu, 04 Mar 2021 04:08:58 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578751AbhCCSRx convert rfc822-to-8bit (ORCPT + 99 others); Wed, 3 Mar 2021 13:17:53 -0500 Received: from lithops.sigma-star.at ([195.201.40.130]:49602 "EHLO lithops.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346523AbhCCQSJ (ORCPT ); Wed, 3 Mar 2021 11:18:09 -0500 Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id C0AEF6083244; Wed, 3 Mar 2021 17:17:18 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 47tz6j-1yi-U; Wed, 3 Mar 2021 17:17:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id A02CD6083275; Wed, 3 Mar 2021 17:17:16 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id S4uJLM3KDg-S; Wed, 3 Mar 2021 17:17:16 +0100 (CET) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 7E9876083244; Wed, 3 Mar 2021 17:17:16 +0100 (CET) Date: Wed, 3 Mar 2021 17:17:16 +0100 (CET) From: Richard Weinberger To: Michael Walle Cc: linux-mtd , linux-kernel , Miquel Raynal , Vignesh Raghavendra , Greg Kroah-Hartman Message-ID: <689194005.42755.1614788236355.JavaMail.zimbra@nod.at> In-Reply-To: References: <20210303155735.25887-1-michael@walle.cc> Subject: Re: [PATCH] mtd: require write permissions for locking and badblock ioctls MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT X-Originating-IP: [195.201.40.130] X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF78 (Linux)/8.8.12_GA_3809) Thread-Topic: require write permissions for locking and badblock ioctls Thread-Index: KRfYtqpl1pr2bZDMHpym/f0qKEWheA== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Michael, ----- Ursprüngliche Mail ----- > Von: "Greg Kroah-Hartman" > An: "Michael Walle" > CC: "linux-mtd" , "linux-kernel" , "Miquel Raynal" > , "richard" , "Vignesh Raghavendra" > Gesendet: Mittwoch, 3. März 2021 17:08:56 > Betreff: Re: [PATCH] mtd: require write permissions for locking and badblock ioctls > On Wed, Mar 03, 2021 at 04:57:35PM +0100, Michael Walle wrote: >> MEMLOCK, MEMUNLOCK and OTPLOCK modify protection bits. Thus require >> write permission. Depending on the hardware MEMLOCK might even be >> write-once, e.g. for SPI-NOR flashes with their WP# tied to GND. OTPLOCK >> is always write-once. >> >> MEMSETBADBLOCK modifies the bad block table. >> >> Fixes: f7e6b19bc764 ("mtd: properly check all write ioctls for permissions") >> Signed-off-by: Michael Walle >> --- >> drivers/mtd/mtdchar.c | 8 ++++---- >> 1 file changed, 4 insertions(+), 4 deletions(-) > > Thanks for auditing the rest of these from my original patch. If this > is ok with userspace tools, it's fine with me, but I don't even have > this hardware to test with :) That's my fear. Michael, did you verify? In general you need to be root to open these device files. So, I don't see a security problem here. Thanks, //richard