Re: [GIT PULL] compiler-attributes for v5.3-rc8
From: Linus Torvalds
Date: Thu Sep 05 2019 - 12:20:37 EST
On Wed, Sep 4, 2019 at 11:18 AM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> I was going to send this for 5.4 since it is not that trivial, but since
> you are doing an -rc8, and it fixes an oops, please consider pulling it.
I looked at this, and while it seems safe, I end up worrying.
Macro stringification isn't entirely obvious, and an unquoted string
could become corrupted if the stringification ends up not happening
immediately.
It does seem safe just because we do
#define __section(S) __attribute__((__section__(#S)))
but I had to go _check_ that we do, because it wouldn't have been safe
if there had been another level of macro expansion, because then the
argument in turn could have been expanded before it was stringified.
So sometimes you actually _want_ to pass in a string to be
stringified, because it's safer. I realize it then gets string-quoted,
but this has worked for gcc. Even if I suspect nobody really _thought_
about it.
So I'm not unhappy about the patch, but it's the kind of thing I'd
really prefer not to do at this stage.
Particularly since it seems to do other things too than just fix
double quoting. As far as I can tell, it doesn't just fix double
string quoting, it changes a lot of singly-quoted strings to use the
macro and unquotes them, ie
- __attribute__((__section__(".arch.info.init"))) = { \
+ __section(.arch.info.init) = { \
doesn't actually "fix" anything that I can see, it just uses the simpler form.
Linus