2020-11-07 18:35:21

by Valdis Klētnieks

[permalink] [raw]
Subject: next-20201105 - build issue with KASAN on ARM

commit d6d51a96c7d63b7450860a3037f2d62388286a52
Author: Linus Walleij <[email protected]>
Date: Sun Oct 25 23:52:08 2020 +0100

ARM: 9014/2: Replace string mem* functions for KASan

I'm trying to figure out why this has 3 Tested-By: tags but blows up for fairly obvious
reasons on ARM.....

CC arch/arm/boot/compressed/string.o
arch/arm/boot/compressed/string.c:24:1: error: attribute 'alias' argument not a string
void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias(memcpy);
^~~~
arch/arm/boot/compressed/string.c:25:1: error: attribute 'alias' argument not a string
void *__memmove(void *__dest, __const void *__src, size_t count) __alias(memmove);
^~~~
arch/arm/boot/compressed/string.c:26:1: error: attribute 'alias' argument not a string
void *__memset(void *s, int c, size_t count) __alias(memset);
^~~~
make[2]: *** [scripts/Makefile.build:283: arch/arm/boot/compressed/string.o] Error 1
make[1]: *** [arch/arm/boot/Makefile:64: arch/arm/boot/compressed/vmlinux] Error 2


Attachments:
(No filename) (849.00 B)

2020-11-07 20:06:56

by Nathan Chancellor

[permalink] [raw]
Subject: Re: next-20201105 - build issue with KASAN on ARM

Hi Valdis,

On Sat, Nov 07, 2020 at 01:33:20PM -0500, Valdis Klētnieks wrote:
> commit d6d51a96c7d63b7450860a3037f2d62388286a52
> Author: Linus Walleij <[email protected]>
> Date: Sun Oct 25 23:52:08 2020 +0100
>
> ARM: 9014/2: Replace string mem* functions for KASan
>
> I'm trying to figure out why this has 3 Tested-By: tags but blows up for fairly obvious
> reasons on ARM.....

Because it builds fine if you check out Russell's branch. This build
error only happens because of a treewide change in -mm that was applied
after the ARM merge:

https://lore.kernel.org/linux-arm-kernel/20201106094434.GA3268933@ubuntu-m3-large-x86/

https://lore.kernel.org/linux-arm-kernel/20201106180929.GD2959494@ubuntu-m3-large-x86/

Stephen could apply that diff as a fixup for the -mm patch when he
builds -next or I can send it as a formal patch for him to apply.

> CC arch/arm/boot/compressed/string.o
> arch/arm/boot/compressed/string.c:24:1: error: attribute 'alias' argument not a string
> void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias(memcpy);
> ^~~~
> arch/arm/boot/compressed/string.c:25:1: error: attribute 'alias' argument not a string
> void *__memmove(void *__dest, __const void *__src, size_t count) __alias(memmove);
> ^~~~
> arch/arm/boot/compressed/string.c:26:1: error: attribute 'alias' argument not a string
> void *__memset(void *s, int c, size_t count) __alias(memset);
> ^~~~
> make[2]: *** [scripts/Makefile.build:283: arch/arm/boot/compressed/string.o] Error 1
> make[1]: *** [arch/arm/boot/Makefile:64: arch/arm/boot/compressed/vmlinux] Error 2
>

Cheers,
Nathan

2020-11-08 22:21:31

by Stephen Rothwell

[permalink] [raw]
Subject: Re: next-20201105 - build issue with KASAN on ARM

Hi Nathan,

On Sat, 7 Nov 2020 13:04:53 -0700 Nathan Chancellor <[email protected]> wrote:
>
> Because it builds fine if you check out Russell's branch. This build
> error only happens because of a treewide change in -mm that was applied
> after the ARM merge:
>
> https://lore.kernel.org/linux-arm-kernel/20201106094434.GA3268933@ubuntu-m3-large-x86/
>
> https://lore.kernel.org/linux-arm-kernel/20201106180929.GD2959494@ubuntu-m3-large-x86/
>
> Stephen could apply that diff as a fixup for the -mm patch when he
> builds -next or I can send it as a formal patch for him to apply.

I have applied the patch by hand today, but please send a patch to
Andrew pointing out that it should go in his post -next series (or
possibly he should also move
treewide-remove-stringification-from-__alias-macro-definition.patch
into the post -next series).

