Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Jeffrey E Altman <jaltman@auristor.com>
To: Etienne Champetier <champetier.etienne@gmail.com>,
	Christian Brauner <brauner@kernel.org>
Cc: David Howells <dhowells@redhat.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Marc Dionne <marc.dionne@auristor.com>,
	Chet Ramey <chet.ramey@case.edu>,
	Steve French <sfrench@samba.org>,
	linux-fsdevel@vger.kernel.org,
	Linux AFS mailing list <linux-afs@lists.infradead.org>,
	linux-kernel@vger.kernel.org, linux-cifs@vger.kernel.org,
	"openafs-devel@openafs.org" <openafs-devel@openafs.org>
Subject: Re: [PATCH] afs, bash: Fix open(O_CREAT) on an extant AFS file in a sticky dir
Date: Mon, 5 May 2025 10:42:10 -0400	[thread overview]
Message-ID: <66c958db-0408-451d-b362-fed1f56d7c6d@auristor.com> (raw)
In-Reply-To: <CAOdf3grbDQ-Fh2bV7XfoYvVBhgBAh7-hZyyxTNt1RfGekrA-nA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3353 bytes --]

On 5/5/2025 10:02 AM, Etienne Champetier wrote:
> Hello,
>
> Removing lists, feel free to add them back
>
> Le lun. 5 mai 2025 à 09:14, Christian Brauner <brauner@kernel.org> a écrit :
>> Why is it removed? That's a very strange comment:
>>
>> #if 0   /* reportedly no longer needed */
>>
>> So then just don't remove it. I don't see a reason for us to workaround
>> userspace creating a bug for itself and forcing us to add two new inode
>> operations to work around it.
> This bash workaround introduced ages ago for AFS bypass fs.protected_regular

Chet, I don't think this history is correct.  The bash workaround was 
introduced in 1992 to workaround a behavior when appending to restricted 
access directories stored in IBM AFS 3.1[1] and the Linux kernel's 
30aba6656f61ed44cba445a3c0d38b296fa9e8f5 wasn't added until 2018.

IBM AFS 3.2 addressed the narrow use case described by the bug report by 
implementing a potentially racy change to the AFS cache manager and 
failing to address the server side.  However, that is out of scope for 
this discussion.  To the extent that there is a bug in one or more of 
the AFS server implementations it should be fixed there.

The bash fallback logic to retry the open without O_CREAT introduces a 
bypass for the kernel mode protection provided by 30aba6656f61 and 
should be removed.


Christian,

It just so happens that the workaround added to bash in 1992 masks an 
incompatibility introduced by 30aba6656f61 when the backing filesystem 
is "afs" because the ownership checks required by may_create_in_sticky() 
cannot be reliably performed based upon the kernel's local knowledge of 
the uids.  Ownership checks in "afs" are performed by the fileserver's 
evaluation of the caller's rxgk or rxkad security tokens and not by use 
of uids.  This incompatibility was only noticed after Red Hat began 
enabling fs.protected_regular by default and bash removed the fallback 
logic in the proposed 5.3 release candidates.

The proposed inode operations are to permit filesystems such as AFS 
which cannot rely upon the kernel's local uid knowledge to perform the 
required the ownership checks to perform those checks via another 
mechanism.  In the case of AFS, the fileserver already conveys the 
answer to the "is inode owned by me?" question as part of its delivery 
of caller access rights (AFSFetchStatus.CallerAccess).   The answer to 
the "do these two inodes have the same owner?" question can be 
determined via comparison of the AFSFetchStatus.Owner fields for each 
inode which belong to a uid namespace that is specific the the AFS cell 
in which the inodes are stored.  When performing this ownership check 
for network filesystems I do not believe it is safe to assume that the 
uid namespace of the network filesystem is identical to the local 
machine's uid namespace.  I think it would be safer for all network 
filesystems to answer the ownership questions using network uid values 
instead of local uid values when available.

I'm also concerned about using id-mapped values for this comparison 
because there is no restriction preventing two distinct id values from 
being mapped to the same id.

Sincerely,

Jeffrey Altman

[1] https://groups.google.com/g/gnu.bash.bug/c/6PPTfOgFdL4/m/2AQU-S1N76UJ



[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4276 bytes --]

  parent reply	other threads:[~2025-05-05 14:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-29 16:37 [PATCH] afs, bash: Fix open(O_CREAT) on an extant AFS file in a sticky dir David Howells
2025-04-29 17:35 ` Jeffrey E Altman
2025-04-30 15:09   ` Chet Ramey
2025-04-30 16:14     ` David Howells
2025-04-30 17:26       ` Jeffrey E Altman
2025-04-30 18:36         ` Chet Ramey
2025-05-05 13:14 ` Christian Brauner
     [not found]   ` <CAOdf3grbDQ-Fh2bV7XfoYvVBhgBAh7-hZyyxTNt1RfGekrA-nA@mail.gmail.com>
2025-05-05 14:42     ` Jeffrey E Altman [this message]
2025-05-14 12:50       ` Chet Ramey
2025-05-06 10:26   ` David Howells
2025-05-09 10:33     ` Christian Brauner
2025-05-12 13:02       ` [PATCH v2] " David Howells
2025-05-13  7:49         ` Christian Brauner
2025-05-13  8:30           ` David Howells
2025-05-13 15:44             ` Jeffrey E Altman
2025-05-14 12:49   ` [PATCH] " Chet Ramey

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=66c958db-0408-451d-b362-fed1f56d7c6d@auristor.com \
    --to=jaltman@auristor.com \
    --cc=brauner@kernel.org \
    --cc=champetier.etienne@gmail.com \
    --cc=chet.ramey@case.edu \
    --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