Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp756072pxf; Wed, 24 Mar 2021 15:25:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwj60h7yS/qzCCNmZn6xQiNm0Dc3Sn/1JOTMfHUfc9psDrvYQc/Z5qWMJHzajHXP4qmQJ89 X-Received: by 2002:a17:906:2dda:: with SMTP id h26mr6064957eji.163.1616624750619; Wed, 24 Mar 2021 15:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616624750; cv=none; d=google.com; s=arc-20160816; b=YyVrjgQzwsNfD9hexa3oSJ6aFZFXVs0TXL+i4QuSLgqOtZcQgkNJNw8upevseaarlA tDRZDpyGCGlfRFpbC+ZNr5dzhY9aHe+dvjLhmL8XPtDaBgKhgIOThet7cvfGjKIHM20q 9Q1MbXBoP17TmL/4myMdLbAr0mZVtGKdO/HYB0aou0w4kT5929VAEIGpGSRcMi1GI65e 89q7X/2actEwQ3TB3XVs20ex1Bf8jA+kBo8TlK/HlEDzb6gyZDnJ46WsC8SxjMy2dt09 1PpdDTseQigln3DjneR5lu70RthERx2lAikiQS9hSu7xnoFjNnMq2aw+v7om0V3l6l1h G6xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=eg23mKYxm7nNwbNsVwvQjo37WcQ4MqwuW9vfzv2TDUA=; b=DIyTam7dN2WCqQd4QenrstXXv4FuxGKIy+6fpwcRAUOi8fLmLBwaA7kvLnSdk82rE6 X6YdcQV8d5R2fLjwq6XklCCecC+vYSBN2N1WzJpC+RMZsTggf9z2MqfTNU7RKphIA+la H2XWvHp5XI0kvTi43w6tr/y0M/fFyWObhMpUi+7jhe0P/cQjySgqzjJJ6nxQ4otn+uvu 5fkiuRMxde2hpKAz3cjbzYFmONRbVNDv4a40xYdcRMSKwtX4q9etFV4eHMrXBcKtZhLW X235t9Ky7WboCiRxVSdBeqxvlmJ5XO1WsPeiUHaFH3qdB0wNiNibJZFEIMwEPhuJaEzj SpaA== 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 m9si2711704eje.591.2021.03.24.15.25.27; Wed, 24 Mar 2021 15:25:50 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235228AbhCXFKN (ORCPT + 99 others); Wed, 24 Mar 2021 01:10:13 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:40702 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232648AbhCXFKA (ORCPT ); Wed, 24 Mar 2021 01:10:00 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lOvmJ-008kjG-MF; Wed, 24 Mar 2021 05:09:59 +0000 Date: Wed, 24 Mar 2021 05:09:59 +0000 From: Al Viro To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig Subject: Re: [PATCH v2 03/18] ovl: stack miscattr ops Message-ID: References: <20210322144916.137245-1-mszeredi@redhat.com> <20210322144916.137245-4-mszeredi@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210322144916.137245-4-mszeredi@redhat.com> Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 22, 2021 at 03:49:01PM +0100, Miklos Szeredi wrote: > +int ovl_miscattr_set(struct user_namespace *mnt_userns, > + struct dentry *dentry, struct miscattr *ma) > +{ > + struct inode *inode = d_inode(dentry); > + struct dentry *upperdentry; > + const struct cred *old_cred; > + int err; > + > + err = ovl_want_write(dentry); > + if (err) > + goto out; > + > + err = ovl_copy_up(dentry); > + if (!err) { > + upperdentry = ovl_dentry_upper(dentry); > + > + old_cred = ovl_override_creds(inode->i_sb); > + err = ovl_security_miscattr(dentry, ma, true); > + if (!err) > + err = vfs_miscattr_set(&init_user_ns, upperdentry, ma); > + revert_creds(old_cred); > + ovl_copyflags(ovl_inode_real(inode), inode); > + } > + ovl_drop_write(dentry); > +out: > + return err; > +} Umm... No equivalents of /* * Prevent copy up if immutable and has no CAP_LINUX_IMMUTABLE * capability. */ ret = -EPERM; if (!ovl_has_upperdata(inode) && IS_IMMUTABLE(inode) && !capable(CAP_LINUX_IMMUTABLE)) goto unlock; ret = ovl_maybe_copy_up(file_dentry(file), O_WRONLY); if (ret) goto unlock; in the current tree?