--
Cheers,
Stephen Rothwell


Attachments:
(No filename) (499.00 B)
OpenPGP digital signature

2020-11-08 22:23:54

by Nathan Chancellor

[permalink] [raw]
Subject: Re: next-20201105 - build issue with KASAN on ARM

Hi Stephen,

On Mon, Nov 09, 2020 at 09:19:19AM +1100, Stephen Rothwell wrote:
> Hi Nathan,
>
> On Sat, 7 Nov 2020 13:04:53 -0700 Nathan Chancellor <[email protected]> wrote:
> >
> > Because it builds fine if you check out Russell's branch. This build
> > error only happens because of a treewide change in -mm that was applied
> > after the ARM merge:
> >
> > https://lore.kernel.org/linux-arm-kernel/20201106094434.GA3268933@ubuntu-m3-large-x86/
> >
> > https://lore.kernel.org/linux-arm-kernel/20201106180929.GD2959494@ubuntu-m3-large-x86/
> >
> > Stephen could apply that diff as a fixup for the -mm patch when he
> > builds -next or I can send it as a formal patch for him to apply.
>
> I have applied the patch by hand today, but please send a patch to
> Andrew pointing out that it should go in his post -next series (or
> possibly he should also move
> treewide-remove-stringification-from-__alias-macro-definition.patch
> into the post -next series).

Ack, thank you for the guidance, as I am unsure how exactly contexual
changes like this are supposed to be handled when dealing with a quilt
series. I will send a formal patch soon.

Cheers,
Nathan

2020-11-09 00:23:50

by Nathan Chancellor

[permalink] [raw]
Subject: [PATCH] ARM: boot: Quote aliased symbol names in string.c

