Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp145531pxj; Thu, 3 Jun 2021 03:08:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKh6aHvRckvVGmJqDh9tzzUbkf5+8xUAx/0NsaxWjgqQLgKfTUcdDK+dDYOglW7bk2sH/R X-Received: by 2002:aa7:d54c:: with SMTP id u12mr42334323edr.242.1622714918527; Thu, 03 Jun 2021 03:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622714918; cv=none; d=google.com; s=arc-20160816; b=JNvlqqQkhgtiWKEMJVK3J6QOdseO5F/s2mAzI5yLrxtHiqv+RxFJPVuMr2unOU6F0s v39KtdjeYN1DbgLw/1+2b2mieTS6gkzKgXA4Im7HV7mye2+8O9vAahO9ru08cgBGfj8h E//UzEnECvmcHdnO/sKis0Sxu5+qa95KHh6N90IJnhPG2z35H4j8uj/IRnu3NEzBtVgn UfhzxIJYo6RGuEVhNaKLCTPN12Fd9OaNPW6y+4MhXsiOkIWO7FtnFbl9MqS9s4XbXXwh l307jMCEWP5liyMRQa/5Yr+2itWAevMqUbbm10tSbh2zOySuCVYLoMJ9vlsEooB0Qjd8 zvYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:mail-followup-to:reply-to:message-id :subject:cc:to:from:date:dkim-signature:dkim-signature; bh=x+tyGtuKQivyTVwpYXg7bis6FjooMqzN5iLMRFOcQec=; b=jTenElFYICYuxsPdZy47cGfx6/yM/mBlWvPi74p6eROISIFgL1xDuQSfjxIJA1nsPw Q6yrfjkdXUFSpZAxv3MIeHlS2VOgYqoUtUvYq8atoLjE4uaCrjS2B4pMcBNrNIqD8poh iHx+wyssYVzke1jfwoO66+8kKCosnZ+LjOl90mco9/1Gw4y3Itr5ATjs8oaYob+pQvw5 Zi3YT0hheIPmPkA+mJrLu5SEZxkc5MQY85FzrbZUBJWov7PnOZcsTrpW/CfWjJ+xBVUA XURsaL6AUYkFFi/NDNU7WqpV4oofVoMFP6DtELwWxPQWkp9w2zelDLUSSt3JuAdp1yUC xrlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=kedhPNIK; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="zx/L4dGI"; 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 m11si1928516ejc.708.2021.06.03.03.08.15; Thu, 03 Jun 2021 03:08:38 -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=@suse.cz header.s=susede2_rsa header.b=kedhPNIK; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b="zx/L4dGI"; 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 S229765AbhFCKJE (ORCPT + 99 others); Thu, 3 Jun 2021 06:09:04 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:42414 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229620AbhFCKJD (ORCPT ); Thu, 3 Jun 2021 06:09:03 -0400 Received: from relay2.suse.de (unknown [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 3199E1FD4D; Thu, 3 Jun 2021 10:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1622714838; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=x+tyGtuKQivyTVwpYXg7bis6FjooMqzN5iLMRFOcQec=; b=kedhPNIKxxlLkgtanscuy8Da/1hGttsm7IZX+nwk7mrI7UCxyR1qdFdHwilJq+U5sZavyJ V93s+waeZztWccmCqxWILsnKVGDH7jMnHuL9+oY9xXDzRlw6PgCWFvnnltWODLGtdjbEc3 SitUzEZe64ITaLQhSR8OKR+ydOe/Qdc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1622714838; h=from:from:reply-to:reply-to:date:date:message-id:message-id:to:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=x+tyGtuKQivyTVwpYXg7bis6FjooMqzN5iLMRFOcQec=; b=zx/L4dGILHdCZS13FlebeyvZZm8lMOYlmZEJMOzL0cMZ//ee0B+HMoNGqcE8/A18QxxdOD BrRL9I1o/jnlt2Bw== Received: from ds.suse.cz (ds.suse.cz [10.100.12.205]) by relay2.suse.de (Postfix) with ESMTP id 2A820A3B81; Thu, 3 Jun 2021 10:07:18 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id 2A518DA72C; Thu, 3 Jun 2021 12:04:37 +0200 (CEST) Date: Thu, 3 Jun 2021 12:04:37 +0200 From: David Sterba To: Damien Le Moal Cc: "dsterba@suse.cz" , Niklas Cassel , Jens Axboe , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/2] blk-zoned: allow BLKREPORTZONE without CAP_SYS_ADMIN Message-ID: <20210603100436.GV31483@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Damien Le Moal , Niklas Cassel , Jens Axboe , "linux-block@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20210531135444.122018-1-Niklas.Cassel@wdc.com> <20210531135444.122018-3-Niklas.Cassel@wdc.com> <20210603095117.GU31483@twin.jikos.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1-rc1 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 03, 2021 at 10:00:08AM +0000, Damien Le Moal wrote: > On 2021/06/03 18:54, David Sterba wrote: > > On Mon, May 31, 2021 at 01:54:53PM +0000, Niklas Cassel wrote: > >> From: Niklas Cassel > >> > >> Performing a BLKREPORTZONE operation should be allowed under the same > >> permissions as read(). (read() does not require CAP_SYS_ADMIN). > >> > >> Remove the CAP_SYS_ADMIN requirement, and instead check that the fd was > >> successfully opened with FMODE_READ. This way BLKREPORTZONE will match > >> the access control requirement of read(). > > > > Does this mean that a process that does not have read nor write access > > to the device itself (blocks) is capable of reading the zone > > information? Eg. some monitoring tool. > > With this change, to do a report zones, the process will only need to have read > access to the device. And if it has read access, it also means that it can read > the zones content. Ok, so this is a bit restricting. The zone information is like block device metadata, comparing it to a file that has permissionx 0600 I can see the all the stat info (name, tiemstamps) but can't read the data. But as the ioctl work, it needs a file descriptor and there's probably no way to separate the permissions to read blocks and just the metadata. For a monitoring/reporting tool this would be useful. Eg. for btrfs it could be part of filesystem status overview regarding full or near-full zones and emitting an early warning or poking some service to start the reclaim.