Re: [PATCH v3 11/17] riscv: Convert to GENERIC_CMDLINE

2021-03-29 Thread Nick Kossifidis
Στις 2021-03-26 17:26, Rob Herring έγραψε: On Fri, Mar 26, 2021 at 8:20 AM Christophe Leroy wrote: Le 26/03/2021 à 15:08, Andreas Schwab a écrit : > On Mär 26 2021, Christophe Leroy wrote: > >> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c >> index

Re: [PATCH v11 0/6] KASAN for powerpc64 radix

2021-03-29 Thread Michael Ellerman
Christophe Leroy writes: > Le 23/03/2021 à 02:21, Daniel Axtens a écrit : >> Hi Christophe, >> >>> In the discussion we had long time ago, >>> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20190806233827.16454-5-...@axtens.net/#2321067 >>> , I challenged you on why it was not possible

[powerpc:fixes-test] BUILD SUCCESS 53f1d31708f6240e4615b0927df31f182e389e2f

2021-03-29 Thread kernel test robot
randconfig-a002-20210329 x86_64 randconfig-a003-20210329 x86_64 randconfig-a006-20210329 x86_64 randconfig-a001-20210329 x86_64 randconfig-a005-20210329 x86_64 randconfig-a004-20210329 i386 randconfig-a003

Re: [PATCH] powerpc/vdso: Separate vvar vma from vdso

2021-03-29 Thread Dmitry Safonov
On 3/29/21 4:14 PM, Laurent Dufour wrote: > Le 26/03/2021 à 20:17, Dmitry Safonov a écrit : >> Since commit 511157ab641e ("powerpc/vdso: Move vdso datapage up front") >> VVAR page is in front of the VDSO area. In result it breaks CRIU >> (Checkpoint Restore In Userspace) [1], where CRIU expects

