Re: [PATCH] powerpc/kcsan: Properly instrument arch_spin_unlock()

2023-05-30 Thread Marco Elver
) with kcsan_mb(). > > Signed-off-by: Christophe Leroy Acked-by: Marco Elver > --- > arch/powerpc/include/asm/simple_spinlock.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/powerpc/include/asm/simple_spinlock.h > b/arch/powerpc/include/asm/simple_spi

Re: [PATCH 0/3] Extend KCSAN to all powerpc

2023-05-12 Thread Marco Elver
/{32,book3e}: kcsan: Extend KCSAN Support Acked-by: Marco Elver

Re: [PATCH 1/3] kcsan: Don't expect 64 bits atomic builtins from 32 bits architectures

2023-05-12 Thread Marco Elver
c builtins. Only > include DEFINE_TSAN_ATOMIC_OPS(64) on 64 bits architectures. > > Fixes: 0f8ad5f2e934 ("kcsan: Add support for atomic builtins") > Suggested-by: Marco Elver > Signed-off-by: Christophe Leroy Reviewed-by: Marco Elver Do you have your own tree to take

Re: [PATCH] mm: kfence: Fix false positives on big endian

2023-05-05 Thread Marco Elver
;mm: kfence: improve the performance of __kfence_alloc() > and __kfence_free()") > Signed-off-by: Michael Ellerman Reviewed-by: Marco Elver Andrew, is the Fixes enough to make it to stable as well or do we also need Cc: stable? Thanks, -- Marco > --- > mm/kfence/kfence.h | 2

Re: [PATCH mm] kasan, powerpc: Don't rename memintrinsics if compiler adds prefixes

2023-02-27 Thread Marco Elver
On Mon, 27 Feb 2023 at 23:16, Andrew Morton wrote: > > On Mon, 27 Feb 2023 10:47:27 +0100 Marco Elver wrote: > > > With appropriate compiler support [1], KASAN builds use __asan prefixed > > meminstrinsics, and KASAN no longer overrides memcpy/memset/memmove. > &

[PATCH mm] kasan, powerpc: Don't rename memintrinsics if compiler adds prefixes

2023-02-27 Thread Marco Elver
/ Reported-by: kernel test robot Signed-off-by: Marco Elver --- arch/powerpc/include/asm/kasan.h | 2 +- arch/powerpc/include/asm/string.h | 15 +++ arch/powerpc/kernel/prom_init_check.sh | 9 +++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/arch

Re: [PATCH 1/2] kcsan: xtensa: Add atomic builtin stubs for 32-bit systems

2023-02-16 Thread Marco Elver
: Max Filippov > > This series should also be addressed to KCSAN Maintainers, shouldn't it ? > > KCSAN > M:Marco Elver > R:Dmitry Vyukov > L:kasan-...@googlegroups.com > S:Maintained > F:Documentation/dev-tools/kcsan.rst > F:include/linux/kcsan

Re: [PATCH v4 7/7] powerpc: kcsan: Add KCSAN Support

2023-02-08 Thread Marco Elver
On Wed, 8 Feb 2023 at 04:23, Rohan McLure wrote: > > Enable HAVE_ARCH_KCSAN on all powerpc platforms, permitting use of the > kernel concurrency sanitiser through the CONFIG_KCSAN_* kconfig options. > KCSAN requires compiler builtins __atomic_* 64-bit values, and so only > report support on

Re: [PATCH v3 1/7] kernel/fork: convert vma assignment to a memcpy

2023-02-07 Thread Marco Elver
On Tue, 7 Feb 2023 at 18:24, Suren Baghdasaryan wrote: > > On Tue, Feb 7, 2023 at 9:16 AM Marco Elver wrote: > > > > On Thu, Jan 26, 2023 at 09:27AM -0800, Paul E. McKenney wrote: > > > On Wed, Jan 25, 2023 at 05:34:49PM -0800, Andrew Morton wrote: > > >

Re: [PATCH v3 1/7] kernel/fork: convert vma assignment to a memcpy

