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 checking > > ARCH_FUNC_PREFIX in buf, and

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

2021-03-05 Thread Michael Ellerman
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 checking > ARCH_FUNC_PREFIX in buf, and advancing buf like you propose, but I'm > not sure it's worth worrying

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

2021-03-05 Thread Marco Elver
On Fri, 5 Mar 2021 at 09:23, Christophe Leroy wrote: > > > > Le 05/03/2021 à 08:50, Marco Elver a écrit : > > On Fri, Mar 05, 2021 at 04:01PM +1100, Michael Ellerman wrote: > >> Marco Elver writes: > >>> On Thu, Mar 04, 2021 at 12:48PM +0100, Christophe Leroy wrote: > Le 04/03/2021 à 12:31,

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

2021-03-05 Thread Christophe Leroy
Le 05/03/2021 à 08:50, Marco Elver a écrit : On Fri, Mar 05, 2021 at 04:01PM +1100, Michael Ellerman wrote: Marco Elver writes: 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

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

2021-03-04 Thread Marco Elver
On Fri, Mar 05, 2021 at 04:01PM +1100, Michael Ellerman wrote: > Marco Elver writes: > > 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 à

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

2021-03-04 Thread Michael Ellerman
Marco Elver writes: > 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 : >> > > > >> > > > Somewhat tangentially, I also

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 > > Subject: [PATCH] kfence: fix reports if

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

2021-03-04 Thread Christophe Leroy
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 Subject: [PATCH] kfence: fix reports if constant function prefixes exist Some architectures prefix all functions with a

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 : > > > > > > > > Somewhat tangentially, I also note that e.g.

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: > >>> Le 03/03/2021 à 11:56, Marco Elver a écrit : > >

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

2021-03-04 Thread Christophe Leroy
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: 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

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

2021-03-04 Thread Christophe Leroy
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 : 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: [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 "Call Trace", so this assumption

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

2021-03-04 Thread Christophe Leroy
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 "Call Trace", so this assumption is definitely not isolated to KFENCE. Now, I have tested PPC64

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

2021-03-03 Thread Christophe Leroy
Le 03/03/2021 à 11:39, Marco Elver a écrit : 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 : [ 14.998426] BUG: KFENCE: invalid

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 following. Does it helps ? > > [ 16.837198] >

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 : > [ 14.998426] BUG: KFENCE: invalid read in >

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

2021-03-03 Thread Christophe Leroy
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 following. Does it helps ? [ 16.837198] == [ 16.848521] BUG: KFENCE:

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

2021-03-03 Thread Christophe Leroy
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 : [ 14.998426] BUG: KFENCE: invalid read in finish_task_switch.isra.0+0x54/0x23c [ 14.998426] [ 15.007061] Invalid read at 0x(ptrval):

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

2021-03-03 Thread Andreas Schwab
On Mär 03 2021, Marco Elver wrote: > On Wed, 3 Mar 2021 at 11:32, Christophe Leroy > wrote: >> ./include/linux/kern_levels.h:5:18: warning: format '%zd' expects argument >> of type 'signed size_t', >> but argument 3 has type 'ptrdiff_t' {aka 'const long int'} [-Wformat=] >> 5 | #define

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

2021-03-03 Thread Christophe Leroy
Le 02/03/2021 à 12:40, Michael Ellerman a écrit : Christophe Leroy writes: 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 : [ 14.998426] BUG: KFENCE: invalid read in

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

2021-03-02 Thread Segher Boessenkool
On Tue, Mar 02, 2021 at 10:40:03PM +1100, Michael Ellerman wrote: > >> -- Change the unwinder, if it's possible for ppc32. > > > > I don't think it is possible. > > I think this actually is the solution. > > It seems the good architectures have all added support for > arch_stack_walk(), and we

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

2021-03-02 Thread Michael Ellerman
Christophe Leroy writes: > 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 : > [ 14.998426] BUG: KFENCE: invalid read in > finish_task_switch.isra.0+0x54/0x23c > [

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 Christophe Leroy
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 : [ 14.998426] BUG: KFENCE: invalid read in finish_task_switch.isra.0+0x54/0x23c [ 14.998426] [ 15.007061] Invalid read at 0x(ptrval):

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

2021-03-02 Thread Marco Elver
On Tue, 2 Mar 2021 at 10:27, Christophe Leroy wrote: > Le 02/03/2021 à 10:21, Alexander Potapenko a écrit : > >> [ 14.998426] BUG: KFENCE: invalid read in > >> finish_task_switch.isra.0+0x54/0x23c > >> [ 14.998426] > >> [ 15.007061] Invalid read at 0x(ptrval): > >> [ 15.010906]

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

2021-03-02 Thread Alexander Potapenko
> [ 14.998426] BUG: KFENCE: invalid read in > finish_task_switch.isra.0+0x54/0x23c > [ 14.998426] > [ 15.007061] Invalid read at 0x(ptrval): > [ 15.010906] finish_task_switch.isra.0+0x54/0x23c > [ 15.015633] kunit_try_run_case+0x5c/0xd0 > [ 15.019682]

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

2021-03-02 Thread Christophe Leroy
Le 02/03/2021 à 10:21, Alexander Potapenko a écrit : [ 14.998426] BUG: KFENCE: invalid read in finish_task_switch.isra.0+0x54/0x23c [ 14.998426] [ 15.007061] Invalid read at 0x(ptrval): [ 15.010906] finish_task_switch.isra.0+0x54/0x23c [ 15.015633] kunit_try_run_case+0x5c/0xd0 [

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

2021-03-02 Thread Christophe Leroy
Le 02/03/2021 à 09:58, Marco Elver a écrit : 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

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

[RFC PATCH v1] powerpc: Enable KFENCE for PPC32

2021-03-02 Thread Christophe Leroy
Add architecture specific implementation details for KFENCE and enable KFENCE for the ppc32 architecture. In particular, this implements the required interface in . KFENCE requires that attributes for pages from its memory pool can individually be set. Therefore, force the Read/Write linear map