Patch "treewide: Remove stringification from __alias macro definition"
causes arguments to __alias to no longer be quoted automatically, which
breaks CONFIG_KASAN on ARM after commit d6d51a96c7d6 ("ARM: 9014/2:
Replace string mem* functions for KASan"):

arch/arm/boot/compressed/string.c:24:1: error: attribute 'alias' argument not a string
24 | void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias(memcpy);
| ^~~~
arch/arm/boot/compressed/string.c:25:1: error: attribute 'alias' argument not a string
25 | void *__memmove(void *__dest, __const void *__src, size_t count) __alias(memmove);
| ^~~~
arch/arm/boot/compressed/string.c:26:1: error: attribute 'alias' argument not a string
26 | void *__memset(void *s, int c, size_t count) __alias(memset);
| ^~~~
make[3]: *** [scripts/Makefile.build:283: arch/arm/boot/compressed/string.o] Error 1

Quote the names like the treewide patch does so there is no more error.

Reported-by: Naresh Kamboju <[email protected]>
Reported-by: Valdis Klētnieks <[email protected]>
Signed-off-by: Nathan Chancellor <[email protected]>
---

Hi Andrew,

Stephen said I should send this along to you so that it can be applied
as part of the post -next series. Please let me know if you need any
more information or clarification, I tried to document it succinctly in
the commit message.

Cheers,
Nathan

arch/arm/boot/compressed/string.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/compressed/string.c b/arch/arm/boot/compressed/string.c
index 8c0fa276d994..cc6198f8a348 100644
--- a/arch/arm/boot/compressed/string.c
+++ b/arch/arm/boot/compressed/string.c
@@ -21,9 +21,9 @@
#undef memcpy
#undef memmove
#undef memset
-void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias(memcpy);
-void *__memmove(void *__dest, __const void *__src, size_t count) __alias(memmove);
-void *__memset(void *s, int c, size_t count) __alias(memset);
+void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias("memcpy");
+void *__memmove(void *__dest, __const void *__src, size_t count) __alias("memmove");
+void *__memset(void *s, int c, size_t count) __alias("memset");
#endif

void *memcpy(void *__dest, __const void *__src, size_t __n)
--
2.29.2

2020-11-09 07:42:44

by Ard Biesheuvel

[permalink] [raw]
Subject: Re: [PATCH] ARM: boot: Quote aliased symbol names in string.c

On Mon, 9 Nov 2020 at 01:19, Nathan Chancellor <[email protected]> wrote:
>
> Patch "treewide: Remove stringification from __alias macro definition"
> causes arguments to __alias to no longer be quoted automatically, which
> breaks CONFIG_KASAN on ARM after commit d6d51a96c7d6 ("ARM: 9014/2:
> Replace string mem* functions for KASan"):
>
> arch/arm/boot/compressed/string.c:24:1: error: attribute 'alias' argument not a string
> 24 | void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias(memcpy);
> | ^~~~
> arch/arm/boot/compressed/string.c:25:1: error: attribute 'alias' argument not a string
> 25 | void *__memmove(void *__dest, __const void *__src, size_t count) __alias(memmove);
> | ^~~~
> arch/arm/boot/compressed/string.c:26:1: error: attribute 'alias' argument not a string
> 26 | void *__memset(void *s, int c, size_t count) __alias(memset);
> | ^~~~
> make[3]: *** [scripts/Makefile.build:283: arch/arm/boot/compressed/string.o] Error 1
>
> Quote the names like the treewide patch does so there is no more error.
>
> Reported-by: Naresh Kamboju <[email protected]>
> Reported-by: Valdis Klētnieks <[email protected]>
> Signed-off-by: Nathan Chancellor <[email protected]>

Acked-by: Ard Biesheuvel <[email protected]>

> ---
>
> Hi Andrew,
>
> Stephen said I should send this along to you so that it can be applied
> as part of the post -next series. Please let me know if you need any
> more information or clarification, I tried to document it succinctly in
> the commit message.
>
> Cheers,
> Nathan
>
> arch/arm/boot/compressed/string.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/boot/compressed/string.c b/arch/arm/boot/compressed/string.c
> index 8c0fa276d994..cc6198f8a348 100644
> --- a/arch/arm/boot/compressed/string.c
> +++ b/arch/arm/boot/compressed/string.c
> @@ -21,9 +21,9 @@
> #undef memcpy
> #undef memmove
> #undef memset
> -void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias(memcpy);
> -void *__memmove(void *__dest, __const void *__src, size_t count) __alias(memmove);
> -void *__memset(void *s, int c, size_t count) __alias(memset);
> +void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias("memcpy");
> +void *__memmove(void *__dest, __const void *__src, size_t count) __alias("memmove");
> +void *__memset(void *s, int c, size_t count) __alias("memset");
> #endif
>
> void *memcpy(void *__dest, __const void *__src, size_t __n)
> --
> 2.29.2
>

2020-11-09 16:09:17

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] ARM: boot: Quote aliased symbol names in string.c

On Mon, Nov 9, 2020 at 1:19 AM Nathan Chancellor
<[email protected]> wrote:

> Patch "treewide: Remove stringification from __alias macro definition"
> causes arguments to __alias to no longer be quoted automatically, which
> breaks CONFIG_KASAN on ARM after commit d6d51a96c7d6 ("ARM: 9014/2:
> Replace string mem* functions for KASan"):
>
> arch/arm/boot/compressed/string.c:24:1: error: attribute 'alias' argument not a string
> 24 | void *__memcpy(void *__dest, __const void *__src, size_t __n) __alias(memcpy);
> | ^~~~
> arch/arm/boot/compressed/string.c:25:1: error: attribute 'alias' argument not a string
> 25 | void *__memmove(void *__dest, __const void *__src, size_t count) __alias(memmove);
> | ^~~~
> arch/arm/boot/compressed/string.c:26:1: error: attribute 'alias' argument not a string
> 26 | void *__memset(void *s, int c, size_t count) __alias(memset);
> | ^~~~
> make[3]: *** [scripts/Makefile.build:283: arch/arm/boot/compressed/string.o] Error 1
>
> Quote the names like the treewide patch does so there is no more error.
>
> Reported-by: Naresh Kamboju <[email protected]>
> Reported-by: Valdis Klētnieks <[email protected]>
> Signed-off-by: Nathan Chancellor <[email protected]>

Reviewed-by: Linus Walleij <[email protected]>

> Hi Andrew,
>
> Stephen said I should send this along to you so that it can be applied
> as part of the post -next series. Please let me know if you need any
> more information or clarification, I tried to document it succinctly in
> the commit message.

I wasn't even aware that there was such a thing as post-next.

Thanks,
Linus Walleij