From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DC2FC4167B for ; Wed, 8 Nov 2023 07:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232404AbjKHH6s (ORCPT ); Wed, 8 Nov 2023 02:58:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234922AbjKHH6r (ORCPT ); Wed, 8 Nov 2023 02:58:47 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92831171D; Tue, 7 Nov 2023 23:58:44 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A22CC433CA; Wed, 8 Nov 2023 07:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699430324; bh=/7dt/Cvecp2TaRoRRfdH0FfeT15JD49KeWWQ74HCxkc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fRWF/y0nr4Vo0b/zqASi2aeEg46eJaHit71ua87oNM+VcnMkIX15jzZ60Y1g0Qa7K b9VDjItdfrIIx1oBqTKK1FAKz0jJamxBeOkk7ezZgJ7eKrdA6MNJa06NJ9JGG5oDHM /OUySAEx9otUhxAVhvKHjZ29jBMx92N8ER6SUeDt2DvuKJVQkLkmCG8A+bZ23Z/dF+ o2gKCbIv0uO+kBmCRyv/UJqxtpiYPj0itMo9HmxTNTwFE2oVgCkhQdC6MAwukAyMvE +4mrhbFVIQqPIHRl9kwp3s3pXXmaJEXW0TwUok7LFjcBFN/HZPL0ckGFzQ0U7t+g6p HDheGhUYdd+Tw== Date: Wed, 8 Nov 2023 08:58:32 +0100 From: Christian Brauner To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, Paul Moore , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, linux-man@vger.kernel.org, linux-security-module@vger.kernel.org, Karel Zak , Ian Kent , David Howells , Linus Torvalds , Al Viro , Christian Brauner , Amir Goldstein , Matthew House , Florian Weimer , Arnd Bergmann Subject: Re: [PATCH v4 4/6] add statmount(2) syscall Message-ID: <20231108-zwerge-unheil-b3f48a84038d@brauner> References: <20231025140205.3586473-5-mszeredi@redhat.com> <4ab327f80c4f98dffa5736a1acba3e0d.paul@paul-moore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4ab327f80c4f98dffa5736a1acba3e0d.paul@paul-moore.com> Precedence: bulk List-ID: > > +static int do_statmount(struct stmt_state *s) > > +{ > > + struct statmnt *sm = &s->sm; > > + struct mount *m = real_mount(s->mnt); > > + size_t copysize = min_t(size_t, s->bufsize, sizeof(*sm)); > > + int err; > > + > > + err = security_sb_statfs(s->mnt->mnt_root); > > + if (err) > > + return err; > > + > > + if (!capable(CAP_SYS_ADMIN) && > > + !is_path_reachable(m, m->mnt.mnt_root, &s->root)) > > + return -EPERM; > > In order to be consistent with our typical access control ordering, > please move the security_sb_statfs() call down to here, after the > capability checks. I've moved the security_sb_statfs() calls accordingly.