[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

[powerpc:next] BUILD SUCCESS 69931cc387cca289e0415c79ce5389119670066d

2021-03-29 Thread kernel test robot
ig powerpc allyesconfig powerpc allmodconfig powerpc allnoconfig x86_64 randconfig-a002-20210329 x86_64 randconfig-a003-20210329 x86_64 randconfig-a006-20210329 x86_64 randconfig-a001-20210

[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
From: 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

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

2021-03-29 Thread Jordan Niethe
From: 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

[PATCH v10 07/10] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2021-03-29 Thread Jordan Niethe
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

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

2021-03-29 Thread Jordan Niethe
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 completely generic across powerpc's many MMUs. It's possible that this could be optimised to be faster for

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

2021-03-29 Thread Jordan Niethe
If MODULES_{VADDR,END} are not defined set them to VMALLOC_START and VMALLOC_END respectively. This reduces the need for special cases. For example, powerpc's module_alloc() was previously predicated on MODULES_VADDR being defined but now is unconditionally defined. This will be useful reducing

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

2021-03-29 Thread Jordan Niethe
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 simply write to their locations. In the future, kprobes is going to allocate its instruction pages RO which means they will need setup_text__poke_area() to

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

2021-03-29 Thread Christophe Leroy
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 enabled. These pages are only written to with patch_instruction() which is able to write RO pages. Reviewed-by: Daniel

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

2021-03-29 Thread Christophe Leroy
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 primitives to have. This implementation is designed to be completely generic across powerpc's many MMUs. It's possible

Re: [PATCH v3] powerpc/papr_scm: Implement support for H_SCM_FLUSH hcall

2021-03-29 Thread Aneesh Kumar K.V
Shivaprasad G Bhat writes: > Add support for ND_REGION_ASYNC capability if the device tree > indicates 'ibm,hcall-flush-required' property in the NVDIMM node. > Flush is done by issuing H_SCM_FLUSH hcall to the hypervisor. > > If the flush request failed, the hypervisor is expected to > to

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

2021-03-29 Thread Christophe Leroy
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 protection for kernel text you'd want it for modules too, so enable STRICT_MODULE_RWX there. Maybe we could now

Re: [PATCH] powerpc/papr_scm: Mark nvdimm as unarmed if needed during probe

2021-03-29 Thread Aneesh Kumar K.V
Vaibhav Jain writes: > In case an nvdimm is found to be unarmed during probe then set its > NDD_UNARMED flag before nvdimm_create(). This would enforce a > read-only access to the ndimm region. Presently even if an nvdimm is > unarmed its not marked as read-only on ppc64 guests. > > The patch

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

2021-03-29 Thread Christophe Leroy
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 example, powerpc's module_alloc() was previously predicated on MODULES_VADDR being defined but now is

Re: [PATCH] scsi: ibmvscsi: delete the useless casting value returned

2021-03-29 Thread Martin K. Petersen
On Fri, 12 Mar 2021 10:18:53 +0800, Wang Qing wrote: > Fix the following coccicheck warning: > WARNING: casting value returned by memory allocation function is useless. Applied to 5.13/scsi-queue, thanks! [1/1] scsi: ibmvscsi: delete the useless casting value returned

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

2021-03-29 Thread Jordan Niethe
From: Russell Currey Optionally run W+X checks when dumping pagetable information to debugfs' kernel_page_tables. To use: $ echo 1 > /sys/kernel/debug/check_wx_pages $ cat /sys/kernel/debug/kernel_page_tables and check the kernel log. Useful for testing strict module RWX. To disable

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

2021-03-29 Thread Jordan Niethe
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 implementation. Also add the necessary call to bpf_jit_binary_lock_ro() which will remove write protection and add exec protection to

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

2021-03-29 Thread Jordan Niethe
From: Russell Currey Add the arch specific insn page allocator for powerpc. This allocates ROX pages if STRICT_KERNEL_RWX is enabled. These pages are only written to with patch_instruction() which is able to write RO pages. Reviewed-by: Daniel Axtens Signed-off-by: Russell Currey

[PATCH] powerpc/8xx: Load modules closer to kernel text

2021-03-29 Thread Christophe Leroy
On the 8xx, TASK_SIZE is 0x8000. The space between TASK_SIZE and PAGE_OFFSET is not used. Use it to load modules in order to minimise the distance between kernel text and modules and avoid trampolines in modules to access kernel functions or other module functions. Define a 16Mbytes area for

Re: [PATCH] powerpc/64s: power4 nap fixup in C

2021-03-29 Thread Benjamin Herrenschmidt
On Fri, 2021-03-12 at 11:20 +1000, Nicholas Piggin wrote: > > +static inline void nap_adjust_return(struct pt_regs *regs) > > +{ > > +#ifdef CONFIG_PPC_970_NAP > > + if (unlikely(test_thread_local_flags(_TLF_NAPPING))) { > + /* Can avoid a test-and-clear because NMIs do not

Re: [PATCH 00/30] DMA: Mundane typo fixes

2021-03-29 Thread Bhaskar Chowdhury
On 13:48 Mon 29 Mar 2021, Greg KH wrote: On Mon, Mar 29, 2021 at 11:25:11AM +0530, Bhaskar Chowdhury wrote: On 07:29 Mon 29 Mar 2021, Christoph Hellwig wrote: > I really don't think these typo patchbomb are that useful. I'm all > for fixing typos when working with a subsystem, but I'm not sure

Re: [PATCH next v1 2/3] printk: remove safe buffers

2021-03-29 Thread Petr Mladek
On Fri 2021-03-26 12:12:37, John Ogness wrote: > On 2021-03-23, Petr Mladek wrote: > >> --- a/kernel/printk/printk.c > >> +++ b/kernel/printk/printk.c > >> - > >>if (seq != prb_next_seq(_rb_static)) { > >>pr_err("dropped %llu messages\n", > >>

Re: [PATCH] powerpc/vdso: Separate vvar vma from vdso

2021-03-29 Thread Laurent Dufour
Hi Christophe and Dimitry, Le 27/03/2021 à 18:43, Dmitry Safonov a écrit : Hi Christophe, On 3/27/21 5:19 PM, Christophe Leroy wrote: [..] I opportunistically Cc stable on it: I understand that usually such stuff isn't a stable material, but that will allow us in CRIU have one workaround less

[PATCH] powerpc/papr_scm: Mark nvdimm as unarmed if needed during probe

2021-03-29 Thread Vaibhav Jain
In case an nvdimm is found to be unarmed during probe then set its NDD_UNARMED flag before nvdimm_create(). This would enforce a read-only access to the ndimm region. Presently even if an nvdimm is unarmed its not marked as read-only on ppc64 guests. The patch updates papr_scm_nvdimm_init() to

Re: [PATCH 00/30] DMA: Mundane typo fixes

2021-03-29 Thread Greg KH
On Mon, Mar 29, 2021 at 11:25:11AM +0530, Bhaskar Chowdhury wrote: > On 07:29 Mon 29 Mar 2021, Christoph Hellwig wrote: > > I really don't think these typo patchbomb are that useful. I'm all > > for fixing typos when working with a subsystem, but I'm not sure these > > patchbombs help anything. >

Re: [PATCH] powerpc/64s: power4 nap fixup in C

2021-03-29 Thread Andreas Schwab
On Mär 29 2021, Christophe Leroy wrote: > Le 29/03/2021 à 10:33, Benjamin Herrenschmidt a écrit : >> On Fri, 2021-03-12 at 11:20 +1000, Nicholas Piggin wrote: >>> >>> +static inline void nap_adjust_return(struct pt_regs *regs) >>> >>> +{ >>> >>> +#ifdef CONFIG_PPC_970_NAP >>> >>> + if

Re: [PATCH] powerpc/mm/book3s64: Use the correct storage key value when calling H_PROTECT

2021-03-29 Thread Michael Ellerman
On Fri, 26 Mar 2021 12:37:55 +0530, Aneesh Kumar K.V wrote: > H_PROTECT expect the flag value to include > flags: AVPN, pp0, pp1, pp2, key0-key4, Noexec, CMO Option flags > > This patch updates hpte_updatepp() to fetch the storage key value from the > linux page > table and use the same in

[PATCH] PCI: Try to find two continuous regions for child resource

2021-03-29 Thread Kai-Heng Feng
Built-in grahpics on HP EliteDesk 805 G6 doesn't work because graphics can't get the BAR it needs: [0.611504] pci_bus :00: root bus resource [mem 0x1002020-0x100303f window] [0.611505] pci_bus :00: root bus resource [mem 0x1003040-0x100401f window] ... [

Re: [PATCH] powerpc/64s: power4 nap fixup in C

2021-03-29 Thread Christophe Leroy
Le 29/03/2021 à 10:33, Benjamin Herrenschmidt a écrit : On Fri, 2021-03-12 at 11:20 +1000, Nicholas Piggin wrote: +static inline void nap_adjust_return(struct pt_regs *regs) +{ +#ifdef CONFIG_PPC_970_NAP + if (unlikely(test_thread_local_flags(_TLF_NAPPING))) { + /*

Re: [PATCH v2 3/7] powerpc: convert config files to generic cmdline

2021-03-29 Thread Will Deacon
On Thu, Mar 25, 2021 at 12:59:56PM -0700, Daniel Walker wrote: > On Thu, Mar 25, 2021 at 01:03:55PM +0100, Christophe Leroy wrote: > > > > Ok, so you agree we don't need to provide two CMDLINE, one to be appended > > and one to be prepended. > > > > Let's only provide once CMDLINE as of today,

Re: [PATCH next v1 2/3] printk: remove safe buffers

2021-03-29 Thread John Ogness
On 2021-03-29, John Ogness wrote: >> Will you call console write() callback with irq enabled from the >> kthread? > > No. That defeats the fundamental purpose of this entire rework > excercise. ;-) Sorry, I misread your question. The answer is "yes". We want to avoid a local_irq_save() when

Re: [PATCH] powerpc/vdso: Separate vvar vma from vdso

2021-03-29 Thread Laurent Dufour
Le 26/03/2021 à 20:17, Dmitry Safonov a écrit : Since commit 511157ab641e ("powerpc/vdso: Move vdso datapage up front") VVAR page is in front of the VDSO area. In result it breaks CRIU (Checkpoint Restore In Userspace) [1], where CRIU expects that "[vdso]" from /proc/../maps points at ELF/vdso

Re: [PATCH next v1 2/3] printk: remove safe buffers

2021-03-29 Thread John Ogness
On 2021-03-29, Petr Mladek wrote: > I wonder if some console drivers rely on the fact that the write() > callback is called with interrupts disabled. > > IMHO, it would be a bug when any write() callback expects that > callers disabled the interrupts. Agreed. > Do you plan to remove the

Re: [PATCH] powerpc/64s: power4 nap fixup in C

2021-03-29 Thread Andreas Schwab
On Mär 29 2021, Michael Ellerman wrote: > Nicholas Piggin writes: >> There is no need for this to be in asm, use the new intrrupt entry wrapper. >> >> Signed-off-by: Nicholas Piggin >> --- >> Hopefully this works on a real G5 now, but I couldn't reproduce the >> problem with QEMU. > > It still

Re: [PATCH] powerpc/64s: power4 nap fixup in C

2021-03-29 Thread Andreas Schwab
On Mär 29 2021, Andreas Schwab wrote: > On Mär 29 2021, Christophe Leroy wrote: > >> Le 29/03/2021 à 10:33, Benjamin Herrenschmidt a écrit : >>> On Fri, 2021-03-12 at 11:20 +1000, Nicholas Piggin wrote: +static inline void nap_adjust_return(struct pt_regs *regs) +{

Re: [PATCH] PCI: Try to find two continuous regions for child resource

2021-03-29 Thread Bjorn Helgaas
On Mon, Mar 29, 2021 at 04:47:59PM +0800, Kai-Heng Feng wrote: > Built-in grahpics on HP EliteDesk 805 G6 doesn't work because graphics > can't get the BAR it needs: > [0.611504] pci_bus :00: root bus resource [mem > 0x1002020-0x100303f window] > [0.611505] pci_bus :00:

Re: [PATCH] powerpc/64s: power4 nap fixup in C

2021-03-29 Thread Andreas Schwab
On Mär 29 2021, Andreas Schwab wrote: > On Mär 29 2021, Michael Ellerman wrote: > >> Nicholas Piggin writes: >>> There is no need for this to be in asm, use the new intrrupt entry wrapper. >>> >>> Signed-off-by: Nicholas Piggin >>> --- >>> Hopefully this works on a real G5 now, but I couldn't

[PATCH v3] powerpc/papr_scm: Implement support for H_SCM_FLUSH hcall

2021-03-29 Thread Shivaprasad G Bhat
Add support for ND_REGION_ASYNC capability if the device tree indicates 'ibm,hcall-flush-required' property in the NVDIMM node. Flush is done by issuing H_SCM_FLUSH hcall to the hypervisor. If the flush request failed, the hypervisor is expected to to reflect the problem in the subsequent nvdimm