From: Al Viro <viro@zeniv.linux.org.uk>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Matthew Wilcox <willy@infradead.org>,
linux-fsdevel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Nathan Chancellor <nathan@kernel.org>
Subject: Re: [RFC] ->d_name accesses
Date: Sat, 10 Feb 2024 04:23:07 +0000 [thread overview]
Message-ID: <20240210042307.GF608142@ZenIV> (raw)
In-Reply-To: <CAKwvOdmX20oymAbxJeKSOkqgxiOEJgXgx+wy998qUviTtxv0uw@mail.gmail.com>
On Fri, Feb 09, 2024 at 11:10:10AM -0800, Nick Desaulniers wrote:
> I have 100% observed llvm throw out writes to objects declared as
> const where folks tried to write via "casting away the const" (since
> that's UB) which resulted in boot failures in the Linux kernel
> affecting android devices. I can't find the commit in question at the
> moment, but seemed to have made some kind of note in it in 2020.
> https://android-review.git.corp.google.com/c/platform/prebuilts/clang/host/linux-x86/+/1201901/1/RELEASE_NOTES.md
>
> That said, I just tried Al's union, and don't observe such optimizations.
> https://godbolt.org/z/zrj71E8W5
The really shitty part is not the missing stores; it's reordered loads.
If
spin_lock(&dentry->d_lock);
name = dentry->d_name.name;
len = dentry->d_name.len;
something(name, len);
spin_unlock(&dentry->d_lock);
has the compiler go "->d_name is const, so I can bloody well move
the load before that spin_lock() call", we really have a problem.
Can it reorder the loads of const member wrt e.g. barrier()? If
that's the case, this approach is no-go and accessor is the only
feasible alternative.
next prev parent reply other threads:[~2024-02-10 4:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-07 22:22 [RFC] ->d_name accesses Al Viro
2024-02-07 22:55 ` Matthew Wilcox
2024-02-09 19:10 ` Nick Desaulniers
2024-02-09 19:27 ` Linus Torvalds
2024-02-09 20:01 ` Al Viro
2024-02-10 4:23 ` Al Viro [this message]
2024-02-10 16:25 ` Linus Torvalds
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=20240210042307.GF608142@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=torvalds@linux-foundation.org \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.