Re: [PATCH v2 61/63] struct mount: relocate MNT_WRITE_HOLD bit

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

 



On Thu, 28 Aug 2025 at 17:11, Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> What I want to avoid is compiler seeing something like
>         (unsigned long)READ_ONCE(m->mnt_pprev_for_sb) & 1
> and going "that thing is a pointer to struct mount *, either the address
> is even or it's an undefined behaviour and I can do whatever I want
> anyway; optimize it to 0".

Have you actually seen that? Because if some compiler does this, we
have tons of other places that will hit this, and we'll need to try to
figure out some generic solution, or - more likely - just disable said
compiler "optimization".

And if you really want to deal with this theoretical issue, please
just use a union for it, having both the proper pointer type and the
'unsigned long', and using the appropriate field instead of any type
casts.

                  Linus




[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