2023-02-07 Thread Marco Elver
On Thu, Jan 26, 2023 at 09:27AM -0800, Paul E. McKenney wrote: > On Wed, Jan 25, 2023 at 05:34:49PM -0800, Andrew Morton wrote: > > On Wed, 25 Jan 2023 16:50:01 -0800 Suren Baghdasaryan > > wrote: > > > > > On Wed, Jan 25, 2023 at 4:22 PM Andrew Morton > > > wrote: > > > > > > > > On Wed, 25

Re: [PATCH AUTOSEL 5.19 05/29] powerpc/hw_breakpoint: Avoid relying on caller synchronization

2022-10-17 Thread Marco Elver
On Mon, 17 Oct 2022 at 17:08, Sasha Levin wrote: > > From: Marco Elver > > [ Upstream commit f95e5a3d59011eec1257d0e76de1e1f8969d426f ] > > Internal data structures (cpu_bps, task_bps) of powerpc's hw_breakpoint > implementation have relied on nr_bp_mutex serializing acces

Re: [PATCH v14 4/4] kasan: use MAX_PTRS_PER_* for early shadow tables

2021-06-17 Thread Marco Elver
_PTRS_PER_*, which are constant. > > Suggested-by: Christophe Leroy > Suggested-by: Balbir Singh > Reviewed-by: Christophe Leroy > Reviewed-by: Balbir Singh > Signed-off-by: Daniel Axtens Reviewed-by: Marco Elver > --- > include/linux/kasan.h | 6 +++--- > mm/kasan/

Re: [PATCH v14 3/4] mm: define default MAX_PTRS_PER_* in include/pgtable.h

2021-06-17 Thread Marco Elver
d place default definitions > in include/pgtable.h. These define MAX_PTRS_PER_x to be PTRS_PER_x unless > an architecture has defined MAX_PTRS_PER_x in its arch headers. > > Clean up pgtable-nop4d.h and s390's MAX_PTRS_PER_P4D definitions while > we're at it: both can just pick up the d

Re: [PATCH v14 1/4] kasan: allow an architecture to disable inline instrumentation

2021-06-17 Thread Marco Elver
instrumented. Inline instrumentation in DT would > unconditionally attempt to touch the shadow region, which we won't have > set up yet, and would crash. We can make outline mode wait for the arch to > be ready, but we can't change what the compiler inserts for inline mode. > > Signed-o

Re: [PATCH v14 2/4] kasan: allow architectures to provide an outline readiness check

2021-06-17 Thread Marco Elver
With Christophe's suggestion: Reviewed-by: Marco Elver > -- > > Both previous RFCs for ppc64 - by 2 different people - have > needed this trick! See: > - https://lore.kernel.org/patchwork/patch/592820/ # ppc64 hash series > - https://patchwork.ozlabs.org/patch/795211/

Re: [PATCH v13 1/3] kasan: allow an architecture to disable inline instrumentation

2021-06-16 Thread Marco Elver
instrumented. Inline instrumentation in DT would > unconditionally attempt to touch the shadow region, which we won't have > set up yet, and would crash. We can make outline mode wait for the arch to > be ready, but we can't change what the compiler inserts for inline mode. > > Signed-off-by: Dani

Re: [PATCH v13 3/3] kasan: define and use MAX_PTRS_PER_* for early shadow tables

