[PATCH v13 7/8] powerpc/mm: implement set_memory_attr()

2021-05-09 Thread Jordan Niethe
. Signed-off-by: Christophe Leroy Reported-by: kbuild test robot [ruscur: cast "data" to unsigned long instead of int] Signed-off-by: Russell Currey Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/set_memory.h | 2 ++ arch/powerpc/mm/pageattr.c

[PATCH v12 6/8] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-05-05 Thread Jordan Niethe
on !PPC_BOOK3S_604 - make module_alloc() use PAGE_KERNEL protection] Signed-off-by: Jordan Niethe --- v10: - Predicate on !PPC_BOOK3S_604 - Make module_alloc() use PAGE_KERNEL protection v11: - Neaten up --- arch/powerpc/Kconfig | 1 + arch/powerpc/kernel/module.c | 4 +++- 2

[PATCH v12 4/8] powerpc/bpf: Remove bpf_jit_free()

2021-05-05 Thread Jordan Niethe
ot be used for powerpc. Commit d53d2f78cead ("bpf: Use vmalloc special flag") moved keeping track of read-only memory to vmalloc. This included removing bpf_jit_binary_unlock_ro(). Therefore there is no reason powerpc needs its own bpf_jit_free(). Remove it. Signed-off-by: Jordan Niethe --

[PATCH v12 7/8] powerpc/mm: implement set_memory_attr()

2021-05-05 Thread Jordan Niethe
. Signed-off-by: Christophe Leroy Reported-by: kbuild test robot [ruscur: cast "data" to unsigned long instead of int] Signed-off-by: Russell Currey Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/set_memory.h | 2 ++ arch/powerpc/mm/pageattr.c

[PATCH v12 5/8] powerpc/bpf: Write protect JIT code

2021-05-05 Thread Jordan Niethe
Add the necessary call to bpf_jit_binary_lock_ro() to remove write and add exec permissions to the JIT image after it has finished being written. Without CONFIG_STRICT_MODULE_RWX the image will be writable and executable until the call to bpf_jit_binary_lock_ro(). Signed-off-by: Jordan Niethe

[PATCH v12 3/8] powerpc/kprobes: Mark newly allocated probes as ROX

2021-05-05 Thread Jordan Niethe
-by: Christophe Leroy [jpn: Reword commit message, switch to __vmalloc_node_range()] Signed-off-by: Jordan Niethe --- v9: - vmalloc_exec() no longer exists - Set the page to RW before freeing it v10: - use __vmalloc_node_range() v11: - Neaten up v12: - Switch from __vmalloc_node_range

[PATCH v12 2/8] powerpc/lib/code-patching: Set up Strict RWX patching earlier

2021-05-05 Thread Jordan Niethe
a nop. setup_text_poke_area() relies on kernel virtual memory, cpu hotplug and per_cpu_areas being setup. setup_per_cpu_areas(), boot_cpu_hotplug_init() and mm_init() are called before poking_init(). Turn setup_text_poke_area() into poking_init(). Reviewed-by: Russell Currey Signed-off-by: Jordan

[PATCH v12 1/8] powerpc/mm: Implement set_memory() routines

2021-05-05 Thread Jordan Niethe
to manipulate ptes - Radix: Add ptesync after set_pte_at()] Signed-off-by: Jordan Niethe --- v10: WARN if trying to change the hash linear map v11: - Update copywrite dates - Allow set memory functions to be used without Strict RWX - Hash: Disallow certain regions and add comment explaining why

[PATCH v12 0/8] powerpc: Further Strict RWX support

2021-05-05 Thread Jordan Niethe
the previous revision is available here: https://lore.kernel.org/linuxppc-dev/20210429031602.2606654-1-jniet...@gmail.com/ The changes in v12 for each patch: Christophe Leroy (2): powerpc/mm: implement set_memory_attr() powerpc/32: use set_memory_attr() Jordan Niethe (3): powerpc/lib/code

[PATCH v12 8/8] powerpc/32: use set_memory_attr()

