* linux-next: build problems (Was: [PATCH v3 1/2] Provide READ_ONCE_NOCHECK())
[not found] ` <1444750088-24444-2-git-send-email-aryabinin@virtuozzo.com>
@ 2015-10-15 9:18 ` Stephen Rothwell
2015-10-15 10:03 ` Andrey Ryabinin
2015-10-15 10:19 ` [PATCH] compiler, READ_ONCE: Fix build failure with some older GCC Andrey Ryabinin
0 siblings, 2 replies; 4+ messages in thread
From: Stephen Rothwell @ 2015-10-15 9:18 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: linux-kernel, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, x86,
Andrew Morton, Andy Lutomirski, Andrey Konovalov,
Kostya Serebryany, Alexander Potapenko, kasan-dev,
Borislav Petkov, Denys Vlasenko, Andi Kleen, Dmitry Vyukov,
Sasha Levin, Wolfram Gloger, linux-next
Hi Andrey,
On Tue, 13 Oct 2015 18:28:07 +0300 Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
>
> Some code may perform racy by design memory reads. This could be harmless,
> yet such code may produce KASAN warnings.
>
> To hide such accesses from KASAN this patch introduces READ_ONCE_NOCHECK()
> macro. KASAN will not check the memory accessed by READ_ONCE_NOCHECK().
>
> This patch creates __read_once_size_nocheck() a clone of
> __read_once_size_check() (renamed __read_once_size()).
> The only difference between them is 'no_sanitized_address' attribute
> appended to '*_nocheck' function. This attribute tells the compiler that
> instrumentation of memory accesses should not be applied to that function.
> We declare it as static '__maybe_unsed' because GCC is not capable to
> inline such function: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
>
> With KASAN=n READ_ONCE_NOCHECK() is just a clone of READ_ONCE().
>
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
> include/linux/compiler-gcc.h | 13 ++++++++++
> include/linux/compiler.h | 60 ++++++++++++++++++++++++++++++++++----------
> 2 files changed, 60 insertions(+), 13 deletions(-)
I am pretty sure that this patch is causing quite a bit of compile
breakage in linux-next today. During the day I compile with gcc 4.9.0
and did not see any problems with c86_64 allmodconfig, or i386
defconfig etc, but overnight we compile with older compilers (gcc 4.6.3
in particular) and are getting quite a few errors:
>From an i386 allnoconfig build:
arch/x86/entry/vdso/vdso32.so.dbg: undefined symbols found
/home/kisskb/slave/src/arch/x86/entry/vdso/Makefile:154: recipe for target 'arch/x86/entry/vdso/vdso32.so.dbg' failed
>From an x86_64 allnoconfig build:
arch/x86/entry/vdso/vclock_gettime.o: In function `__read_once_size_check':
vclock_gettime.c:(.text+0x5f): undefined reference to `memcpy'
arch/x86/entry/vdso/vgetcpu.o: In function `__read_once_size_check':
vgetcpu.c:(.text+0x2f): undefined reference to `memcpy'
and several others ...
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: linux-next: build problems (Was: [PATCH v3 1/2] Provide READ_ONCE_NOCHECK())
2015-10-15 9:18 ` linux-next: build problems (Was: [PATCH v3 1/2] Provide READ_ONCE_NOCHECK()) Stephen Rothwell
@ 2015-10-15 10:03 ` Andrey Ryabinin
2015-10-15 10:19 ` [PATCH] compiler, READ_ONCE: Fix build failure with some older GCC Andrey Ryabinin
1 sibling, 0 replies; 4+ messages in thread
From: Andrey Ryabinin @ 2015-10-15 10:03 UTC (permalink / raw)
To: Stephen Rothwell
Cc: linux-kernel, Ingo Molnar, Thomas Gleixner, H. Peter Anvin, x86,
Andrew Morton, Andy Lutomirski, Andrey Konovalov,
Kostya Serebryany, Alexander Potapenko, kasan-dev,
Borislav Petkov, Denys Vlasenko, Andi Kleen, Dmitry Vyukov,
Sasha Levin, Wolfram Gloger, linux-next
On 10/15/2015 12:18 PM, Stephen Rothwell wrote:
> Hi Andrey,
>
> On Tue, 13 Oct 2015 18:28:07 +0300 Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
>>
>> Some code may perform racy by design memory reads. This could be harmless,
>> yet such code may produce KASAN warnings.
>>
>> To hide such accesses from KASAN this patch introduces READ_ONCE_NOCHECK()
>> macro. KASAN will not check the memory accessed by READ_ONCE_NOCHECK().
>>
>> This patch creates __read_once_size_nocheck() a clone of
>> __read_once_size_check() (renamed __read_once_size()).
>> The only difference between them is 'no_sanitized_address' attribute
>> appended to '*_nocheck' function. This attribute tells the compiler that
>> instrumentation of memory accesses should not be applied to that function.
>> We declare it as static '__maybe_unsed' because GCC is not capable to
>> inline such function: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
>>
>> With KASAN=n READ_ONCE_NOCHECK() is just a clone of READ_ONCE().
>>
>> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
>> ---
>> include/linux/compiler-gcc.h | 13 ++++++++++
>> include/linux/compiler.h | 60 ++++++++++++++++++++++++++++++++++----------
>> 2 files changed, 60 insertions(+), 13 deletions(-)
>
> I am pretty sure that this patch is causing quite a bit of compile
> breakage in linux-next today. During the day I compile with gcc 4.9.0
> and did not see any problems with c86_64 allmodconfig, or i386
> defconfig etc, but overnight we compile with older compilers (gcc 4.6.3
> in particular) and are getting quite a few errors:
>
Looks like that older GCC doesn't like __alias (or combination of static __always_inline __alias).
It creates outline and unused copy of __read_once_size_check() function in the object file.
Should be easy to work around this.
> From an i386 allnoconfig build:
>
> arch/x86/entry/vdso/vdso32.so.dbg: undefined symbols found
> /home/kisskb/slave/src/arch/x86/entry/vdso/Makefile:154: recipe for target 'arch/x86/entry/vdso/vdso32.so.dbg' failed
>
> From an x86_64 allnoconfig build:
>
> arch/x86/entry/vdso/vclock_gettime.o: In function `__read_once_size_check':
> vclock_gettime.c:(.text+0x5f): undefined reference to `memcpy'
> arch/x86/entry/vdso/vgetcpu.o: In function `__read_once_size_check':
> vgetcpu.c:(.text+0x2f): undefined reference to `memcpy'
>
> and several others ...
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] compiler, READ_ONCE: Fix build failure with some older GCC
2015-10-15 9:18 ` linux-next: build problems (Was: [PATCH v3 1/2] Provide READ_ONCE_NOCHECK()) Stephen Rothwell
2015-10-15 10:03 ` Andrey Ryabinin
@ 2015-10-15 10:19 ` Andrey Ryabinin
2015-10-15 11:30 ` Ingo Molnar
1 sibling, 1 reply; 4+ messages in thread
From: Andrey Ryabinin @ 2015-10-15 10:19 UTC (permalink / raw)
To: linux-kernel
Cc: Stephen Rothwell, linux-next, Andrey Ryabinin, Ingo Molnar,
Thomas Gleixner, H. Peter Anvin, x86, Andrew Morton,
Andy Lutomirski, Andrey Konovalov, Kostya Serebryany,
Alexander Potapenko, kasan-dev, Borislav Petkov, Denys Vlasenko,
Andi Kleen, Dmitry Vyukov, Sasha Levin, Wolfram Gloger
Some old versions of GCC doesn't handle __alias (or maybe a combination
of 'static __always_inline __alias') right.
GCC creates outline and unused copy of __read_once_size_check()
function in the object file which references memcpy and causes
the build failure:
arch/x86/entry/vdso/vclock_gettime.o: In function `__read_once_size_check':
vclock_gettime.c:(.text+0x5f): undefined reference to `memcpy'
arch/x86/entry/vdso/vgetcpu.o: In function `__read_once_size_check':
vgetcpu.c:(.text+0x2f): undefined reference to `memcpy'
We could avoid using alias to work around this problem.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
include/linux/compiler.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index aa2ae4c..3436a4c 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -231,8 +231,11 @@ void __read_once_size_nocheck(const volatile void *p, void *res, int size)
__READ_ONCE_SIZE;
}
#else
-static __always_inline __alias(__read_once_size_check)
-void __read_once_size_nocheck(const volatile void *p, void *res, int size);
+static __always_inline
+void __read_once_size_nocheck(const volatile void *p, void *res, int size)
+{
+ __READ_ONCE_SIZE;
+}
#endif
static __always_inline void __write_once_size(volatile void *p, void *res, int size)
--
2.4.9
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] compiler, READ_ONCE: Fix build failure with some older GCC
2015-10-15 10:19 ` [PATCH] compiler, READ_ONCE: Fix build failure with some older GCC Andrey Ryabinin
@ 2015-10-15 11:30 ` Ingo Molnar
0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2015-10-15 11:30 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: linux-kernel, Stephen Rothwell, linux-next, Thomas Gleixner,
H. Peter Anvin, x86, Andrew Morton, Andy Lutomirski,
Andrey Konovalov, Kostya Serebryany, Alexander Potapenko,
kasan-dev, Borislav Petkov, Denys Vlasenko, Andi Kleen,
Dmitry Vyukov, Sasha Levin, Wolfram Gloger
* Andrey Ryabinin <aryabinin@virtuozzo.com> wrote:
> Some old versions of GCC doesn't handle __alias (or maybe a combination
> of 'static __always_inline __alias') right.
>
> GCC creates outline and unused copy of __read_once_size_check()
> function in the object file which references memcpy and causes
> the build failure:
> arch/x86/entry/vdso/vclock_gettime.o: In function `__read_once_size_check':
> vclock_gettime.c:(.text+0x5f): undefined reference to `memcpy'
> arch/x86/entry/vdso/vgetcpu.o: In function `__read_once_size_check':
> vgetcpu.c:(.text+0x2f): undefined reference to `memcpy'
>
> We could avoid using alias to work around this problem.
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> ---
> include/linux/compiler.h | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/compiler.h b/include/linux/compiler.h
> index aa2ae4c..3436a4c 100644
> --- a/include/linux/compiler.h
> +++ b/include/linux/compiler.h
> @@ -231,8 +231,11 @@ void __read_once_size_nocheck(const volatile void *p, void *res, int size)
> __READ_ONCE_SIZE;
> }
> #else
> -static __always_inline __alias(__read_once_size_check)
> -void __read_once_size_nocheck(const volatile void *p, void *res, int size);
> +static __always_inline
> +void __read_once_size_nocheck(const volatile void *p, void *res, int size)
> +{
> + __READ_ONCE_SIZE;
> +}
> #endif
Yeah, so could you please re-send the original two patches, with all the changes
(typo fixes, renaming, this build fix, etc.) propagated that were found in testing
and that were suggested in the review thread?
I'll remove the broken commits from linux-next meanwhile.
Thanks,
Ingo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-10-15 11:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1444739750-29241-1-git-send-email-aryabinin@virtuozzo.com>
[not found] ` <1444750088-24444-1-git-send-email-aryabinin@virtuozzo.com>
[not found] ` <1444750088-24444-2-git-send-email-aryabinin@virtuozzo.com>
2015-10-15 9:18 ` linux-next: build problems (Was: [PATCH v3 1/2] Provide READ_ONCE_NOCHECK()) Stephen Rothwell
2015-10-15 10:03 ` Andrey Ryabinin
2015-10-15 10:19 ` [PATCH] compiler, READ_ONCE: Fix build failure with some older GCC Andrey Ryabinin
2015-10-15 11:30 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).