Re: [PATCH] Enable '-Werror' by default for all kernel builds

From: Linus Torvalds
Date: Wed Sep 08 2021 - 00:55:47 EST


On Tue, Sep 7, 2021 at 9:28 PM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
>
> It is seen with gcc 11.x whenever a memXXX or strXXX function parameter
> is a pointer to a fixed address.

I wonder why I don't see it with gcc 11.2 here on x86-64.

> gcc is happy if "(void *) 0xfffc1f2c"
> is passed to a global function which does nothing but return the address,
> such as:
>
> void *sanitize_address(void *address)
> {
> return address;
> }

We have had reasons to do things like that before for somewhat similar
(well, opposite) reasons - trying to disassociate some pointer from
its originating symbol type.

Look at RELOC_HIDE().

It might be worth it having something similar for "absolute_pointer()".

Entirely untested "written-in-the-MUA" garbage:

#define absolute_pointer(val) \
({ void *__res; __asm__("":"=r" (__res):"0" ((unsigned
long)(val))); __res; })

I dunno.

Linus