2021-05-05 Thread Jordan Niethe
is already done by the callers. Signed-off-by: Christophe Leroy [ruscur: rebase on powerpc/merge with Christophe's new patches] Signed-off-by: Russell Currey Signed-off-by: Jordan Niethe --- arch/powerpc/mm/pgtable_32.c | 60 ++-- 1 file changed, 10 insertions

Re: [PATCH v13 1/8] powerpc/mm: Implement set_memory() routines

2021-05-12 Thread Jordan Niethe
On Mon, May 10, 2021 at 11:18 AM Jordan Niethe wrote: > > From: Russell Currey > > The set_memory_{ro/rw/nx/x}() functions are required for > STRICT_MODULE_RWX, and are generally useful primitives to have. This > implementation is designed to be generic across powerpc's

Re: [PATCH v8 27/30] powerpc/kprobes: Don't allow breakpoints on suffixes

2021-05-19 Thread Jordan Niethe
On Wed, May 19, 2021 at 6:11 PM Naveen N. Rao wrote: > > Christophe Leroy wrote: > > > > > > Le 06/05/2020 à 05:40, Jordan Niethe a écrit : > >> Do not allow inserting breakpoints on the suffix of a prefix instruction > >> in kprobes. > >> >

Re: [PATCH v14 7/9] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-05-19 Thread Jordan Niethe
On Mon, May 17, 2021 at 4:49 PM Christophe Leroy wrote: > > > > Le 17/05/2021 à 05:28, Jordan Niethe a écrit : > > From: Russell Currey > > > > To enable strict module RWX on powerpc, set: > > > > CONFIG_STRICT_MODULE_RWX=y > > > > You s

Re: [PATCH v14 6/9] powerpc/bpf: Write protect JIT code

2021-05-19 Thread Jordan Niethe
On Mon, May 17, 2021 at 4:40 PM Christophe Leroy wrote: > > > > Le 17/05/2021 à 05:28, Jordan Niethe a écrit : > > Add the necessary call to bpf_jit_binary_lock_ro() to remove write and > > add exec permissions to the JIT image after it has finished being >

Re: [PATCH v11 3/9] powerpc: Always define MODULES_{VADDR,END}

2021-05-03 Thread Jordan Niethe
On Mon, May 3, 2021 at 3:57 PM Christophe Leroy wrote: > > > > Le 03/05/2021 à 07:39, Jordan Niethe a écrit : > > On Thu, Apr 29, 2021 at 3:04 PM Christophe Leroy > > wrote: > >> > >> > >> > >> Le 29/04/2021 à 05:15, Jordan Niethe a é

Re: [PATCH v11 3/9] powerpc: Always define MODULES_{VADDR,END}

2021-05-03 Thread Jordan Niethe
On Mon, May 3, 2021 at 4:22 PM Christophe Leroy wrote: > > > > Le 03/05/2021 à 08:16, Jordan Niethe a écrit : > > On Mon, May 3, 2021 at 3:57 PM Christophe Leroy > > wrote: > >> > >> > >> > >> Le 03/05/2021 à 07:39, Jordan Niethe a éc

Re: [PATCH v11 3/9] powerpc: Always define MODULES_{VADDR,END}

2021-05-02 Thread Jordan Niethe
On Thu, Apr 29, 2021 at 3:04 PM Christophe Leroy wrote: > > > > Le 29/04/2021 à 05:15, Jordan Niethe a écrit : > > If MODULES_{VADDR,END} are not defined set them to VMALLOC_START and > > VMALLOC_END respectively. This reduces the need for special cases. For > > e

Re: [PATCH v11 1/9] powerpc/mm: Implement set_memory() routines

2021-05-02 Thread Jordan Niethe
On Thu, Apr 29, 2021 at 5:32 PM Christophe Leroy wrote: > > > > Le 29/04/2021 à 05:15, Jordan Niethe a écrit : > > From: Russell Currey > > > > The set_memory_{ro/rw/nx/x}() functions are required for > > STRICT_MODULE_RWX, and are generally useful primitiv

Re: PPC32: Boot regression on Nintendo Wii, after create_branch rework in 5.8

2021-04-27 Thread Jordan Niethe
in the 5.8 development cycle: > > commit 7c95d8893fb55869882c9f68f4c94840dc43f18f > Author: Jordan Niethe > Date: Wed May 6 13:40:25 2020 +1000 > > powerpc: Change calling convention for create_branch() et. al. > > create_branch(), create_cond_branch() and translate_br

[PATCH v11 1/9] powerpc/mm: Implement set_memory() routines

2021-04-28 Thread Jordan Niethe
-by: Christophe Leroy [jpn: - Allow set memory functions to be used without Strict RWX - Hash: Disallow certain regions - Have change_page_attr() take function pointers to manipulate ptes - Radix: Add ptesync after set_pte_at()] Signed-off-by: Jordan Niethe --- v10: WARN if trying to change

[PATCH v11 0/9] powerpc: Further Strict RWX support

2021-04-28 Thread Jordan Niethe
/ The changes in v11 for each patch: Christophe Leroy (2): powerpc/mm: implement set_memory_attr() powerpc/32: use set_memory_attr() Jordan Niethe (4): powerpc/lib/code-patching: Set up Strict RWX patching earlier powerpc: Always define MODULES_{VADDR,END} v11: - Consider more places

[PATCH v11 9/9] powerpc/32: use set_memory_attr()

2021-04-28 Thread Jordan Niethe
is already done by the callers. Signed-off-by: Christophe Leroy [ruscur: rebase on powerpc/merge with Christophe's new patches] Signed-off-by: Russell Currey Signed-off-by: Jordan Niethe --- arch/powerpc/mm/pgtable_32.c | 60 ++-- 1 file changed, 10 insertions

[PATCH v11 7/9] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-04-28 Thread Jordan Niethe
on !PPC_BOOK3S_604 - make module_alloc() use PAGE_KERNEL protection] Signed-off-by: Jordan Niethe --- v10: - Predicate on !PPC_BOOK3S_604 - Make module_alloc() use PAGE_KERNEL protection v11: - Neaten up --- arch/powerpc/Kconfig | 1 + arch/powerpc/kernel/module.c | 9 ++--- 2

[PATCH v11 8/9] powerpc/mm: implement set_memory_attr()

2021-04-28 Thread Jordan Niethe
. Signed-off-by: Christophe Leroy Reported-by: kbuild test robot [ruscur: cast "data" to unsigned long instead of int] Signed-off-by: Russell Currey Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/set_memory.h | 2 ++ arch/powerpc/mm/pageattr.c

[PATCH v11 6/9] powerpc/bpf: Write protect JIT code

2021-04-28 Thread Jordan Niethe
Add the necessary call to bpf_jit_binary_lock_ro() to remove write and add exec permissions to the JIT image after it has finished being written. Without CONFIG_STRICT_MODULE_RWX the image will be writable and executable until the call to bpf_jit_binary_lock_ro(). Signed-off-by: Jordan Niethe

[PATCH v11 3/9] powerpc: Always define MODULES_{VADDR,END}

2021-04-28 Thread Jordan Niethe
conditional code in other places that need to allocate from the module region (i.e., kprobes). Signed-off-by: Jordan Niethe --- v10: New to series v11: - Consider more places MODULES_VADDR was being used --- arch/powerpc/include/asm/pgtable.h| 11 +++ arch/powerpc/kernel/module.c

[PATCH v11 2/9] powerpc/lib/code-patching: Set up Strict RWX patching earlier

2021-04-28 Thread Jordan Niethe
a nop. setup_text_poke_area() relies on kernel virtual memory, cpu hotplug and per_cpu_areas being setup. setup_per_cpu_areas(), boot_cpu_hotplug_init() and mm_init() are called before poking_init(). Turn setup_text_poke_area() into poking_init(). Reviewed-by: Russell Currey Signed-off-by: Jordan

[PATCH v11 4/9] powerpc/kprobes: Mark newly allocated probes as ROX

2021-04-28 Thread Jordan Niethe
-by: Christophe Leroy [jpn: Reword commit message, switch to __vmalloc_node_range()] Signed-off-by: Jordan Niethe --- v9: - vmalloc_exec() no longer exists - Set the page to RW before freeing it v10: - use __vmalloc_node_range() v11: - Neaten up --- arch/powerpc/kernel/kprobes.c | 11

[PATCH v11 5/9] powerpc/bpf: Remove bpf_jit_free()

2021-04-28 Thread Jordan Niethe
ot be used for powerpc. Commit d53d2f78cead ("bpf: Use vmalloc special flag") moved keeping track of read-only memory to vmalloc. This included removing bpf_jit_binary_unlock_ro(). Therefore there is no reason powerpc needs its own bpf_jit_free(). Remove it. Signed-off-by: Jordan Niethe --

Re: [PATCH v11 2/9] powerpc/lib/code-patching: Set up Strict RWX patching earlier

2021-05-04 Thread Jordan Niethe
On Thu, Apr 29, 2021 at 2:53 PM Christophe Leroy wrote: > > > > Le 29/04/2021 à 05:15, Jordan Niethe a écrit : > > setup_text_poke_area() is a late init call so it runs before > > mark_rodata_ro() and after the init calls. This lets all the init code > > patching s

[PATCH v3 1/2] powerpc/64s: Fix pte update for kernel memory on radix

2021-02-07 Thread Jordan Niethe
ot;) Reviewed-by: Nicholas Piggin Signed-off-by: Jordan Niethe --- v2: Only ptesync is needed v3: Fix Fixes tag --- arch/powerpc/include/asm/book3s/64/radix.h | 6 -- arch/powerpc/mm/book3s64/radix_pgtable.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/pow

[PATCH v3 2/2] selftests/powerpc: Test for spurious kernel memory faults on radix

2021-02-07 Thread Jordan Niethe
so is a convenient way to see this kind of fault. Add a selftest to try and trigger this kind of a spurious fault. It tests for 30 seconds which is usually long enough for the issue to show up. Signed-off-by: Jordan Niethe --- v3: New to series --- tools/testing/selftests/powerpc/mm/Makefile

[PATCH v10 00/10] powerpc: Further Strict RWX support

2021-03-29 Thread Jordan Niethe
Another revision to this series adding more Strict RWX support on powerpc, in particular Strict Module RWX. This revision adds consideration for bpf. The changes in v10 for each patch: Christophe Leroy (2): powerpc/mm: implement set_memory_attr() powerpc/32: use set_memory_attr() Jordan

[PATCH v10 08/10] powerpc/configs: Enable STRICT_MODULE_RWX in skiroot_defconfig

2021-03-29 Thread Jordan Niethe
From: Russell Currey skiroot_defconfig is the only powerpc defconfig with STRICT_KERNEL_RWX enabled, and if you want memory protection for kernel text you'd want it for modules too, so enable STRICT_MODULE_RWX there. Acked-by: Joel Stanley Signed-off-by: Russell Currey Signed-off-by: Jordan

[PATCH v10 09/10] powerpc/mm: implement set_memory_attr()

2021-03-29 Thread Jordan Niethe
. Signed-off-by: Christophe Leroy Reported-by: kbuild test robot [ruscur: cast "data" to unsigned long instead of int] Signed-off-by: Russell Currey Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/set_memory.h | 2 ++ arch/powerpc/mm/pageattr.c

[PATCH v10 10/10] powerpc/32: use set_memory_attr()

2021-03-29 Thread Jordan Niethe
is already done by the callers. Signed-off-by: Christophe Leroy [ruscur: rebase on powerpc/merge with Christophe's new patches] Signed-off-by: Russell Currey Signed-off-by: Jordan Niethe --- arch/powerpc/mm/pgtable_32.c | 60 ++-- 1 file changed, 10 insertions

[PATCH v10 07/10] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-03-29 Thread Jordan Niethe
on !PPC_BOOK3S_604 - make module_alloc() use PAGE_KERNEL protection] Signed-off-by: Jordan Niethe --- v10: - Predicate on !PPC_BOOK3S_604 - Make module_alloc() use PAGE_KERNEL protection --- arch/powerpc/Kconfig | 1 + arch/powerpc/kernel/module.c | 11 --- 2 files

[PATCH v10 01/10] powerpc/mm: Implement set_memory() routines

2021-03-29 Thread Jordan Niethe
linear map] Signed-off-by: Jordan Niethe --- v10: WARN if trying to change the hash linear map --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/set_memory.h | 32 ++ arch/powerpc/mm/Makefile | 2 +- arch/powerpc/mm/pageattr.c

[PATCH v10 03/10] powerpc: Always define MODULES_{VADDR,END}

2021-03-29 Thread Jordan Niethe
conditional code in other places that need to allocate from the module region (i.e., kprobes). Signed-off-by: Jordan Niethe --- v10: New to series --- arch/powerpc/include/asm/pgtable.h | 5 + arch/powerpc/kernel/module.c | 5 + 2 files changed, 6 insertions(+), 4 deletions(-) diff

[PATCH v10 02/10] powerpc/lib/code-patching: Set up Strict RWX patching earlier

2021-03-29 Thread Jordan Niethe
a nop. setup_text_poke_area() relies on kernel virtual memory, cpu hotplug and per_cpu_areas being setup. setup_per_cpu_areas(), boot_cpu_hotplug_init() and mm_init() are called before poking_init(). Turn setup_text_poke_area() into poking_init(). Reviewed-by: Russell Currey Signed-off-by: Jordan

[PATCH v10 06/10] powerpc/mm/ptdump: debugfs handler for W+X checks at runtime

2021-03-29 Thread Jordan Niethe
on its own] Signed-off-by: Jordan Niethe --- v10: check_wx_pages now affects kernel_page_tables rather then triggers its own action. --- arch/powerpc/Kconfig.debug | 6 -- arch/powerpc/mm/ptdump/ptdump.c | 34 - 2 files changed, 37 insertions(+), 3 del

[PATCH v10 05/10] powerpc/bpf: Write protect JIT code

2021-03-29 Thread Jordan Niethe
to the JIT image after it has finished being written. Signed-off-by: Jordan Niethe --- v10: New to series --- arch/powerpc/net/bpf_jit_comp.c | 5 - arch/powerpc/net/bpf_jit_comp64.c | 4 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch

[PATCH v10 04/10] powerpc/kprobes: Mark newly allocated probes as ROX

2021-03-29 Thread Jordan Niethe
-by: Christophe Leroy [jpn: Reword commit message, switch to __vmalloc_node_range()] Signed-off-by: Jordan Niethe --- v9: - vmalloc_exec() no longer exists - Set the page to RW before freeing it v10: - use __vmalloc_node_range() --- arch/powerpc/kernel/kprobes.c | 14 ++ 1 file

Re: [PATCH 3/3] powerpc/sstep: Always test lmw and stmw

2021-04-05 Thread Jordan Niethe
On Fri, Apr 2, 2021 at 12:39 AM Michael Ellerman wrote: > > Hi Jordan, > > Jordan Niethe writes: > > Load Multiple Word (lmw) and Store Multiple Word (stmw) will raise an > > Alignment Exception: > > - Little Endian mode: always > > - Big E

[PATCH v9 1/8] powerpc/mm: Implement set_memory() routines

2021-03-15 Thread Jordan Niethe
on next plus "powerpc/mm/64s: Allow STRICT_KERNEL_RWX again"] Signed-off-by: Jordan Niethe --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/set_memory.h | 32 +++ arch/powerpc/mm/Makefile | 2 +- arch/powerpc/mm/pageattr.c

[PATCH v9 2/8] powerpc/lib/code-patching: Set up Strict RWX patching earlier

2021-03-15 Thread Jordan Niethe
a nop. setup_text_poke_area() relies on kernel virtual memory, cpu hotplug and per_cpu_areas being setup. setup_per_cpu_areas(), boot_cpu_hotplug_init() and mm_init() are called before poking_init(). Turn setup_text_poke_area() into poking_init(). Signed-off-by: Jordan Niethe --- v9: New to series

[PATCH v9 4/8] powerpc/mm/ptdump: debugfs handler for W+X checks at runtime

2021-03-15 Thread Jordan Niethe
From: Russell Currey Very rudimentary, just echo 1 > [debugfs]/check_wx_pages and check the kernel log. Useful for testing strict module RWX. Updated the Kconfig entry to reflect this. Also fixed a typo. Reviewed-by: Kees Cook Signed-off-by: Russell Currey Signed-off-by: Jor

[PATCH v9 3/8] powerpc/kprobes: Mark newly allocated probes as RO

2021-03-15 Thread Jordan Niethe
free_insn_page()] Signed-off-by: Jordan Niethe --- v9: - vmalloc_exec() no longer exists - Set the page to RW before freeing it --- arch/powerpc/kernel/kprobes.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index

[PATCH v9 6/8] powerpc/configs: Enable STRICT_MODULE_RWX in skiroot_defconfig

2021-03-15 Thread Jordan Niethe
From: Russell Currey skiroot_defconfig is the only powerpc defconfig with STRICT_KERNEL_RWX enabled, and if you want memory protection for kernel text you'd want it for modules too, so enable STRICT_MODULE_RWX there. Acked-by: Joel Stanley Signed-off-by: Russell Currey Signed-off-by: Jordan

[PATCH v9 5/8] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-03-15 Thread Jordan Niethe
. Signed-off-by: Russell Currey Signed-off-by: Jordan Niethe --- arch/powerpc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 4498a27ac9db..d9cadc4212d0 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -137,6 +137,7

[PATCH v9 8/8] powerpc/32: use set_memory_attr()

2021-03-15 Thread Jordan Niethe
is already done by the callers. Signed-off-by: Christophe Leroy [ruscur: rebase on powerpc/merge with Christophe's new patches] Signed-off-by: Russell Currey Signed-off-by: Jordan Niethe --- arch/powerpc/mm/pgtable_32.c | 60 ++-- 1 file changed, 10 insertions

[PATCH v9 7/8] powerpc/mm: implement set_memory_attr()

2021-03-15 Thread Jordan Niethe
. Signed-off-by: Christophe Leroy Reported-by: kbuild test robot [ruscur: cast "data" to unsigned long instead of int] Signed-off-by: Russell Currey Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/set_memory.h | 2 ++ arch/powerpc/mm/pageattr.c

Re: [PATCH v9 5/8] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-03-16 Thread Jordan Niethe
On Tue, Mar 16, 2021 at 5:51 PM Christophe Leroy wrote: > > > > Le 16/03/2021 à 04:17, Jordan Niethe a écrit : > > From: Russell Currey > > > > To enable strict module RWX on powerpc, set: > > > > CONFIG_STRICT_MODULE_RWX=y > > > > You s

Re: [PATCH v9 2/8] powerpc/lib/code-patching: Set up Strict RWX patching earlier

2021-03-16 Thread Jordan Niethe
On Tue, Mar 16, 2021 at 5:32 PM Christophe Leroy wrote: > > > > Le 16/03/2021 à 04:17, Jordan Niethe a écrit : > > setup_text_poke_area() is a late init call so it runs before > > mark_rodata_ro() and after the init calls. This lets all the init code > > patching s

Re: [PATCH v9 3/8] powerpc/kprobes: Mark newly allocated probes as RO

2021-03-16 Thread Jordan Niethe
On Tue, Mar 16, 2021 at 5:44 PM Christophe Leroy wrote: > > > > Le 16/03/2021 à 04:17, Jordan Niethe a écrit : > > From: Russell Currey > > > > With CONFIG_STRICT_KERNEL_RWX=y and CONFIG_KPROBES=y, there will be one > > W+X page at boot by default. This can

Re: [PATCH v9 3/8] powerpc/kprobes: Mark newly allocated probes as RO

2021-03-16 Thread Jordan Niethe
On Tue, Mar 16, 2021 at 5:44 PM Christophe Leroy wrote: > > > > Le 16/03/2021 à 04:17, Jordan Niethe a écrit : > > From: Russell Currey > > > > With CONFIG_STRICT_KERNEL_RWX=y and CONFIG_KPROBES=y, there will be one > > W+X page at boot by default. This can

Re: [PATCH v9 7/8] powerpc/mm: implement set_memory_attr()

2021-03-16 Thread Jordan Niethe
On Tue, Mar 16, 2021 at 6:25 PM Christophe Leroy wrote: > > > > Le 16/03/2021 à 04:17, Jordan Niethe a écrit : > > From: Christophe Leroy > > Can you please update the whole series with my new email address: > christophe.le...@csgroup.eu Of course, I shall do that

Re: [PATCH v9 3/8] powerpc/kprobes: Mark newly allocated probes as RO

2021-03-17 Thread Jordan Niethe
On Wed, Mar 17, 2021 at 5:12 PM Christophe Leroy wrote: > > > > Le 16/03/2021 à 04:17, Jordan Niethe a écrit : > > From: Russell Currey > > > > With CONFIG_STRICT_KERNEL_RWX=y and CONFIG_KPROBES=y, there will be one > > W+X page at boot by default. This can

[PATCH 3/3] powerpc/sstep: Always test lmw and stmw

2021-02-24 Thread Jordan Niethe
of if there is cache inhibited memory available or not. Signed-off-by: Jordan Niethe --- .../powerpc/alignment/alignment_handler.c | 96 ++- 1 file changed, 94 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/powerpc/alignment/alignment_handler.c b/tools

[PATCH] powerpc/sstep: Fix VSX instruction emulation

2021-02-24 Thread Jordan Niethe
s instructions") Signed-off-by: Jordan Niethe --- arch/powerpc/lib/sstep.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c index 683f7c20f74b..3953e63bbba5 100644 --- a/arch/powerpc/lib/sstep.c +++ b/arch/powerpc/lib/sste

[PATCH 2/3] selftests/powerpc: Suggest memtrace instead of /dev/mem for ci memory

2021-02-24 Thread Jordan Niethe
buffers. memtrace is only available on powernv so there will not be any chance of trying to do this in a guest. Signed-off-by: Jordan Niethe --- .../selftests/powerpc/alignment/alignment_handler.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tools/testing

[PATCH 1/3] powernv/memtrace: Allow mmaping trace buffers

2021-02-24 Thread Jordan Niethe
Let the memory removed from the linear mapping to be used for the trace buffers be mmaped. This is a useful way of providing cache-inhibited memory for the alignment_handler selftest. Signed-off-by: Jordan Niethe --- arch/powerpc/platforms/powernv/memtrace.c | 18 +- 1 file

Re: [PATCH v10 04/10] powerpc/kprobes: Mark newly allocated probes as ROX

2021-04-20 Thread Jordan Niethe
On Tue, Mar 30, 2021 at 4:05 PM Christophe Leroy wrote: > > > > Le 30/03/2021 à 06:51, Jordan Niethe a écrit : > > From: Russell Currey > > > > Add the arch specific insn page allocator for powerpc. This allocates > > ROX pages if STRICT_KERNEL_RWX is e

Re: [PATCH v10 01/10] powerpc/mm: Implement set_memory() routines

2021-04-20 Thread Jordan Niethe
On Wed, Mar 31, 2021 at 10:16 PM Michael Ellerman wrote: > > Hi Jordan, > > A few nits below ... > > Jordan Niethe writes: > > From: Russell Currey > > > > The set_memory_{ro/rw/nx/x}() functions are required for STRICT_MODULE_RWX, > > a

Re: [PATCH v10 08/10] powerpc/configs: Enable STRICT_MODULE_RWX in skiroot_defconfig

2021-04-20 Thread Jordan Niethe
On Tue, Mar 30, 2021 at 4:27 PM Christophe Leroy wrote: > > > > Le 30/03/2021 à 06:51, Jordan Niethe a écrit : > > From: Russell Currey > > > > skiroot_defconfig is the only powerpc defconfig with STRICT_KERNEL_RWX > > enabled, and if you want memory p

Re: [PATCH v10 03/10] powerpc: Always define MODULES_{VADDR,END}

2021-04-20 Thread Jordan Niethe
On Fri, Apr 2, 2021 at 12:36 AM Christophe Leroy wrote: > > > > Le 30/03/2021 à 06:51, Jordan Niethe a écrit : > > If MODULES_{VADDR,END} are not defined set them to VMALLOC_START and > > VMALLOC_END respectively. This reduces the need for special cases. For > > e

Re: [PATCH v10 01/10] powerpc/mm: Implement set_memory() routines

2021-04-20 Thread Jordan Niethe
On Thu, Apr 1, 2021 at 3:37 PM Aneesh Kumar K.V wrote: > > Jordan Niethe writes: > > > From: Russell Currey > > > > The set_memory_{ro/rw/nx/x}() functions are required for STRICT_MODULE_RWX, > > and are generally useful primitives to have. This implementation

Re: [PATCH v10 01/10] powerpc/mm: Implement set_memory() routines

2021-04-20 Thread Jordan Niethe
On Tue, Mar 30, 2021 at 4:16 PM Christophe Leroy wrote: > > > > Le 30/03/2021 à 06:51, Jordan Niethe a écrit : > > From: Russell Currey > > > > The set_memory_{ro/rw/nx/x}() functions are required for STRICT_MODULE_RWX, > > and are generally useful prim

Re: [PATCH v10 03/10] powerpc: Always define MODULES_{VADDR,END}

2021-04-20 Thread Jordan Niethe
On Wed, Apr 21, 2021 at 3:14 PM Christophe Leroy wrote: > > > > Le 21/04/2021 à 04:46, Jordan Niethe a écrit : > > On Fri, Apr 2, 2021 at 12:36 AM Christophe Leroy > > wrote: > >> > >> > >> > >> Le 30/03/2021 à 06:51, Jordan Niethe a é

[PATCH] powerpc/64s: Add load address to plt branch targets before moved to linked location for non-relocatable kernels

2021-04-20 Thread Jordan Niethe
_init() calls __start() remove the offset saved in p_branch_lt_off to return the targets to their original addresses. Signed-off-by: Jordan Niethe --- arch/powerpc/include/asm/sections.h | 2 + arch/powerpc/kernel/head_64.S | 66 + arch/powerpc/kernel/vmlinux.ld

Re: [PATCH v10 06/10] powerpc/mm/ptdump: debugfs handler for W+X checks at runtime

2021-04-20 Thread Jordan Niethe
On Wed, Mar 31, 2021 at 10:24 PM Michael Ellerman wrote: > > Jordan Niethe writes: > > From: Russell Currey > > > > Optionally run W+X checks when dumping pagetable information to > > debugfs' kernel_page_tables. > > > > To use: > > $ echo 1

Re: [PATCH v10 05/10] powerpc/bpf: Write protect JIT code

2021-04-20 Thread Jordan Niethe
On Wed, Mar 31, 2021 at 9:37 PM Michael Ellerman wrote: > > Jordan Niethe writes: > > > Once CONFIG_STRICT_MODULE_RWX is enabled there will be no need to > > override bpf_jit_free() because it is now possible to set images > > read-only. So use the default imple

Re: [PATCH v15 7/9] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-08-13 Thread Jordan Niethe
On Sat, Aug 14, 2021 at 8:59 AM Fabiano Rosas wrote: > > Laurent Vivier writes: > > > > > since this patch is merged my VM is experiencing a crash at boot (20% of > > the time): > > > > [8.496850] kernel tried to execute exec-protected page > > (c00804073278) - exploit > > attempt?

Re: [PATCH v6 1/4] powerpc/64s: Introduce temporary mm for Radix MMU

2021-09-11 Thread Jordan Niethe
On Sat, Sep 11, 2021 at 12:35 PM Christopher M. Riedl wrote: > > x86 supports the notion of a temporary mm which restricts access to > temporary PTEs to a single CPU. A temporary mm is useful for situations > where a CPU needs to perform sensitive operations (such as patching a >

Re: [PATCH v6 4/4] powerpc/64s: Initialize and use a temporary mm for patching on Radix

2021-09-11 Thread Jordan Niethe
On Sat, Sep 11, 2021 at 12:39 PM Christopher M. Riedl wrote: > > When code patching a STRICT_KERNEL_RWX kernel the page containing the > address to be patched is temporarily mapped as writeable. Currently, a > per-cpu vmalloc patch area is used for this purpose. While the patch > area is per-cpu,

Re: [PATCH v6 4/4] powerpc/64s: Initialize and use a temporary mm for patching on Radix

2021-09-15 Thread Jordan Niethe
On Thu, Sep 16, 2021 at 10:40 AM Christopher M. Riedl wrote: > > On Tue Sep 14, 2021 at 11:24 PM CDT, Jordan Niethe wrote: > > On Sat, Sep 11, 2021 at 12:39 PM Christopher M. Riedl > > wrote: > > > ... > > > +/* > > > + * This can be called for kern

Re: [PATCH v6 4/4] powerpc/64s: Initialize and use a temporary mm for patching on Radix

2021-09-15 Thread Jordan Niethe
On Thu, Sep 16, 2021 at 10:38 AM Christopher M. Riedl wrote: > > On Sat Sep 11, 2021 at 4:14 AM CDT, Jordan Niethe wrote: > > On Sat, Sep 11, 2021 at 12:39 PM Christopher M. Riedl > > wrote: > > > > > > When code patching a STRICT_KERNEL_RWX kernel t

Re: [PATCH v6 4/4] powerpc/64s: Initialize and use a temporary mm for patching on Radix

2021-09-14 Thread Jordan Niethe
On Sat, Sep 11, 2021 at 12:39 PM Christopher M. Riedl wrote: > > When code patching a STRICT_KERNEL_RWX kernel the page containing the > address to be patched is temporarily mapped as writeable. Currently, a > per-cpu vmalloc patch area is used for this purpose. While the patch > area is per-cpu,

[PATCH] powerpc: Always inline radix_enabled() to fix build failure

2021-08-03 Thread Jordan Niethe
buildtime and elimination of non possible parts of code at compile time. For this to work radix_enabled() must be inlined so make it __always_inline. Link: https://bugzilla.kernel.org/show_bug.cgi?id=213803 Reported-by: Erhard F. Suggested-by: Michael Ellerman Signed-off-by: Jordan Niethe --- arch/powerpc/i

[PATCH v2 2/2] selftests: Skip TM tests on synthetic TM implementations

2021-07-28 Thread Jordan Niethe
for a synthetic implementation and skip the test if so. Signed-off-by: Jordan Niethe --- v2: Added checking for synthetic implementation to more tests --- .../selftests/powerpc/ptrace/ptrace-tm-gpr.c | 1 + .../powerpc/ptrace/ptrace-tm-spd-gpr.c| 1 + .../powerpc/ptrace/ptrace-tm-spd-tar.c

[PATCH v2 1/2] selftests/powerpc: Add missing clobbered register to to ptrace TM tests

2021-07-28 Thread Jordan Niethe
-by: Michael Neuling Signed-off-by: Jordan Niethe --- tools/testing/selftests/powerpc/ptrace/ptrace-tm-gpr.c | 2 +- tools/testing/selftests/powerpc/ptrace/ptrace-tm-spd-gpr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/powerpc/ptrace/ptrace

Re: [PATCH v4 5/8] bpf ppc64: Add BPF_PROBE_MEM support for JIT

2021-09-29 Thread Jordan Niethe
On Wed, Sep 29, 2021 at 9:50 PM Christophe Leroy wrote: > > > > Le 29/09/2021 à 13:18, Hari Bathini a écrit : > > From: Ravi Bangoria > > > > BPF load instruction with BPF_PROBE_MEM mode can cause a fault > > inside kernel. Append exception table for such instructions > > within BPF program. > >

Re: [PATCH] KVM: PPC: Book3S HV: Use GLOBAL_TOC for kvmppc_h_set_dabr/xdabr()

2021-09-30 Thread Jordan Niethe
On Thu, Sep 30, 2021 at 4:13 PM Daniel Axtens wrote: > > Hi Michael, > > > kvmppc_h_set_dabr(), and kvmppc_h_set_xdabr() which jumps into > > it, need to use _GLOBAL_TOC to setup the kernel TOC pointer, because > > kvmppc_h_set_dabr() uses LOAD_REG_ADDR() to load dawr_force_enable. > > This makes

[PATCH v7 2/5] powerpc/64s: Introduce temporary mm for Radix MMU

2021-11-09 Thread Jordan Niethe
mporary mm is in use - this may include breakpoints set by perf. Based on x86 implementation: commit cefa929c034e ("x86/mm: Introduce temporary mm structs") Signed-off-by: Christopher M. Riedl Signed-off-by: Jordan Niethe --- v7: - use breakpoint_pause()/breakpoint_unpause() - simplif

[PATCH v7 0/5] Use per-CPU temporary mappings for patching on Radix MMU

2021-11-09 Thread Jordan Niethe
. Riedl (4): powerpc/64s: Introduce temporary mm for Radix MMU powerpc: Rework and improve STRICT_KERNEL_RWX patching powerpc: Use WARN_ON and fix check in poking_init powerpc/64s: Initialize and use a temporary mm for patching on Radix Jordan Niethe (1): powerpc: Allow clearing

[PATCH v7 1/5] powerpc: Allow clearing and restoring registers independent of saved breakpoint state

2021-11-09 Thread Jordan Niethe
a pause_breakpoints() function which will clear the breakpoint registers without touching the state in current_bkr[]. Add a pair function unpause_breakpoints() which will move the state in current_brk[] back to the registers. Signed-off-by: Jordan Niethe --- v7: New to series --- arch/powerpc

[PATCH v7 5/5] powerpc/64s: Initialize and use a temporary mm for patching on Radix

2021-11-09 Thread Jordan Niethe
;x86/alternatives: Use temporary mm for text poking") Signed-off-by: Christopher M. Riedl Signed-off-by: Jordan Niethe --- v7: - Change to patch_instruction_mm() instead of map_patch_mm() and unmap_patch_mm() - include ptesync --- arch/powerpc/lib/code-patching.c | 106

[PATCH v7 3/5] powerpc: Rework and improve STRICT_KERNEL_RWX patching

2021-11-09 Thread Jordan Niethe
error from __patch_instruction() properly. Signed-off-by: Christopher M. Riedl Signed-off-by: Jordan Niethe --- v7: still pass addr to map_patch_area() --- arch/powerpc/lib/code-patching.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/lib/code-patchin

[PATCH v7 4/5] powerpc: Use WARN_ON and fix check in poking_init

2021-11-09 Thread Jordan Niethe
le". Also take this opportunity to fix the failure check in the WARN_ON(): cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, ...) returns a positive integer on success and a negative integer on failure. Signed-off-by: Christopher M. Riedl Signed-off-by: Jordan Niethe --- v7: no change --- a

[PATCH 2/3] powerpc/bpf: Use helper for mapping bpf to ppc registers on PPC64

2021-07-27 Thread Jordan Niethe
en_context mappings. Signed-off-by: Jordan Niethe --- arch/powerpc/net/bpf_jit.h| 5 ++ arch/powerpc/net/bpf_jit64.h | 30 +- arch/powerpc/net/bpf_jit_comp32.c | 5 -- arch/powerpc/net/bpf_jit_comp64.c | 96 --- 4 files changed, 71 insertions(+), 65

[PATCH 3/3] powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC64

2021-07-27 Thread Jordan Niethe
nop 8: xor r8,r8,r8 c: rotlwi r8,r8,0 10: xor r5,r5,r5 14: rotlwi r5,r5,0 18: mr r4,r3 1c: li r8,66 20: add r8,r8,r5 24: rotlwi r8,r8,0 28: mr r3,r8 2c: blr Signed-off-by: Jordan Niethe --- arch/powerpc/net/bpf_jit64.h

[PATCH 1/3] powerpc64/bpf: Store temp registers' bpf to ppc mapping

2021-07-27 Thread Jordan Niethe
registers to ppc registers. Signed-off-by: Jordan Niethe --- arch/powerpc/net/bpf_jit_comp64.c | 163 +- 1 file changed, 69 insertions(+), 94 deletions(-) diff --git a/arch/powerpc/net/bpf_jit_comp64.c b/arch/powerpc/net/bpf_jit_comp64.c index de8595880fee..1dfec85bb03b

Re: [PATCH v7 3/5] powerpc: Rework and improve STRICT_KERNEL_RWX patching

2022-03-14 Thread Jordan Niethe
On Sat, Mar 12, 2022 at 6:30 PM Christophe Leroy wrote: > > Hi Jordan > > Le 10/11/2021 à 01:37, Jordan Niethe a écrit : > > From: "Christopher M. Riedl" > > > > Rework code-patching with STRICT_KERNEL_RWX to prepare for a later patch > > which uses

Re: [PATCH 3/4] powerpc: Handle prefixed instructions in show_user_instructions()

2022-03-14 Thread Jordan Niethe
On Wed, Feb 23, 2022 at 1:34 AM Christophe Leroy wrote: > > > > Le 02/06/2020 à 07:27, Jordan Niethe a écrit : > > Currently prefixed instructions are treated as two word instructions by > > show_user_instructions(), treat them as a single instruction. '<' an

[PATCH v4 03/11] KVM: PPC: Rename accessor generator macros

2023-09-04 Thread Jordan Niethe
More "wrapper" style accessor generating macros will be introduced for the nestedv2 guest support. Rename the existing macros with more descriptive names now so there is a consistent naming convention. Reviewed-by: Nicholas Piggin Signed-off-by: Jordan Niethe --- v3: - New to

[PATCH v4 04/11] KVM: PPC: Use accessors for VCPU registers

2023-09-04 Thread Jordan Niethe
Introduce accessor generator macros for VCPU registers. Use the accessor functions to replace direct accesses to this registers. This will be important later for Nested APIv2 support which requires additional functionality for accessing and modifying VCPU state. Signed-off-by: Jordan Niethe

[PATCH v4 05/11] KVM: PPC: Use accessors VCORE registers

2023-09-04 Thread Jordan Niethe
Introduce accessor generator macros for VCORE registers. Use the accessor functions to replace direct accesses to this registers. This will be important later for Nested APIv2 support which requires additional functionality for accessing and modifying VCPU state. Signed-off-by: Jordan Niethe

[PATCH v4 09/11] KVM: PPC: Book3s HV: Hold LPIDs in an unsigned long

2023-09-04 Thread Jordan Niethe
eries_rpt_invalidate() to match that. Update the callers of pseries_rpt_invalidate() to also take an unsigned long if they take an lpid value. Signed-off-by: Jordan Niethe --- v3: - New to series v4: - Use u64 - Change format strings instead of casting --- arch/powerpc/include/asm/k

[PATCH v4 08/11] KVM: PPC: Add helper library for Guest State Buffers

2023-09-04 Thread Jordan Niethe
the value of elements and parsing buffers. This will be used later by the nestedv2 guest support. Signed-off-by: Jordan Niethe --- v2: - Add missing #ifdef CONFIG_VSXs - Move files from lib/ to kvm/ - Guard compilation on CONFIG_KVM_BOOK3S_HV_POSSIBLE - Use kunit for guest state buffer

[PATCH v4 07/11] KVM: PPC: Book3S HV: Introduce low level MSR accessor

2023-09-04 Thread Jordan Niethe
that is not currently present. kvmppc_set_msr_hv() already exists, it is used for the kvmppc_ops::set_msr callback. Introduce a low level accessor __kvmppc_{s,g}et_msr_hv() that simply gets and sets shregs::msr. This will be extend for Nested APIv2 support. Signed-off-by: Jordan Niethe --- v4: - New

<    1   2   3   4   5   6   >