2021-06-16 Thread Marco Elver
On Wed, 16 Jun 2021 at 10:03, Daniel Axtens wrote: [...] > diff --git a/include/linux/kasan.h b/include/linux/kasan.h > index 768d7d342757..fd65f477ac92 100644 > --- a/include/linux/kasan.h > +++ b/include/linux/kasan.h > @@ -40,10 +40,22 @@ struct kunit_kasan_expectation { > #define

Re: [PATCH v13 2/3] kasan: allow architectures to provide an outline readiness check

2021-06-16 Thread Marco Elver
should have a negligible performance penalty. > > This will only work in outline mode, so an arch must specify > ARCH_DISABLE_KASAN_INLINE if it requires this. > > Cc: Balbir Singh > Cc: Aneesh Kumar K.V > Suggested-by: Christophe Leroy > Signed-off-by: Daniel Axtens Revie

Re: [PATCH v12 0/6] KASAN core changes for ppc64 radix KASAN

2021-06-15 Thread Marco Elver
[+Cc Andrey] On Tue, 15 Jun 2021 at 03:47, Daniel Axtens wrote: > > Building on the work of Christophe, Aneesh and Balbir, I've ported > KASAN to 64-bit Book3S kernels running on the Radix MMU. > > I've been trying this for a while, but we keep having collisions > between the kasan code in the

Re: [PATCH v12 2/6] kasan: allow architectures to provide an outline readiness check

2021-06-15 Thread Marco Elver
On Tue, 15 Jun 2021 at 03:47, Daniel Axtens wrote: > > Allow architectures to define a kasan_arch_is_ready() hook that bails > out of any function that's about to touch the shadow unless the arch > says that it is ready for the memory to be accessed. This is fairly > uninvasive and should have a

Re: [PATCH v12 1/6] kasan: allow an architecture to disable inline instrumentation

2021-06-15 Thread Marco Elver
On Tue, 15 Jun 2021 at 03:47, Daniel Axtens wrote: > > For annoying architectural reasons, it's very difficult to support inline > instrumentation on powerpc64. > > Add a Kconfig flag to allow an arch to disable inline. (It's a bit > annoying to be 'backwards', but I'm not aware of any way to

Re: [PATCH v11 1/6] kasan: allow an architecture to disable inline instrumentation

2021-03-22 Thread Marco Elver
On Fri, 19 Mar 2021 at 15:41, Daniel Axtens wrote: > > For annoying architectural reasons, it's very difficult to support inline > instrumentation on powerpc64. > > Add a Kconfig flag to allow an arch to disable inline. (It's a bit > annoying to be 'backwards', but I'm not aware of any way to

Re: [PATCH v11 2/6] kasan: allow architectures to provide an outline readiness check

2021-03-22 Thread Marco Elver
On Fri, 19 Mar 2021 at 15:41, Daniel Axtens wrote: > Allow architectures to define a kasan_arch_is_ready() hook that bails > out of any function that's about to touch the shadow unless the arch > says that it is ready for the memory to be accessed. This is fairly > uninvasive and should have a

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-05 Thread Marco Elver
On Fri, 5 Mar 2021 at 12:49, Michael Ellerman wrote: > Marco Elver writes: > ... > > > > The choice is between: > > > > 1. ARCH_FUNC_PREFIX (as a matter of fact, the ARCH_FUNC_PREFIX patch > > is already in -mm). Perhaps we could optimize it further, by

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Marco Elver
On Thu, 4 Mar 2021 at 19:51, Mark Rutland wrote: > On Thu, Mar 04, 2021 at 07:22:53PM +0100, Marco Elver wrote: > > On Thu, 4 Mar 2021 at 19:02, Mark Rutland wrote: > > > On Thu, Mar 04, 2021 at 06:25:33PM +0100, Marco Elver wrote: > > > > On Thu, Mar 04, 2021

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Marco Elver
On Thu, 4 Mar 2021 at 19:02, Mark Rutland wrote: > On Thu, Mar 04, 2021 at 06:25:33PM +0100, Marco Elver wrote: > > On Thu, Mar 04, 2021 at 04:59PM +, Mark Rutland wrote: > > > On Thu, Mar 04, 2021 at 04:30:34PM +0100, Marco Elver wrote: > > > > On Thu, 4 M

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Marco Elver
On Thu, Mar 04, 2021 at 04:59PM +, Mark Rutland wrote: > On Thu, Mar 04, 2021 at 04:30:34PM +0100, Marco Elver wrote: > > On Thu, 4 Mar 2021 at 15:57, Mark Rutland wrote: > > > [adding Mark Brown] > > > > > > The bigger problem her

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Marco Elver
On Thu, 4 Mar 2021 at 15:57, Mark Rutland wrote: > [adding Mark Brown] > > On Wed, Mar 03, 2021 at 04:20:43PM +0100, Marco Elver wrote: > > On Wed, Mar 03, 2021 at 03:52PM +0100, Christophe Leroy wrote: > > > Le 03/03/2021 � 15:38, Marco Elver a �crit�: > > &

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-04 Thread Marco Elver
On Thu, 4 Mar 2021 at 15:08, Christophe Leroy wrote: > > > > Le 04/03/2021 à 13:48, Marco Elver a écrit : > > From d118080eb9552073f5dcf1f86198f3d86d5ea850 Mon Sep 17 00:00:00 2001 > > From: Marco Elver > > Date: Thu, 4 Mar 2021 13:15:51 +0100 > >

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-04 Thread Marco Elver
On Thu, Mar 04, 2021 at 12:48PM +0100, Christophe Leroy wrote: > Le 04/03/2021 à 12:31, Marco Elver a écrit : > > On Thu, 4 Mar 2021 at 12:23, Christophe Leroy > > wrote: > > > Le 03/03/2021 à 11:56, Marco Elver a écrit : > > > > > > > > Somewh

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-04 Thread Marco Elver
On Thu, 4 Mar 2021 at 13:00, Christophe Leroy wrote: > > > > Le 04/03/2021 à 12:48, Christophe Leroy a écrit : > > > > > > Le 04/03/2021 à 12:31, Marco Elver a écrit : > >> On Thu, 4 Mar 2021 at 12:23, Christophe Leroy > >> wrote:

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-04 Thread Marco Elver
On Thu, 4 Mar 2021 at 12:23, Christophe Leroy wrote: > Le 03/03/2021 à 11:56, Marco Elver a écrit : > > > > Somewhat tangentially, I also note that e.g. show_regs(regs) (which > > was printed along the KFENCE report above) didn't include the top > > frame in the "

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-03 Thread Marco Elver
On Wed, Mar 03, 2021 at 03:52PM +0100, Christophe Leroy wrote: > Le 03/03/2021 à 15:38, Marco Elver a écrit : > > On Wed, 3 Mar 2021 at 15:09, Christophe Leroy > > wrote: > > > > > > It seems like all other sane architectures, namely x86 and arm64 > > &

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-03 Thread Marco Elver
0024 907f0028 > 90ff001c > [ 15.096613] 3949000a 915f0020 3d40c0d1 3d00c085 <8929000a> 3908adb0 > 812a4b98 3d40c02f > [ 15.104612] > == > > Signed-off-by: Christophe Leroy Acked-by: Marco Elver Thank you, I think this looks like the right solution. Jus

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-03 Thread Marco Elver
On Wed, 3 Mar 2021 at 11:39, Christophe Leroy wrote: > > > > Le 02/03/2021 à 12:39, Marco Elver a écrit : > > On Tue, 2 Mar 2021 at 12:21, Christophe Leroy > > wrote: > > [...] > >>>> Booting with 'no_hash_pointers" I get the foll

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-03 Thread Marco Elver
On Wed, 3 Mar 2021 at 11:32, Christophe Leroy wrote: > > > > Le 02/03/2021 à 10:53, Marco Elver a écrit : > > On Tue, 2 Mar 2021 at 10:27, Christophe Leroy > > wrote: > >> Le 02/03/2021 à 10:21, Alexander Potapenko a écrit : > >>&

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-02 Thread Marco Elver
On Tue, 2 Mar 2021 at 12:21, Christophe Leroy wrote: [...] > >> Booting with 'no_hash_pointers" I get the following. Does it helps ? > >> > >> [ 16.837198] > >> == > >> [ 16.848521] BUG: KFENCE: invalid read in > >>

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-02 Thread Marco Elver
might be code-gen related, which results in some subtle issue with stack unwinding. There are a few things to try, if you feel like it: -- Change the unwinder, if it's possible for ppc32. -- Add code to test_invalid_access(), to get the compiler to emit different code. E.g. add a bunch (unnecessary)

Re: [RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-02 Thread Marco Elver
On Tue, 2 Mar 2021 at 09:37, Christophe Leroy wrote: > Add architecture specific implementation details for KFENCE and enable > KFENCE for the ppc32 architecture. In particular, this implements the > required interface in . Nice! > KFENCE requires that attributes for pages from its memory pool

Re: [PATCH v2 1/2] kasan: support instrumented bitops combined with generic bitops

2019-11-14 Thread Marco Elver
On Mon, 28 Oct 2019 at 14:56, Daniel Axtens wrote: > > Hi all, > > Would it be possible to get an Ack from a KASAN maintainter? mpe is > happy to take this through powerpc but would like an ack first. > > Regards, > Daniel > > >> Currently bitops-instrumented.h assumes that the architecture