Re: [PATCH] afs, bash: Fix open(O_CREAT) on an extant AFS file in a sticky dir

Christian Brauner <[email protected]> Mon, 5 May 2025 15:14:35 +0200
Newsgroups gmane.linux.file-systems,gmane.comp.file-systems.openafs.devel,gmane.linux.kernel.cifs,gmane.linux.kernel
Message-ID <20250505-erproben-zeltlager-4c16f07b96ae@brauner>
On Tue, Apr 29, 2025 at 05:37:31PM +0100, David Howells wrote:
>     
> Bash has a work around in redir_open() that causes open(O_CREAT) of a file
> in a sticky directory to be retried without O_CREAT if bash was built with
> AFS workarounds configured:
> 
>         #if defined (AFS)
>               if ((fd < 0) && (errno == EACCES))
>             {
>               fd = open (filename, flags & ~O_CREAT, mode);
>               errno = EACCES;    /* restore errno */
>             }
> 
>         #endif /* AFS */
> 
> This works around the kernel not being able to validly check the
> current_fsuid() against i_uid on the file or the directory because the
> uidspaces of the system and of AFS may well be disjoint.  The problem lies
> with the uid checks in may_create_in_sticky().
> 
> However, the bash work around is going to be removed:

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.