From: Jeffrey E Altman <jaltman@auristor.com>
To: David Howells <dhowells@redhat.com>,
Christian Brauner <christian@brauner.io>
Cc: Marc Dionne <marc.dionne@auristor.com>,
linux-afs@lists.infradead.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
Etienne Champetier <champetier.etienne@gmail.com>,
Chet Ramey <chet.ramey@case.edu>,
Cheyenne Wills <cwills@sinenomine.net>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>,
Steve French <sfrench@samba.org>,
openafs-devel@openafs.org, linux-cifs@vger.kernel.org
Subject: Re: [PATCH 1/2] afs, bash: Fix open(O_CREAT) on an extant AFS file in a sticky dir
Date: Thu, 29 May 2025 22:42:34 -0400 [thread overview]
Message-ID: <4c5227e8-fdf7-47e1-8d42-4e41cf2512b2@auristor.com> (raw)
In-Reply-To: <07b7e70b-29e3-46bd-91e3-f19eabb915c8@auristor.com>
[-- Attachment #1: Type: text/plain, Size: 2912 bytes --]
On 5/29/2025 8:11 PM, Jeffrey E Altman wrote:
>
> On 5/19/2025 12:11 PM, David Howells wrote:
>> +int afs_is_owned_by_me(struct mnt_idmap *idmap, struct inode *inode)
>> +{
>> + struct afs_vnode *vnode = AFS_FS_I(inode);
>> + afs_access_t access;
>> + struct key *key;
>> + int ret;
>> +
>> + key = afs_request_key(vnode->volume->cell);
>> + if (IS_ERR(key))
>> + return PTR_ERR(key);
>> +
>> + /* Get the access rights for the key on this file. */
>> + ret = afs_check_permit(vnode, key, &access);
>> + if (ret < 0)
>> + goto error;
>> +
>> + /* We get the ADMINISTER bit if we own the file. */
>> + ret = (access & AFS_ACE_ADMINISTER) ? 0 : 1;
>
> AFS_ACE_ADMINISTER only means ownership if the inode is a
> non-directory. Should
> we add an explicit check for inode type?
I think the answer is 'yes'. The above check does not work for
directory inodes so
we need another method of answering the question or informing the caller
that the
answer is unknown. In some cases, such as chown() and chgrp() its safe
to say the
caller is the owner and defer the eventual access check to the server
when the inode
is a directory. However, there are other cases such as check_sticky()
where the vfs
cannot defer the decision to the server because there isn't an RPC that
is a one-to-one
match for the decision being made.
In addition to ownership, operations such as chown and chgrp or chmod might
be permitted if the caller is a member of the system:administrators
group. The
server has no method of informing the client that the user is special or
what rights
are granted due to that status.
In the absence of explicit knowledge, the only method by which the
client can
answer the question today would be to issue a PR_WhoAmI RPC to the cell's
Protection Service to obtain the AFS ID of the task's token. The AFS ID
could then
be compared to the struct afs_vnode->status.owner field. However,
clients might
not be permitted to communicate with the Protection Service and PR_WhoAmI is
currently only available from the AuriStorFS Protection Service.
PR_WhoAmI is
standardized for implementation by OpenAFS but at present neither OpenAFS
1.8.x nor 1.9.x include an implementation.
It should be noted that although an AFS ID is provided to the afs client
when an
rxkad token is inserted into the kernel, the provided value cannot be
trusted and
must not be used for this purpose.
>
>> +error:
>> + key_put(key);
>> + return ret;
>> +}
To address the most urgent need which is the may_create_in_sticky()
call, perhaps
introduce a non-directory specific is_file_inode_owned_by_me() as part
of this
change and then address the directory case once we figure out how to
implement
it.
Jeffrey Altman
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4276 bytes --]
next prev parent reply other threads:[~2025-05-30 2:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250519161125.2981681-1-dhowells@redhat.com>
2025-05-19 16:11 ` [PATCH 1/2] afs, bash: Fix open(O_CREAT) on an extant AFS file in a sticky dir David Howells
2025-05-30 0:11 ` Jeffrey E Altman
2025-05-30 2:42 ` Jeffrey E Altman [this message]
2025-05-19 16:11 ` [PATCH 2/2] vfs: Fix inode ownership checks with regard to foreign ownership David Howells
2025-05-30 1:03 ` Jeffrey E Altman
2025-07-21 16:15 ` Jeffrey Altman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c5227e8-fdf7-47e1-8d42-4e41cf2512b2@auristor.com \
--to=jaltman@auristor.com \
--cc=brauner@kernel.org \
--cc=champetier.etienne@gmail.com \
--cc=chet.ramey@case.edu \
--cc=christian@brauner.io \
--cc=cwills@sinenomine.net \
--cc=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.dionne@auristor.com \
--cc=openafs-devel@openafs.org \
--cc=sfrench@samba.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox