linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
@ 2022-09-28 17:47 Florian Fainelli
  2022-09-28 18:01 ` Kees Cook
  2022-10-04  8:51 ` Linus Walleij
  0 siblings, 2 replies; 13+ messages in thread
From: Florian Fainelli @ 2022-09-28 17:47 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Seung-Woo Kim, Florian Fainelli, Russell King, Arnd Bergmann,
	Linus Walleij, Ard Biesheuvel, Russell King (Oracle),
	Steven Rostedt (Google),
	Nick Hawkins, John Crispin, Masahiro Yamada, Nicolas Schier,
	Nick Desaulniers, Kees Cook, open list, bcm-kernel-feedback-list,
	anand.gore, william.zhang

From: Seung-Woo Kim <sw0312.kim@samsung.com>

To enable UBSAN on ARM, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
from arm confiuration. Basic kernel bootup test is passed on arm with
CONFIG_UBSAN_SANITIZE_ALL enabled.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
[florian: rebased against v6.0-rc7]
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 arch/arm/Kconfig                  | 1 +
 arch/arm/boot/compressed/Makefile | 1 +
 arch/arm/vdso/Makefile            | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 87badeae3181..c90aa58eab7f 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -27,6 +27,7 @@ config ARM
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG if CPU_V7 || CPU_V7M || CPU_V6K
 	select ARCH_HAS_GCOV_PROFILE_ALL
 	select ARCH_KEEP_MEMBLOCK
+	select ARCH_HAS_UBSAN_SANITIZE_ALL
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_NO_SG_CHAIN if !ARM_HAS_SG_CHAIN
 	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 41bcbb460fac..2cc2af13779e 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -27,6 +27,7 @@ KASAN_SANITIZE		:= n
 
 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
 KCOV_INSTRUMENT		:= n
+UBSAN_SANITIZE		:= n
 
 #
 # Architecture dependencies
diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index 8ca1c9f262a2..a7ec06ce3785 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -37,6 +37,7 @@ endif
 
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 # Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
 KCOV_INSTRUMENT := n
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
  2022-09-28 17:47 [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL Florian Fainelli
@ 2022-09-28 18:01 ` Kees Cook
  2022-09-28 23:06   ` Florian Fainelli
  2022-10-04  8:51 ` Linus Walleij
  1 sibling, 1 reply; 13+ messages in thread
From: Kees Cook @ 2022-09-28 18:01 UTC (permalink / raw)
  To: Florian Fainelli, Ard Biesheuvel
  Cc: linux-arm-kernel, Seung-Woo Kim, Russell King, Arnd Bergmann,
	Linus Walleij, Russell King (Oracle), Steven Rostedt (Google),
	Nick Hawkins, John Crispin, Masahiro Yamada, Nicolas Schier,
	Nick Desaulniers, open list, bcm-kernel-feedback-list,
	anand.gore, william.zhang

On Wed, Sep 28, 2022 at 10:47:39AM -0700, Florian Fainelli wrote:
> From: Seung-Woo Kim <sw0312.kim@samsung.com>
> 
> To enable UBSAN on ARM, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
> from arm confiuration. Basic kernel bootup test is passed on arm with
> CONFIG_UBSAN_SANITIZE_ALL enabled.
> 
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> [florian: rebased against v6.0-rc7]
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Ah-ha, thanks for testing this. What devices did you check this on? I
know boot-up on arm32 can be very device-specific.

Which UBSAN configs did you try?

Thanks!

-Kees

-- 
Kees Cook

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
  2022-09-28 18:01 ` Kees Cook
@ 2022-09-28 23:06   ` Florian Fainelli
  2022-09-29  0:33     ` William Zhang
  0 siblings, 1 reply; 13+ messages in thread
From: Florian Fainelli @ 2022-09-28 23:06 UTC (permalink / raw)
  To: Kees Cook, Ard Biesheuvel
  Cc: linux-arm-kernel, Seung-Woo Kim, Russell King, Arnd Bergmann,
	Linus Walleij, Russell King (Oracle), Steven Rostedt (Google),
	Nick Hawkins, John Crispin, Masahiro Yamada, Nicolas Schier,
	Nick Desaulniers, open list, bcm-kernel-feedback-list,
	anand.gore, william.zhang

On 9/28/22 11:01, Kees Cook wrote:
> On Wed, Sep 28, 2022 at 10:47:39AM -0700, Florian Fainelli wrote:
>> From: Seung-Woo Kim <sw0312.kim@samsung.com>
>>
>> To enable UBSAN on ARM, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
>> from arm confiuration. Basic kernel bootup test is passed on arm with
>> CONFIG_UBSAN_SANITIZE_ALL enabled.
>>
>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>> [florian: rebased against v6.0-rc7]
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> Ah-ha, thanks for testing this. What devices did you check this on? I
> know boot-up on arm32 can be very device-specific.

This was tested on an ARCH_BRCMSTB system which is using an ARMv8 CPU 
booted in AArch32 mode, so virtually equivalent to armv7l. A raspberry 
Pi 4B is also happily booting with it.

> 
> Which UBSAN configs did you try?

All CONFIG_UBSAN_* work with the exception of CONFIG_UBSAN_ALIGNMENT on 
my ARCH_BRCMSTB system, however it works fine on the Raspberry Pi 4B.
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
  2022-09-28 23:06   ` Florian Fainelli
@ 2022-09-29  0:33     ` William Zhang
  2022-09-29  8:10       ` Kees Cook
  0 siblings, 1 reply; 13+ messages in thread
From: William Zhang @ 2022-09-29  0:33 UTC (permalink / raw)
  To: Florian Fainelli, Kees Cook, Ard Biesheuvel
  Cc: linux-arm-kernel, Seung-Woo Kim, Russell King, Arnd Bergmann,
	Linus Walleij, Russell King (Oracle), Steven Rostedt (Google),
	Nick Hawkins, John Crispin, Masahiro Yamada, Nicolas Schier,
	Nick Desaulniers, open list, bcm-kernel-feedback-list,
	anand.gore


[-- Attachment #1.1: Type: text/plain, Size: 1558 bytes --]



On 09/28/2022 04:06 PM, Florian Fainelli wrote:
> On 9/28/22 11:01, Kees Cook wrote:
>> On Wed, Sep 28, 2022 at 10:47:39AM -0700, Florian Fainelli wrote:
>>> From: Seung-Woo Kim <sw0312.kim@samsung.com>
>>>
>>> To enable UBSAN on ARM, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
>>> from arm confiuration. Basic kernel bootup test is passed on arm with
>>> CONFIG_UBSAN_SANITIZE_ALL enabled.
>>>
>>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>>> [florian: rebased against v6.0-rc7]
>>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>>
>> Ah-ha, thanks for testing this. What devices did you check this on? I
>> know boot-up on arm32 can be very device-specific.
> 
> This was tested on an ARCH_BRCMSTB system which is using an ARMv8 CPU 
> booted in AArch32 mode, so virtually equivalent to armv7l. A raspberry 
> Pi 4B is also happily booting with it.
> 
>>
>> Which UBSAN configs did you try?
> 
> All CONFIG_UBSAN_* work with the exception of CONFIG_UBSAN_ALIGNMENT on 
> my ARCH_BRCMSTB system, however it works fine on the Raspberry Pi 4B.
> Florian

I also tested on a BCM63138 board (ARM A9) under ARCH_BCMBCA using the 
multi_v7_defconfig with all the UBSAN configs enabled except 
UBSAN_ALIGNMENT and board boots up fine. Turning on UBSAN_ALIGNMENT 
results in flood of false positive misaligned-access warnings. This is 
fine as ARM supports unaligned access.

It did catch an out-of-band bug in mach-sunxi smp code.  I will submit a 
separate patch to fix that bug.

Tested-by: William Zhang <william.zhang@broadcom.com>

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
  2022-09-29  0:33     ` William Zhang
@ 2022-09-29  8:10       ` Kees Cook
  2022-09-30 21:34         ` Florian Fainelli
  0 siblings, 1 reply; 13+ messages in thread
From: Kees Cook @ 2022-09-29  8:10 UTC (permalink / raw)
  To: William Zhang
  Cc: Florian Fainelli, Ard Biesheuvel, linux-arm-kernel,
	Seung-Woo Kim, Russell King, Arnd Bergmann, Linus Walleij,
	Russell King (Oracle), Steven Rostedt (Google),
	Nick Hawkins, John Crispin, Masahiro Yamada, Nicolas Schier,
	Nick Desaulniers, open list, bcm-kernel-feedback-list,
	anand.gore

On Wed, Sep 28, 2022 at 05:33:14PM -0700, William Zhang wrote:
> 
> 
> On 09/28/2022 04:06 PM, Florian Fainelli wrote:
> > On 9/28/22 11:01, Kees Cook wrote:
> > > On Wed, Sep 28, 2022 at 10:47:39AM -0700, Florian Fainelli wrote:
> > > > From: Seung-Woo Kim <sw0312.kim@samsung.com>
> > > > 
> > > > To enable UBSAN on ARM, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
> > > > from arm confiuration. Basic kernel bootup test is passed on arm with
> > > > CONFIG_UBSAN_SANITIZE_ALL enabled.
> > > > 
> > > > Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> > > > [florian: rebased against v6.0-rc7]
> > > > Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> > > 
> > > Ah-ha, thanks for testing this. What devices did you check this on? I
> > > know boot-up on arm32 can be very device-specific.
> > 
> > This was tested on an ARCH_BRCMSTB system which is using an ARMv8 CPU
> > booted in AArch32 mode, so virtually equivalent to armv7l. A raspberry
> > Pi 4B is also happily booting with it.
> > 
> > > 
> > > Which UBSAN configs did you try?
> > 
> > All CONFIG_UBSAN_* work with the exception of CONFIG_UBSAN_ALIGNMENT on
> > my ARCH_BRCMSTB system, however it works fine on the Raspberry Pi 4B.
> > Florian
> 
> I also tested on a BCM63138 board (ARM A9) under ARCH_BCMBCA using the
> multi_v7_defconfig with all the UBSAN configs enabled except UBSAN_ALIGNMENT
> and board boots up fine. Turning on UBSAN_ALIGNMENT results in flood of
> false positive misaligned-access warnings. This is fine as ARM supports
> unaligned access.
> 
> It did catch an out-of-band bug in mach-sunxi smp code.  I will submit a
> separate patch to fix that bug.

Yay! :) Move coverage is great. :)

> 
> Tested-by: William Zhang <william.zhang@broadcom.com>

Thanks!

-- 
Kees Cook

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
  2022-09-29  8:10       ` Kees Cook
@ 2022-09-30 21:34         ` Florian Fainelli
  0 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2022-09-30 21:34 UTC (permalink / raw)
  To: Kees Cook, William Zhang
  Cc: Ard Biesheuvel, linux-arm-kernel, Seung-Woo Kim, Russell King,
	Arnd Bergmann, Linus Walleij, Russell King (Oracle),
	Steven Rostedt (Google),
	Nick Hawkins, John Crispin, Masahiro Yamada, Nicolas Schier,
	Nick Desaulniers, open list, bcm-kernel-feedback-list,
	anand.gore

On 9/29/22 01:10, Kees Cook wrote:
> On Wed, Sep 28, 2022 at 05:33:14PM -0700, William Zhang wrote:
>>
>>
>> On 09/28/2022 04:06 PM, Florian Fainelli wrote:
>>> On 9/28/22 11:01, Kees Cook wrote:
>>>> On Wed, Sep 28, 2022 at 10:47:39AM -0700, Florian Fainelli wrote:
>>>>> From: Seung-Woo Kim <sw0312.kim@samsung.com>
>>>>>
>>>>> To enable UBSAN on ARM, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
>>>>> from arm confiuration. Basic kernel bootup test is passed on arm with
>>>>> CONFIG_UBSAN_SANITIZE_ALL enabled.
>>>>>
>>>>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>>>>> [florian: rebased against v6.0-rc7]
>>>>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>>>>
>>>> Ah-ha, thanks for testing this. What devices did you check this on? I
>>>> know boot-up on arm32 can be very device-specific.
>>>
>>> This was tested on an ARCH_BRCMSTB system which is using an ARMv8 CPU
>>> booted in AArch32 mode, so virtually equivalent to armv7l. A raspberry
>>> Pi 4B is also happily booting with it.
>>>
>>>>
>>>> Which UBSAN configs did you try?
>>>
>>> All CONFIG_UBSAN_* work with the exception of CONFIG_UBSAN_ALIGNMENT on
>>> my ARCH_BRCMSTB system, however it works fine on the Raspberry Pi 4B.
>>> Florian
>>
>> I also tested on a BCM63138 board (ARM A9) under ARCH_BCMBCA using the
>> multi_v7_defconfig with all the UBSAN configs enabled except UBSAN_ALIGNMENT
>> and board boots up fine. Turning on UBSAN_ALIGNMENT results in flood of
>> false positive misaligned-access warnings. This is fine as ARM supports
>> unaligned access.
>>
>> It did catch an out-of-band bug in mach-sunxi smp code.  I will submit a
>> separate patch to fix that bug.
> 
> Yay! :) Move coverage is great. :)
> 
>>
>> Tested-by: William Zhang <william.zhang@broadcom.com>

Submitted to the patch tracker:

https://www.armlinux.org.uk/developer/patches/viewpatch.php?id=9253/1
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
  2022-09-28 17:47 [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL Florian Fainelli
  2022-09-28 18:01 ` Kees Cook
@ 2022-10-04  8:51 ` Linus Walleij
  2022-10-12 19:46   ` Florian Fainelli
  1 sibling, 1 reply; 13+ messages in thread
From: Linus Walleij @ 2022-10-04  8:51 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: linux-arm-kernel, Seung-Woo Kim, Russell King, Arnd Bergmann,
	Ard Biesheuvel, Russell King (Oracle), Steven Rostedt (Google),
	Nick Hawkins, John Crispin, Masahiro Yamada, Nicolas Schier,
	Nick Desaulniers, Kees Cook, open list, bcm-kernel-feedback-list,
	anand.gore, william.zhang

On Wed, Sep 28, 2022 at 7:47 PM Florian Fainelli <f.fainelli@gmail.com> wrote:

> From: Seung-Woo Kim <sw0312.kim@samsung.com>
>
> To enable UBSAN on ARM, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
> from arm confiuration. Basic kernel bootup test is passed on arm with
> CONFIG_UBSAN_SANITIZE_ALL enabled.
>
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> [florian: rebased against v6.0-rc7]
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Pretty cool that it "just works", I was thinking to myself that I
should try this one
day. Sorry I was late to look at the patch.

Have you also looked at KCSAN?

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
  2022-10-04  8:51 ` Linus Walleij
@ 2022-10-12 19:46   ` Florian Fainelli
  0 siblings, 0 replies; 13+ messages in thread
From: Florian Fainelli @ 2022-10-12 19:46 UTC (permalink / raw)
  To: Linus Walleij, Florian Fainelli
  Cc: linux-arm-kernel, Seung-Woo Kim, Russell King, Arnd Bergmann,
	Ard Biesheuvel, Russell King (Oracle), Steven Rostedt (Google),
	Nick Hawkins, John Crispin, Masahiro Yamada, Nicolas Schier,
	Nick Desaulniers, Kees Cook, open list, bcm-kernel-feedback-list,
	anand.gore, william.zhang

On 10/4/22 01:51, Linus Walleij wrote:
> On Wed, Sep 28, 2022 at 7:47 PM Florian Fainelli <f.fainelli@gmail.com> wrote:
> 
>> From: Seung-Woo Kim <sw0312.kim@samsung.com>
>>
>> To enable UBSAN on ARM, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
>> from arm confiuration. Basic kernel bootup test is passed on arm with
>> CONFIG_UBSAN_SANITIZE_ALL enabled.
>>
>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>> [florian: rebased against v6.0-rc7]
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> Pretty cool that it "just works", I was thinking to myself that I
> should try this one
> day. Sorry I was late to look at the patch.
> 
> Have you also looked at KCSAN?

Not yet, that would be next. Most often, at least for ARCH_BRCMSTB the 
same hardware and set of drivers run on ARM64 which is typically much 
more feature full, so we get coverage on *SAN features that way.
--
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
  2018-03-13  4:53 ` [PATCH] arm: " Jinbum Park
  2018-03-13  5:13   ` Jaehoon Chung
@ 2018-03-13  5:18   ` Jaehoon Chung
  1 sibling, 0 replies; 13+ messages in thread
From: Jaehoon Chung @ 2018-03-13  5:18 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/13/2018 01:53 PM, Jinbum Park wrote:
> To enable UBSAN on arm, ARCH_HAS_UBSAN_SANITIZE_ALL is needed to be selected.
> 
> Basic test has passed on Raspberry Pi2, Raspbian jessi lite with
> CONFIG_UBSAN_SANITIZE_ALL, CONFIG_UBSAN_NULL.

This patch had been already sent from Seungwoo.

https://patchwork.kernel.org/patch/9344477/

Best Regards,
Jaehoon Chung

> 
> Signed-off-by: Jinbum Park <jinb.park@samsung.com>
> ---
>  arch/arm/Kconfig                  | 1 +
>  arch/arm/boot/compressed/Makefile | 1 +
>  arch/arm/vdso/Makefile            | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 1878083..bdd1561 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -7,6 +7,7 @@ config ARM
>  	select ARCH_HAS_DEBUG_VIRTUAL if MMU
>  	select ARCH_HAS_DEVMEM_IS_ALLOWED
>  	select ARCH_HAS_ELF_RANDOMIZE
> +	select ARCH_HAS_UBSAN_SANITIZE_ALL
>  	select ARCH_HAS_SET_MEMORY
>  	select ARCH_HAS_PHYS_TO_DMA
>  	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
> index 45a6b9b..1b374ba 100644
> --- a/arch/arm/boot/compressed/Makefile
> +++ b/arch/arm/boot/compressed/Makefile
> @@ -24,6 +24,7 @@ OBJS		+= hyp-stub.o
>  endif
>  
>  GCOV_PROFILE		:= n
> +UBSAN_SANITIZE		:= n
>  
>  #
>  # Architecture dependencies
> diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
> index bb411821..05597f7 100644
> --- a/arch/arm/vdso/Makefile
> +++ b/arch/arm/vdso/Makefile
> @@ -29,6 +29,7 @@ CFLAGS_vgettimeofday.o = -O2
>  
>  # Disable gcov profiling for VDSO code
>  GCOV_PROFILE := n
> +UBSAN_SANITIZE := n
>  
>  # Force dependency
>  $(obj)/vdso.o : $(obj)/vdso.so
> 

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

* [PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
  2018-03-13  4:53 ` [PATCH] arm: " Jinbum Park
@ 2018-03-13  5:13   ` Jaehoon Chung
  2018-03-13  5:18   ` Jaehoon Chung
  1 sibling, 0 replies; 13+ messages in thread
From: Jaehoon Chung @ 2018-03-13  5:13 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/13/2018 01:53 PM, Jinbum Park wrote:
> To enable UBSAN on arm, ARCH_HAS_UBSAN_SANITIZE_ALL is needed to be selected.
> 
> Basic test has passed on Raspberry Pi2, Raspbian jessi lite with
> CONFIG_UBSAN_SANITIZE_ALL, CONFIG_UBSAN_NULL.
> 
> Signed-off-by: Jinbum Park <jinb.park@samsung.com>
> ---
>  arch/arm/Kconfig                  | 1 +
>  arch/arm/boot/compressed/Makefile | 1 +
>  arch/arm/vdso/Makefile            | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 1878083..bdd1561 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -7,6 +7,7 @@ config ARM
>  	select ARCH_HAS_DEBUG_VIRTUAL if MMU
>  	select ARCH_HAS_DEVMEM_IS_ALLOWED
>  	select ARCH_HAS_ELF_RANDOMIZE
> +	select ARCH_HAS_UBSAN_SANITIZE_ALL
>  	select ARCH_HAS_SET_MEMORY
>  	select ARCH_HAS_PHYS_TO_DMA
>  	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
> diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
> index 45a6b9b..1b374ba 100644
> --- a/arch/arm/boot/compressed/Makefile
> +++ b/arch/arm/boot/compressed/Makefile
> @@ -24,6 +24,7 @@ OBJS		+= hyp-stub.o
>  endif
>  
>  GCOV_PROFILE		:= n
> +UBSAN_SANITIZE		:= n
>  
>  #
>  # Architecture dependencies
> diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
> index bb411821..05597f7 100644
> --- a/arch/arm/vdso/Makefile
> +++ b/arch/arm/vdso/Makefile
> @@ -29,6 +29,7 @@ CFLAGS_vgettimeofday.o = -O2
>  
>  # Disable gcov profiling for VDSO code
>  GCOV_PROFILE := n
> +UBSAN_SANITIZE := n
>  
>  # Force dependency
>  $(obj)/vdso.o : $(obj)/vdso.so
> 

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

* [PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
       [not found] <CGME20180313045357epcms1p34fb1e2ad09a8288017058c414c21ce26@epcms1p3>
@ 2018-03-13  4:53 ` Jinbum Park
  2018-03-13  5:13   ` Jaehoon Chung
  2018-03-13  5:18   ` Jaehoon Chung
  0 siblings, 2 replies; 13+ messages in thread
From: Jinbum Park @ 2018-03-13  4:53 UTC (permalink / raw)
  To: linux-arm-kernel

To enable UBSAN on arm, ARCH_HAS_UBSAN_SANITIZE_ALL is needed to be selected.

Basic test has passed on Raspberry Pi2, Raspbian jessi lite with
CONFIG_UBSAN_SANITIZE_ALL, CONFIG_UBSAN_NULL.

Signed-off-by: Jinbum Park <jinb.park@samsung.com>
---
 arch/arm/Kconfig                  | 1 +
 arch/arm/boot/compressed/Makefile | 1 +
 arch/arm/vdso/Makefile            | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 1878083..bdd1561 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -7,6 +7,7 @@ config ARM
 	select ARCH_HAS_DEBUG_VIRTUAL if MMU
 	select ARCH_HAS_DEVMEM_IS_ALLOWED
 	select ARCH_HAS_ELF_RANDOMIZE
+	select ARCH_HAS_UBSAN_SANITIZE_ALL
 	select ARCH_HAS_SET_MEMORY
 	select ARCH_HAS_PHYS_TO_DMA
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 45a6b9b..1b374ba 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -24,6 +24,7 @@ OBJS		+= hyp-stub.o
 endif
 
 GCOV_PROFILE		:= n
+UBSAN_SANITIZE		:= n
 
 #
 # Architecture dependencies
diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index bb411821..05597f7 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -29,6 +29,7 @@ CFLAGS_vgettimeofday.o = -O2
 
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 # Force dependency
 $(obj)/vdso.o : $(obj)/vdso.so
-- 
1.9.1

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

* [PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
       [not found] <CGME20171024055601epcas2p34a22b2b1fb3f1f71ed875125d87a47c4@epcas2p3.samsung.com>
@ 2017-10-24  5:55 ` Seung-Woo Kim
  0 siblings, 0 replies; 13+ messages in thread
From: Seung-Woo Kim @ 2017-10-24  5:55 UTC (permalink / raw)
  To: linux-arm-kernel

Select ARCH_HAS_UBSAN_SANITIZE_ALL from arm confiuration to enable UBSAN
on arm.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
 arch/arm/Kconfig                  |    1 +
 arch/arm/boot/compressed/Makefile |    2 ++
 arch/arm/vdso/Makefile            |    2 ++
 3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7888c98..5eb3c89 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -11,6 +11,7 @@ config ARM
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_UBSAN_SANITIZE_ALL
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX
 	select ARCH_OPTIONAL_KERNEL_RWX_DEFAULT if CPU_V7
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index d50430c..8f06ab2 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -24,6 +24,8 @@ endif
 
 GCOV_PROFILE		:= n
 
+UBSAN_SANITIZE		:= n
+
 #
 # Architecture dependencies
 #
diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index 59a8fa7..e343700 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -29,6 +29,8 @@ CFLAGS_vgettimeofday.o = -O2
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
 
+UBSAN_SANITIZE := n
+
 # Force dependency
 $(obj)/vdso.o : $(obj)/vdso.so
 
-- 
1.7.4.1

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

* [PATCH] arm: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL
@ 2016-09-22  4:49 Seung-Woo Kim
  0 siblings, 0 replies; 13+ messages in thread
From: Seung-Woo Kim @ 2016-09-22  4:49 UTC (permalink / raw)
  To: linux-arm-kernel

To enable UBSAN on arm, this patch enables ARCH_HAS_UBSAN_SANITIZE_ALL
from arm confiuration. Basic kernel bootup test is passed on arm with
CONFIG_UBSAN_SANITIZE_ALL enabled.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
This is resend of the patch I already sent, [1], without RFC tag.
[1] https://patchwork.kernel.org/patch/9189533/

I tested kernel build and basic boot up on Exynos5422, Exynos4412 and
Exynos3250 SoC boards.

At previous time on [1], there were some build error on other systems,
but they were caused by driver bug or gcc bug. So I think UBSAN on ARM
can be re-considered.
---
 arch/arm/Kconfig                  |    1 +
 arch/arm/boot/compressed/Makefile |    1 +
 arch/arm/vdso/Makefile            |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a9c4e48..a80f9b1 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -7,6 +7,7 @@ config ARM
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_UBSAN_SANITIZE_ALL
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_SUPPORTS_ATOMIC_RMW
 	select ARCH_USE_BUILTIN_BSWAP
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index d50430c..883374f 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -23,6 +23,7 @@ OBJS		+= hyp-stub.o
 endif
 
 GCOV_PROFILE		:= n
+UBSAN_SANITIZE		:= n
 
 #
 # Architecture dependencies
diff --git a/arch/arm/vdso/Makefile b/arch/arm/vdso/Makefile
index 59a8fa7..cb90e59 100644
--- a/arch/arm/vdso/Makefile
+++ b/arch/arm/vdso/Makefile
@@ -28,6 +28,7 @@ CFLAGS_vgettimeofday.o = -O2
 
 # Disable gcov profiling for VDSO code
 GCOV_PROFILE := n
+UBSAN_SANITIZE := n
 
 # Force dependency
 $(obj)/vdso.o : $(obj)/vdso.so
-- 
1.7.4.1

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

end of thread, other threads:[~2022-10-12 19:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-28 17:47 [PATCH] ARM: ubsan: select ARCH_HAS_UBSAN_SANITIZE_ALL Florian Fainelli
2022-09-28 18:01 ` Kees Cook
2022-09-28 23:06   ` Florian Fainelli
2022-09-29  0:33     ` William Zhang
2022-09-29  8:10       ` Kees Cook
2022-09-30 21:34         ` Florian Fainelli
2022-10-04  8:51 ` Linus Walleij
2022-10-12 19:46   ` Florian Fainelli
     [not found] <CGME20180313045357epcms1p34fb1e2ad09a8288017058c414c21ce26@epcms1p3>
2018-03-13  4:53 ` [PATCH] arm: " Jinbum Park
2018-03-13  5:13   ` Jaehoon Chung
2018-03-13  5:18   ` Jaehoon Chung
     [not found] <CGME20171024055601epcas2p34a22b2b1fb3f1f71ed875125d87a47c4@epcas2p3.samsung.com>
2017-10-24  5:55 ` Seung-Woo Kim
  -- strict thread matches above, loose matches on Subject: below --
2016-09-22  4:49 Seung-Woo Kim

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