Re: [PATCH v2 1/8] mnt_idmapping: add vfs{g,u}id_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 21, 2022 at 04:14:47PM +0200, Christian Brauner wrote:
> +/**
> + * kuid_eq_vfsuid - check whether kuid and vfsuid have the same value
> + * @kuid: the kuid to compare
> + * @vfsuid: the vfsuid to compare
> + *
> + * Check whether @kuid and @vfsuid have the same values.
> + *
> + * Return: true if @kuid and @vfsuid have the same value, false if not.
> + */
> +static inline bool kuid_eq_vfsuid(kuid_t kuid, vfsuid_t vfsuid)
> +{
> +	return __vfsuid_val(vfsuid) == __kuid_val(kuid);
> +}

Something that I think would be helpful is if this and other comparison
functions always returned false for comparisons with invalid, e.g.:

static inline bool kuid_eq_vfsuid(kuid_t kuid, vfsuid_t vfsuid)
{
        return vfsuid_valid(vfsuid) && __vfsuid_val(vfsuid) == __kuid_val(kuid);
}

I can't imagine any cases where we would want even two invalid ids to
evaluate as being equal, and so as it is now we have to take great care
to ensure that we never end up with comparisons between two invalid ids.

Honestly I'd like to see that for kuid_t comparisons too, but I suppose
that's a little out of scope here.

Seth



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux