[PATCH v3 6/7] powerpc/mm: implement set_memory_attr()

2020-02-02 Thread Christophe Leroy
In addition to the set_memory_xx() functions which allows to change the memory attributes of not (yet) used memory regions, implement a set_memory_attr() function to: - set the final memory protection after init on currently used kernel regions. - enable/disable kernel memory regions in the scope o

[PATCH v3 7/7] powerpc/32: use set_memory_attr()

2020-02-02 Thread Christophe Leroy
Use set_memory_attr() instead of the PPC32 specific change_page_attr() change_page_attr() was checking that the address was not mapped by blocks and was handling highmem, but that's unneeded because the affected pages can't be in highmem and block mapping verification is already done by the caller

[PATCH v3 5/7] powerpc/configs: Enable STRICT_MODULE_RWX in skiroot_defconfig

2020-02-02 Thread Christophe Leroy
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 --- v3: no change v2: no

[PATCH v3 4/7] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2020-02-02 Thread Christophe Leroy
From: Russell Currey To enable strict module RWX on powerpc, set: CONFIG_STRICT_MODULE_RWX=y You should also have CONFIG_STRICT_KERNEL_RWX=y set to have any real security benefit. ARCH_HAS_STRICT_MODULE_RWX is set to require ARCH_HAS_STRICT_KERNEL_RWX. This is due to a quirk in arch/Kconfi

[PATCH v3 3/7] powerpc/mm/ptdump: debugfs handler for W+X checks at runtime

2020-02-02 Thread Christophe Leroy
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. Signed-off-by: Russell Currey --- v3: no change v2: no change --- arch/powerp

[PATCH v3 2/7] powerpc/kprobes: Mark newly allocated probes as RO

2020-02-02 Thread Christophe Leroy
With CONFIG_STRICT_KERNEL_RWX=y and CONFIG_KPROBES=y, there will be one W+X page at boot by default. This can be tested with CONFIG_PPC_PTDUMP=y and CONFIG_PPC_DEBUG_WX=y set, and checking the kernel log during boot. powerpc doesn't implement its own alloc() for kprobes like other architectures d

[PATCH v3 1/7] powerpc/mm: Implement set_memory() routines

2020-02-02 Thread Christophe Leroy
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 completely generic across powerpc's many MMUs. It's possible that this could be optimised to be faster for specific MMUs, but the focus is

Re: [PATCH v6 1/5] powerpc/mm: Implement set_memory() routines

2020-02-02 Thread Christophe Leroy
Le 03/02/2020 à 01:46, Russell Currey a écrit : On Wed, 2020-01-08 at 13:52 +0100, Christophe Leroy wrote: Le 24/12/2019 à 06:55, Russell Currey a écrit : diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile index 5e147986400d..d0a0bcbc9289 100644 --- a/arch/powerpc/mm/Makefile

Re: [PATCH v2 2/7] powerpc/kprobes: Mark newly allocated probes as RO

2020-02-02 Thread Christophe Leroy
Le 03/02/2020 à 05:50, Russell Currey a écrit : On Fri, 2020-01-31 at 13:34 +, Christophe Leroy wrote: With CONFIG_STRICT_KERNEL_RWX=y and CONFIG_KPROBES=y, there will be one W+X page at boot by default. This can be tested with CONFIG_PPC_PTDUMP=y and CONFIG_PPC_DEBUG_WX=y set, and check

Re: [linuxppc-dev] Patch notification: 1 patch updated

2020-02-02 Thread Christophe Leroy
Le 03/02/2020 à 02:00, Patchwork a écrit : Hello, The following patch (submitted by you) has been updated in Patchwork: * linuxppc-dev: powerpc/nohash: Don't flush all TLBs when flushing one page - http://patchwork.ozlabs.org/patch/1231983/ - for: Linux PPC development was

Re: [PATCH v2 2/7] powerpc/kprobes: Mark newly allocated probes as RO

2020-02-02 Thread Russell Currey
On Fri, 2020-01-31 at 13:34 +, Christophe Leroy wrote: > With CONFIG_STRICT_KERNEL_RWX=y and CONFIG_KPROBES=y, there will be > one > W+X page at boot by default. This can be tested with > CONFIG_PPC_PTDUMP=y and CONFIG_PPC_DEBUG_WX=y set, and checking the > kernel log during boot. > > powerpc

Re: [PATCH 1/3] powerpc/pseries: Account for SPURR ticks on idle CPUs

2020-02-02 Thread Gautham R Shenoy
Hello Nathan, On Wed, Dec 04, 2019 at 04:24:52PM -0600, Nathan Lynch wrote: > "Gautham R. Shenoy" writes: > > diff --git a/arch/powerpc/kernel/idle.c b/arch/powerpc/kernel/idle.c > > index a36fd05..708ec68 100644 > > --- a/arch/powerpc/kernel/idle.c > > +++ b/arch/powerpc/kernel/idle.c > > @@ -33

Re: [PATCH 2/3] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU

2020-02-02 Thread Gautham R Shenoy
Hi Naveen, On Thu, Dec 05, 2019 at 10:23:58PM +0530, Naveen N. Rao wrote: > >diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c > >index 80a676d..42ade55 100644 > >--- a/arch/powerpc/kernel/sysfs.c > >+++ b/arch/powerpc/kernel/sysfs.c > >@@ -1044,6 +1044,36 @@ static ssize_t sh

Re: [PATCH 2/3] powerpc/sysfs: Show idle_purr and idle_spurr for every CPU

2020-02-02 Thread Gautham R Shenoy
Hello Nathan, On Wed, Dec 04, 2019 at 04:24:31PM -0600, Nathan Lynch wrote: > "Gautham R. Shenoy" writes: > > @@ -1067,6 +1097,8 @@ static int __init topology_init(void) > > register_cpu(c, cpu); > > > > device_create_file(&c->dev, &dev_attr_physical_id)

Re: [PATCH v2 1/7] powerpc/mm: Implement set_memory() routines

2020-02-02 Thread kbuild test robot
Hi Christophe, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on next-20200131] [cannot apply to v5.5] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use

Re: [PATCH v6 1/5] powerpc/mm: Implement set_memory() routines

2020-02-02 Thread Russell Currey
On Wed, 2020-01-08 at 13:52 +0100, Christophe Leroy wrote: > > Le 24/12/2019 à 06:55, Russell Currey a écrit : > > 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 complet

Re: Latest Git kernel: avahi-daemon[2410]: ioctl(): Inappropriate ioctl for device

2020-02-02 Thread Christian Zigotzky
On 02 February 2020 at 09:19 am, Christophe Leroy wrote: Hello, Le 02/02/2020 à 01:08, Christian Zigotzky a écrit : Hello, We regularly compile and test Linux kernels every day during the merge window. Since Thuesday we have very high CPU loads because of the avahi daemon on our desktop Linu

Re: [PATCH V12] mm/debug: Add tests validating architecture page table helpers

2020-02-02 Thread Qian Cai
> On Jan 30, 2020, at 9:13 AM, Christophe Leroy wrote: > > config DEBUG_VM_PGTABLE >bool "Debug arch page table for semantics compliance" if > ARCH_HAS_DEBUG_VM_PGTABLE || EXPERT >depends on MMU >default 'n' if !ARCH_HAS_DEBUG_VM_PGTABLE >default 'y' if DEBUG_VM Does it reall

Re: [PATCH V12] mm/debug: Add tests validating architecture page table helpers

2020-02-02 Thread Christophe Leroy
Le 02/02/2020 à 08:18, Anshuman Khandual a écrit : On 01/30/2020 07:43 PM, Christophe Leroy wrote: Le 30/01/2020 à 14:04, Anshuman Khandual a écrit : On 01/28/2020 10:35 PM, Christophe Leroy wrote: I think we could make it standalone and 'default y if DEBUG_VM' instead. Which will

Re: [PATCH V12] mm/debug: Add tests validating architecture page table helpers

2020-02-02 Thread Anshuman Khandual
On 01/30/2020 06:34 PM, Anshuman Khandual wrote: > On 01/28/2020 10:35 PM, Christophe Leroy wrote: >> >> Le 28/01/2020 à 02:27, Anshuman Khandual a écrit : >>> This adds tests which will validate architecture page table helpers and >>> other accessors in their compliance with expected generic MM

Re: Latest Git kernel: avahi-daemon[2410]: ioctl(): Inappropriate ioctl for device

2020-02-02 Thread Christophe Leroy
Hello, Le 02/02/2020 à 01:08, Christian Zigotzky a écrit : Hello, We regularly compile and test Linux kernels every day during the merge window. Since Thuesday we have very high CPU loads because of the avahi daemon on our desktop Linux systems (Ubuntu, Debian etc). Error message: avahi-dae