On Sun, Jun 7, 2020 at 6:22 AM Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx> wrote: > > Yes, I did think about that, but I thought this was the more obviously > correct approach, and that in practice one only sees the 0X44 and 0X55 > cases. I'm not sure about that - it probably depends on your umask. Because I see a lot of -rw-rw-r--. in my home directory, and it looks like I have a umask of 0002. That's just the Fedora default, I think. Looking at /etc/bashrc, it does if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then umask 002 else umask 022 fi iow, if you have the same user-name and group name, then umask is 002 by default for regular users. Honestly, I'm not sure why Fedora has that "each user has its own group" thing, but it's at least one common setup. So I think that the system you are looking at just happens to have umask 0022, which is traditional when you have just a 'user' group. > That will kinda work, except you do that mask &= MAY_RWX before > check_acl(), which cares about MAY_NOT_BLOCK and who knows what other bits. Good catch. > Perhaps this? As a whole function, I think that's a bit easier for > brain-storming. It's your patch, just with that rwx thing used instead > of mask, except for the call to check_acl(). Looks fine to me. Once we have to have rwx/mask separate, I'm not sure it's worth having that early masking at all (didn't check what the register pressure is over that "check_acl()" call, but at least it is fairly easy to follow along. Send me a patch with commit message etc, and I'll apply it. Linus