linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/prom_init: Add memset as valid external symbol if CONFIG_KASAN=y
@ 2022-06-19  3:52 Guenter Roeck
  2022-06-19  6:45 ` Christophe Leroy
  0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2022-06-19  3:52 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Benjamin Herrenschmidt, ul Mackerras, linuxppc-dev, linux-kernel,
	Guenter Roeck, Daniel Axtens

If CONFIG_KASAN=y, powerpc:allmodconfig fails to build with the following
error.

Error: External symbol 'memset' referenced from prom_init.c

The problem was introduced with commit 41b7a347bf14 ("powerpc: Book3S
64-bit outline-only KASAN support"). So far, with CONFIG_KASAN=y, only
__memset was accepted as valid external symbol in prom_init_check.sh.
Add memset as well to fix the problem.

Fixes: 41b7a347bf14 ("powerpc: Book3S 64-bit outline-only KASAN support")
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Daniel Axtens <dja@axtens.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 arch/powerpc/kernel/prom_init_check.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index b183ab9c5107..787142b5dd26 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -16,7 +16,7 @@
 grep "^CONFIG_KASAN=y$" .config >/dev/null
 if [ $? -eq 0 ]
 then
-	MEM_FUNCS="__memcpy __memset"
+	MEM_FUNCS="__memcpy __memset memset"
 else
 	MEM_FUNCS="memcpy memset"
 fi
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/prom_init: Add memset as valid external symbol if CONFIG_KASAN=y
  2022-06-19  3:52 [PATCH] powerpc/prom_init: Add memset as valid external symbol if CONFIG_KASAN=y Guenter Roeck
@ 2022-06-19  6:45 ` Christophe Leroy
  2022-06-19  6:55   ` Christophe Leroy
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe Leroy @ 2022-06-19  6:45 UTC (permalink / raw)
  To: Guenter Roeck, Michael Ellerman
  Cc: linux-kernel, ul Mackerras, linuxppc-dev, Daniel Axtens



Le 19/06/2022 à 05:52, Guenter Roeck a écrit :
> If CONFIG_KASAN=y, powerpc:allmodconfig fails to build with the following
> error.
> 
> Error: External symbol 'memset' referenced from prom_init.c
> 
> The problem was introduced with commit 41b7a347bf14 ("powerpc: Book3S
> 64-bit outline-only KASAN support"). So far, with CONFIG_KASAN=y, only
> __memset was accepted as valid external symbol in prom_init_check.sh.
> Add memset as well to fix the problem.

No way. It is way too early to use the instrumented version of memset().

Did you try with the patch I sent ?

https://patchwork.ozlabs.org/project/linuxppc-dev/patch/3802811f7cf94f730be44688539c01bba3a3b5c0.1654875808.git.christophe.leroy@csgroup.eu/

Thanks
Christophe

> 
> Fixes: 41b7a347bf14 ("powerpc: Book3S 64-bit outline-only KASAN support")
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Daniel Axtens <dja@axtens.net>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>   arch/powerpc/kernel/prom_init_check.sh | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
> index b183ab9c5107..787142b5dd26 100644
> --- a/arch/powerpc/kernel/prom_init_check.sh
> +++ b/arch/powerpc/kernel/prom_init_check.sh
> @@ -16,7 +16,7 @@
>   grep "^CONFIG_KASAN=y$" .config >/dev/null
>   if [ $? -eq 0 ]
>   then
> -	MEM_FUNCS="__memcpy __memset"
> +	MEM_FUNCS="__memcpy __memset memset"
>   else
>   	MEM_FUNCS="memcpy memset"
>   fi

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/prom_init: Add memset as valid external symbol if CONFIG_KASAN=y
  2022-06-19  6:45 ` Christophe Leroy
@ 2022-06-19  6:55   ` Christophe Leroy
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2022-06-19  6:55 UTC (permalink / raw)
  To: Guenter Roeck, Michael Ellerman
  Cc: linuxppc-dev, ul Mackerras, linux-kernel, Daniel Axtens



Le 19/06/2022 à 08:45, Christophe Leroy a écrit :
> 
> 
> Le 19/06/2022 à 05:52, Guenter Roeck a écrit :
>> If CONFIG_KASAN=y, powerpc:allmodconfig fails to build with the following
>> error.
>>
>> Error: External symbol 'memset' referenced from prom_init.c
>>
>> The problem was introduced with commit 41b7a347bf14 ("powerpc: Book3S
>> 64-bit outline-only KASAN support"). So far, with CONFIG_KASAN=y, only
>> __memset was accepted as valid external symbol in prom_init_check.sh.
>> Add memset as well to fix the problem.
> 
> No way. It is way too early to use the instrumented version of memset().

See commit 26deb04342e3 ("powerpc: prepare string/mem functions for 
KASAN") for more details

> 
> Did you try with the patch I sent ?
> 
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/3802811f7cf94f730be44688539c01bba3a3b5c0.1654875808.git.christophe.leroy@csgroup.eu/
> 
> Thanks
> Christophe
> 
>>
>> Fixes: 41b7a347bf14 ("powerpc: Book3S 64-bit outline-only KASAN support")
>> Cc: Michael Ellerman <mpe@ellerman.id.au>
>> Cc: Daniel Axtens <dja@axtens.net>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>    arch/powerpc/kernel/prom_init_check.sh | 2 +-
>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
>> index b183ab9c5107..787142b5dd26 100644
>> --- a/arch/powerpc/kernel/prom_init_check.sh
>> +++ b/arch/powerpc/kernel/prom_init_check.sh
>> @@ -16,7 +16,7 @@
>>    grep "^CONFIG_KASAN=y$" .config >/dev/null
>>    if [ $? -eq 0 ]
>>    then
>> -	MEM_FUNCS="__memcpy __memset"
>> +	MEM_FUNCS="__memcpy __memset memset"
>>    else
>>    	MEM_FUNCS="memcpy memset"
>>    fi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-19  6:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-19  3:52 [PATCH] powerpc/prom_init: Add memset as valid external symbol if CONFIG_KASAN=y Guenter Roeck
2022-06-19  6:45 ` Christophe Leroy
2022-06-19  6:55   ` Christophe Leroy

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).