[PATCH v1 01/12] serial: cpm_uart: Avoid suspicious locking

2023-08-03 Thread Christophe Leroy
} else { spin_lock_irqsave(>port.lock, flags); cpm_uart_early_write(pinfo, s, count, true); spin_unlock_irqrestore(>port.lock, flags); } Signed-off-by: Christophe Leroy --- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 13 - 1 file changed, 4 inse

[PATCH v1 03/12] serial: cpm_uart: Stop using fs_uart_id enum

2023-08-03 Thread Christophe Leroy
Using an enum indirection to define numeric macros is pointless. Directly use the wanted numeric value. Signed-off-by: Christophe Leroy --- drivers/tty/serial/cpm_uart/cpm_uart.h | 3 +-- drivers/tty/serial/cpm_uart/cpm_uart_core.c | 1 - 2 files changed, 1 insertion(+), 3 deletions

Re: [PATCH] powerpc: pmac32: enable serial options by default in defconfig

2023-08-02 Thread Christophe Leroy
; architectures enable serial by default. > > Let's enable CONFIG_SERIAL_PMACZILOG and CONFIG_SERIAL_PMACZILOG_CONSOLE > by default. > > Signed-off-by: Yuan Tan Reviewed-by: Christophe Leroy > --- > arch/powerpc/configs/pmac32_defconfig | 3 ++- > 1 file changed, 2 inser

Re: [PATCH 0/7] Rework perf and ptrace watchpoint tracking

2023-08-01 Thread Christophe Leroy
Le 01/08/2023 à 03:17, Benjamin Gray a écrit : > Syzkaller triggered a null pointer dereference in the > arch_unregister_hw_breakpoint() hook. This is due to accessing > the bp->ctx->task field changing to -1 while we iterate the breakpoints. > > This series refactors the breakpoint tracking

Re: [PATCH] Documentation: devices.txt: reconcile serial/ucc_uart minor numers

2023-08-01 Thread Christophe Leroy
Le 01/08/2023 à 07:30, Randy Dunlap a écrit : > Hi Christophe, > > On 7/31/23 22:21, Christophe Leroy wrote: >> >> >> Le 24/07/2023 à 08:33, Randy Dunlap a écrit : >>> Reconcile devices.txt with serial/ucc_uart.c regarding device number >>> assi

Re: [PATCH] Documentation: devices.txt: reconcile serial/ucc_uart minor numers

2023-07-31 Thread Christophe Leroy
Le 24/07/2023 à 08:33, Randy Dunlap a écrit : > Reconcile devices.txt with serial/ucc_uart.c regarding device number > assignments. ucc_uart.c supports 4 ports and uses minor devnums > 46-49, so update devices.txt with that info. > Then update ucc_uart.c's reference to the location of the

Re: [PATCH v5] Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto"

2023-07-17 Thread Christophe Leroy
Le 17/07/2023 à 07:01, Michael Ellerman a écrit : > Christophe Leroy writes: >> Le 12/07/2023 à 15:45, Michael Ellerman a écrit : >>> From: Christophe Leroy >>> >>> This partly reverts commit 1e688dd2a3d6759d416616ff07afc4bb836c4213. >>> >&g

Re: [PATCH v4 00/15] powerpc/objtool: uaccess validation for PPC32 (v4)

2023-07-12 Thread Christophe Leroy
Le 12/07/2023 à 16:23, Peter Zijlstra a écrit : > On Tue, Jul 11, 2023 at 06:08:26PM +0200, Christophe Leroy wrote: >> This series adds UACCESS validation for PPC32. It includes >> a dozen of changes to objtool core. >> >> It applies on top of series "Clea

Re: [PATCH v5] Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto"

2023-07-12 Thread Christophe Leroy
Le 12/07/2023 à 15:45, Michael Ellerman a écrit : > From: Christophe Leroy > > This partly reverts commit 1e688dd2a3d6759d416616ff07afc4bb836c4213. > > That commit aimed at optimising the code around generation of > WARN_ON/BUG_ON but this leads to a lot of dead code erron

[PATCH v4 15/15] powerpc: Implement UACCESS validation on PPC32

2023-07-11 Thread Christophe Leroy
() as global noreturn functions, and declare __copy_tofrom_user() and __arch_clear_user() as UACCESS safe. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 2 + arch/powerpc/include/asm/book3s/32/kup.h | 2 + arch/powerpc/include/asm/nohash/32/kup-8xx.h

[PATCH v4 08/15] objtool: Track general purpose register used for switch table base

2023-07-11 Thread Christophe Leroy
. Signed-off-by: Christophe Leroy --- tools/objtool/arch/powerpc/special.c| 3 ++- tools/objtool/arch/x86/special.c| 3 ++- tools/objtool/check.c | 9 + tools/objtool/include/objtool/check.h | 6 -- tools/objtool/include/objtool/special.h | 3 ++- 5 files

[PATCH v4 14/15] powerpc/bug: Annotate reachable after warning trap

2023-07-11 Thread Christophe Leroy
tion. Mark it reachable so that objtool knows that it is not a dead end in that case. Also change the unreachable() annotation by __builtin_unreachable() since objtool already knows that a BUG instruction is a dead end. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/bug.h | 14

[PATCH v4 07/15] objtool: Merge mark_func_jump_tables() and add_func_jump_tables()

2023-07-11 Thread Christophe Leroy
Those two functions loop over the instructions of a function. Merge the two loops in order to ease enhancement of table end in a following patch. Signed-off-by: Christophe Leroy --- tools/objtool/check.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git

[PATCH v4 04/15] objtool: Fix JUMP_ENTRY_SIZE for bi-arch like powerpc

2023-07-11 Thread Christophe Leroy
). To allow that, entries[] table must be initialised at runtime. This is easily done by moving it into its only user which is special_get_alts(). Signed-off-by: Christophe Leroy Acked-by: Peter Zijlstra (Intel) --- .../arch/powerpc/include/arch/special.h | 2 +- tools/objtool/special.c

[PATCH v4 02/15] objtool: Move back misplaced comment

2023-07-11 Thread Christophe Leroy
Fixes: d871f7b5a6a2 ("objtool: Refactor jump table code to support other architectures") Signed-off-by: Christophe Leroy --- tools/objtool/arch/x86/special.c | 5 - tools/objtool/check.c| 6 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/objt

[PATCH v4 06/15] objtool: Add support for relative switch tables

2023-07-11 Thread Christophe Leroy
C jump tables. Do the comparison using R_ABS32 and R_ABS64 which are architecture agnostic. And use correct size for 'long' instead of hard coding a size of '8'. Signed-off-by: Christophe Leroy --- tools/objtool/check.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) dif

[PATCH v4 12/15] objtool: Add support for more complex UACCESS control

2023-07-11 Thread Christophe Leroy
. And add ASM_UACCESS_BEGIN and ASM_UACCESS_END macros to be used in inline assembly code to annotate UACCESS enable and UACCESS disable instructions. Signed-off-by: Christophe Leroy --- include/linux/objtool.h | 14 ++ tools/objtool/check.c | 33 + 2

[PATCH v4 11/15] objtool: .rodata.cst{2/4/8/16} are not switch tables

2023-07-11 Thread Christophe Leroy
Exclude sections named .rodata.cst2 .rodata.cst4 .rodata.cst8 .rodata.cst16 as they won't contain switch tables. Signed-off-by: Christophe Leroy --- tools/objtool/check.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c

[PATCH v4 10/15] objtool: When looking for switch tables also follow conditional and dynamic jumps

2023-07-11 Thread Christophe Leroy
When walking backward to find the base address of a switch table, also take into account conditionnal branches and dynamic jumps from a previous switch table. To avoid mis-routing, break when stumbling on a function return. Signed-off-by: Christophe Leroy --- tools/objtool/check.c | 8

[PATCH v4 05/15] objtool: Add INSN_RETURN_CONDITIONAL

2023-07-11 Thread Christophe Leroy
t code after that conditional return is dead. To overcome this situation, introduce INSN_RETURN_CONDITIONAL which is taken as a confirmation that a function is not noreturn but still sees following code as reachable. Signed-off-by: Christophe Leroy Acked-by: Peter Zijlstra (Intel) --- tools/obj

[PATCH v4 13/15] objtool: Prepare noreturns.h for more architectures

2023-07-11 Thread Christophe Leroy
noreturns.h is a mix of x86 specific functions and more generic core functions. In preparation of inclusion of powerpc, split x86 functions out of noreturns.h into arch/noreturns.h Signed-off-by: Christophe Leroy --- .../objtool/arch/x86/include/arch/noreturns.h | 20 +++ tools

[PATCH v4 09/15] objtool: Find end of switch table directly

2023-07-11 Thread Christophe Leroy
starts. Signed-off-by: Christophe Leroy --- tools/objtool/check.c | 62 --- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index be413c578588..361c832aefc8 100644 --- a/tools/objtool/check.c +++ b

[PATCH v4 03/15] objtool: Allow an architecture to disable objtool on ASM files

2023-07-11 Thread Christophe Leroy
validation on ASM files. Suggested-by: Naveen N Rao Signed-off-by: Christophe Leroy --- arch/Kconfig | 5 + scripts/Makefile.build | 4 2 files changed, 9 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index aff2746c8af2..3330ed761260 100644 --- a/arch/Kconfig +++ b/arch

[PATCH v4 01/15] Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto"

2023-07-11 Thread Christophe Leroy
in WARN_ON(), including build failures, keeping that change is not worth it allthough it is primarily a compiler bug. Revert it for now. Signed-off-by: Christophe Leroy Acked-by: Naveen N Rao --- arch/powerpc/include/asm/book3s/64/kup.h | 2 +- arch/powerpc/include/asm/bug.h

[PATCH v4 00/15] powerpc/objtool: uaccess validation for PPC32 (v4)

2023-07-11 Thread Christophe Leroy
n comments from Peter Christophe Leroy (15): Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto" objtool: Move back misplaced comment objtool: Allow an architecture to disable objtool on ASM files objtool: Fix JUMP_ENTRY_SIZE for bi-arch li

[PATCH v3 8/9] powerpc/kuap: KUAP enabling/disabling functions must be __always_inline

2023-07-11 Thread Christophe Leroy
() with UACCESS enabled This is due to some KUAP enabling/disabling functions being outline allthough they are marked inline. Use __always_inline instead. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 18 +++ arch/powerpc/include/asm/book3s/64

[PATCH v3 9/9] powerpc/kuap: Use ASM feature fixups instead of static branches

2023-07-11 Thread Christophe Leroy
later when objtool is activated on PPC64. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 46 arch/powerpc/include/asm/kup.h | 45 +++ arch/powerpc/include/asm/nohash/32/kup-8xx.h | 30 + arch/powerpc

[PATCH v3 5/9] powerpc/kuap: MMU_FTR_BOOK3S_KUAP becomes MMU_FTR_KUAP

2023-07-11 Thread Christophe Leroy
In order to reuse MMU_FTR_BOOK3S_KUAP for other targets than BOOK3S, rename it MMU_FTR_KUAP. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/64/hash-pkey.h | 2 +- arch/powerpc/include/asm/book3s/64/kup.h | 18 +- arch/powerpc/include/asm/mmu.h

[PATCH v3 7/9] powerpc/kuap: Simplify KUAP lock/unlock on BOOK3S/32

2023-07-11 Thread Christophe Leroy
is crossing a segment boundary. That would definitely require at least having userspace access enabled on the two segments. To avoid complicating the likely case for a so unlikely happening, handle such situation like an alignment exception and emulate the store. Signed-off-by: Christophe Leroy

[PATCH v3 6/9] powerpc/kuap: Use MMU_FTR_KUAP on all and refactor disabling kuap

2023-07-11 Thread Christophe Leroy
All but book3s/64 use a static branch key for disabling kuap. book3s/64 uses an mmu feature. Refactor all targets to use MMU_FTR_KUAP like book3s/64. For PPC32 that implies updating mmu features fixups once KUAP has been initialised. Signed-off-by: Christophe Leroy --- arch/powerpc/include

[PATCH v3 1/9] powerpc/kuap: Avoid unnecessary reads of MD_AP

2023-07-11 Thread Christophe Leroy
BOOKE. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/32/kup-8xx.h | 8 ++-- arch/powerpc/include/asm/nohash/kup-booke.h | 6 ++ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/nohash/32/kup-8xx.h b/arch/powerpc/include/asm/noh

[PATCH v3 4/9] powerpc/features: Add capability to update mmu features later

2023-07-11 Thread Christophe Leroy
. The function is passed a mask with the features that can be updated. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/feature-fixups.h | 1 + arch/powerpc/lib/feature-fixups.c | 31 --- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/arch/powerpc

[PATCH v3 2/9] powerpc/kuap: Avoid useless jump_label on empty function

2023-07-11 Thread Christophe Leroy
e same with __kuap_save_and_lock() and __kuap_get_and_assert_locked(). Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- v2: Add back comment about __kupa_lock() not needed on 64s --- arch/powerpc/include/asm/book3s/32/kup.h | 6 ++-- arch/powerpc/include/asm/book3s/64/kup.h | 10 ++

[PATCH v3 3/9] powerpc/kuap: Fold kuep_is_disabled() into its only user

2023-07-11 Thread Christophe Leroy
_new_context() which is its only user. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 5 - arch/powerpc/mm/book3s32/mmu_context.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/32/kup.h b/arch/powerpc/i

[PATCH v3 0/9] Cleanup/Optimise KUAP (v3)

2023-07-11 Thread Christophe Leroy
validation, but even before they are worth it, especially the simplification on 32s. Changes in v3: - Rearranged book3s/32 simplification in order to ease objtool UACCESS check implementation (patches 7 and 9) Christophe Leroy (9): powerpc/kuap: Avoid unnecessary reads of MD_AP powerpc/kuap: Avoid

Re: [PATCH v5 21/38] powerpc: Implement the new page table range API

2023-07-10 Thread Christophe Leroy
poport (IBM) > Cc: Michael Ellerman > Cc: Nicholas Piggin > Cc: Christophe Leroy > Cc: linuxppc-dev@lists.ozlabs.org Reviewed-by: Christophe Leroy > --- > arch/powerpc/include/asm/book3s/32/pgtable.h | 5 -- > arch/powerpc/include/asm/book3s/64/pgtable.h | 6 +-- >

Re: [PATCH v4 20/36] powerpc: Implement the new page table range API

2023-07-10 Thread Christophe Leroy
Le 10/07/2023 à 22:24, Matthew Wilcox a écrit : > On Sat, Mar 18, 2023 at 09:19:04AM +0000, Christophe Leroy wrote: >> void set_ptes(struct mm_struct *mm, unsigned long addr, pte_t *ptep, >> pte_t pte, unsigned int nr) >> { >> pgprot_t prot

Re: [PATCH v4 08/13] powerpc/mm/trace: Convert trace event to trace event class

2023-07-10 Thread Christophe Leroy
Le 10/07/2023 à 18:08, Aneesh Kumar K.V a écrit : > A follow-up patch will add a pud variant for this same event. > Using event class makes that addition simpler. > > No functional change in this patch. > > Signed-off-by: Aneesh Kumar K.V Reviewed-by: Christophe Lero

Re: [PATCH v4 06/13] mm/huge pud: Use transparent huge pud helpers only with CONFIG_TRANSPARENT_HUGEPAGE

2023-07-10 Thread Christophe Leroy
EPAGE is set > > Signed-off-by: Aneesh Kumar K.V Reviewed-by: Christophe Leroy > --- > include/linux/pgtable.h | 2 ++ > mm/mremap.c | 2 +- > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h >

Re: [PATCH v4 05/13] mm: Add __HAVE_ARCH_PUD_SAME similar to __HAVE_ARCH_P4D_SAME

2023-07-10 Thread Christophe Leroy
Le 10/07/2023 à 18:08, Aneesh Kumar K.V a écrit : > This helps architectures to override pmd_same and pud_same independently. > > Signed-off-by: Aneesh Kumar K.V Reviewed-by: Christophe Leroy Shouldn't you do it the modern way and use #ifndef pud_same instead of a new __HAVE_ARCH

Re: [PATCH v4 04/13] mm/vmemmap: Allow architectures to override how vmemmap optimization works

2023-07-10 Thread Christophe Leroy
Le 10/07/2023 à 18:08, Aneesh Kumar K.V a écrit : > Architectures like powerpc will like to use different page table allocators > and mapping mechanisms to implement vmemmap optimization. Similar to > vmemmap_populate allow architectures to implement > vmemap_populate_compound_pages > >

Re: [PATCH v4 03/13] mm/vmemmap: Improve vmemmap_can_optimize and allow architectures to override

2023-07-10 Thread Christophe Leroy
werpc also want to enable vmemmap optimization > conditionally (only with radix MMU translation). Hence allow architecture > override. > > Signed-off-by: Aneesh Kumar K.V Reviewed-by: Christophe Leroy Why renaming vmemmap_can_optimize() to __vmemmap_can_optimize() and keep it when

Re: [PATCH v4 02/13] mm: Change pudp_huge_get_and_clear_full take vm_area_struct as arg

2023-07-10 Thread Christophe Leroy
-off-by: Aneesh Kumar K.V Reviewed-by: Christophe Leroy > --- > include/linux/pgtable.h | 4 ++-- > mm/debug_vm_pgtable.c | 2 +- > mm/huge_memory.c| 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/include/linux/pgtable.h b/include/linu

Re: [PATCH v4 01/13] mm/hugepage pud: Allow arch-specific helper function to check huge page pud support

2023-07-10 Thread Christophe Leroy
neesh Kumar K.V Reviewed-by: Christophe Leroy > --- > drivers/nvdimm/pfn_devs.c | 2 +- > include/linux/pgtable.h | 3 +++ > 2 files changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c > index af7d9301520c.

Re: [PATCH v5 02/13] x86/kexec: refactor for kernel/Kconfig.kexec

2023-07-07 Thread Christophe Leroy
Le 07/07/2023 à 00:20, Eric DeVolder a écrit : > The kexec and crash kernel options are provided in the common > kernel/Kconfig.kexec. Utilize the common options and provide > the ARCH_SUPPORTS_ and ARCH_SELECTS_ entries to recreate the > equivalent set of KEXEC and CRASH options. Why do you

Re: [PATCH] powerpc64/kasan: Call kasan_early_init() after PACA initialised

2023-07-06 Thread Christophe Leroy
Le 07/07/2023 à 04:20, Benjamin Gray a écrit : > The inclusion of kasan_early_init() is conditional on CONFIG_KASAN, so > >if(IS_ENABLED(CONFIG_KASAN)) >kasan_early_init(); > > wouldn't work. See my comment on the main patch, just do like kasan_init() and others in

Re: [PATCH] powerpc64/kasan: Call kasan_early_init() after PACA initialised

2023-07-06 Thread Christophe Leroy
Le 07/07/2023 à 03:31, Benjamin Gray a écrit : > The KCOV handler __sanitizer_cov_trace_pc() uses the PACA, so initialise > the PACA first. This fixes a hang during boot when KASAN and KCOV are > both enabled, where the coverage tracer in kasan_early_init() tries to > access a field of the

Re: [PATCH v3] powerpc/fsl_rio: add missing of_node_put() in fsl_rio_setup()

2023-07-06 Thread Christophe Leroy
Le 24/11/2022 à 15:33, Yang Yingliang a écrit : > The of node returned by of_find_compatible_node() with refcount > decremented, of_node_put() need be called after using it to avoid > refcount leak. Is that patch still required ? If yes, please rebase and resend. Thanks Christophe > > Fixes:

Re: [PATCH linux-next][RFC]torture: avoid offline tick_do_timer_cpu

2023-07-06 Thread Christophe Leroy
Le 21/11/2022 à 04:51, Zhouyi Zhou a écrit : > During CPU-hotplug torture (CONFIG_NO_HZ_FULL=y), if we try to > offline tick_do_timer_cpu, the operation will fail because in > function tick_nohz_cpu_down: > ``` > if (tick_nohz_full_running && tick_do_timer_cpu == cpu) >return -EBUSY; >

Re: [PATCH] rtc: Kconfig: select REGMAP for RTC_DRV_DS1307

2023-07-06 Thread Christophe Leroy
Le 06/07/2023 à 08:14, Benjamin Gray a écrit : > On Thu, 2023-07-06 at 05:13 +0000, Christophe Leroy wrote: >> >> >> Le 05/07/2023 à 02:30, Benjamin Gray a écrit : >>> The drivers/rtc/rtc-ds1307.c driver has a direct dependency on >>> struct regmap_config

Re: [PATCH] rtc: Kconfig: select REGMAP for RTC_DRV_DS1307

2023-07-05 Thread Christophe Leroy
Le 05/07/2023 à 02:30, Benjamin Gray a écrit : > The drivers/rtc/rtc-ds1307.c driver has a direct dependency on > struct regmap_config, which is guarded behind CONFIG_REGMAP. > > Commit 70a640c0efa7 ("regmap: REGMAP_KUNIT should not select REGMAP") > exposed this by disabling the default pick

Re: [PATCH] powerpc/powermac: Use early_* IO variants in via_calibrate_decr

2023-07-05 Thread Christophe Leroy
e a maple tree for interrupt descriptor management"). > It's not clear to me why this causes it to surface. > > Signed-off-by: Benjamin Gray Reviewed-by: Christophe Leroy > --- > arch/powerpc/platforms/powermac/time.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 d

[PATCH v2 6/9] powerpc/kuap: Use MMU_FTR_KUAP on all and refactor disabling kuap

2023-07-03 Thread Christophe Leroy
All but book3s/64 use a static branch key for disabling kuap. book3s/64 uses an mmu feature. Refactor all targets to use MMU_FTR_KUAP like book3s/64. For PPC32 that implies updating mmu features fixups once KUAP has been initialised. Signed-off-by: Christophe Leroy --- arch/powerpc/include

[PATCH v2 8/9] powerpc/kuap: KUAP enabling/disabling functions must be __always_inline

2023-07-03 Thread Christophe Leroy
() with UACCESS enabled This is due to some KUAP enabling/disabling functions being outline allthough they are marked inline. Use __always_inline instead. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 18 +++ arch/powerpc/include/asm/book3s/64

[PATCH v2 4/9] powerpc/features: Add capability to update mmu features later

2023-07-03 Thread Christophe Leroy
. The function is passed a mask with the features that can be updated. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/feature-fixups.h | 1 + arch/powerpc/lib/feature-fixups.c | 31 --- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/arch/powerpc

[PATCH v2 3/9] powerpc/kuap: Fold kuep_is_disabled() into its only user

2023-07-03 Thread Christophe Leroy
_new_context() which is its only user. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 5 - arch/powerpc/mm/book3s32/mmu_context.c | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/32/kup.h b/arch/powerpc/i

[PATCH v2 5/9] powerpc/kuap: MMU_FTR_BOOK3S_KUAP becomes MMU_FTR_KUAP

2023-07-03 Thread Christophe Leroy
In order to reuse MMU_FTR_BOOK3S_KUAP for other targets than BOOK3S, rename it MMU_FTR_KUAP. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/64/hash-pkey.h | 2 +- arch/powerpc/include/asm/book3s/64/kup.h | 18 +- arch/powerpc/include/asm/mmu.h

[PATCH v2 7/9] powerpc/kuap: Simplify KUAP lock/unlock on BOOK3S/32

2023-07-03 Thread Christophe Leroy
is crossing a segment boundary. That would definitely require at least having userspace access enabled on the two segments. To avoid complicating the likely case for a so unlikely happening, handle such situation like an alignment exception and emulate the store. Signed-off-by: Christophe Leroy

[PATCH v2 2/9] powerpc/kuap: Avoid useless jump_label on empty function

2023-07-03 Thread Christophe Leroy
e same with __kuap_save_and_lock() and __kuap_get_and_assert_locked(). Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- v2: Add back comment about __kupa_lock() not needed on 64s --- arch/powerpc/include/asm/book3s/32/kup.h | 6 ++-- arch/powerpc/include/asm/book3s/64/kup.h | 10 ++

[PATCH v2 1/9] powerpc/kuap: Avoid unnecessary reads of MD_AP

2023-07-03 Thread Christophe Leroy
BOOKE. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/32/kup-8xx.h | 8 ++-- arch/powerpc/include/asm/nohash/kup-booke.h | 6 ++ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/nohash/32/kup-8xx.h b/arch/powerpc/include/asm/noh

[PATCH v2 9/9] powerpc/kuap: Use ASM feature fixups instead of static branches

2023-07-03 Thread Christophe Leroy
later when objtool is activated on PPC64. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 34 +++ arch/powerpc/include/asm/kup.h | 45 +++- arch/powerpc/include/asm/nohash/32/kup-8xx.h | 30 + arch/powerpc

[PATCH v2 0/9] Cleanup/Optimise KUAP (v2)

2023-07-03 Thread Christophe Leroy
validation, but even before they are worth it, especially the simplification on 32s. Christophe Leroy (9): powerpc/kuap: Avoid unnecessary reads of MD_AP powerpc/kuap: Avoid useless jump_label on empty function powerpc/kuap: Fold kuep_is_disabled() into its only user powerpc/features: Add

Re: [PATCH v2] powerpc: allow PPC_EARLY_DEBUG_CPM only when SERIAL_CPM=y

2023-07-01 Thread Christophe Leroy
allowing PPC_EARLY_DEBUG_CPM only when > SERIAL_CPM=y. > > Fixes: c374e00e17f1 ("[POWERPC] Add early debug console for CPM serial > ports.") > Signed-off-by: Randy Dunlap > Cc: Kumar Gala > Cc: "Pali Rohár" > Cc: Michael Ellerman > Cc: Nicholas Pig

Re: [PATCH] powerpc: allow PPC_EARLY_DEBUG_CPM only when SERIAL_CPM=y

2023-07-01 Thread Christophe Leroy
y when >>>> SERIAL_CPM=y. >>>> >>>> Fixes: c374e00e17f1 ("[POWERPC] Add early debug console for CPM serial >>>> ports.") >>>> Signed-off-by: Randy Dunlap >>>> Cc: Scott Wood >>>> Cc: Kumar Gala >>>>

Re: [PATCH] usb: gadget: fsl_qe_udc: validate endpoint index for ch9 udc

2023-06-28 Thread Christophe Leroy
Le 28/06/2023 à 23:10, Leo Li a écrit : > > >> -Original Message----- >> From: Christophe Leroy >> Sent: Wednesday, June 28, 2023 2:40 PM >> To: Leo Li ; Ma Ke >> Cc: gre...@linuxfoundation.org; linux-...@vger.kernel.org; linuxppc- >> d...@list

Re: [PATCH] usb: gadget: fsl_qe_udc: validate endpoint index for ch9 udc

2023-06-28 Thread Christophe Leroy
Le 28/06/2023 à 19:04, Leo Li a écrit : > > >> -Original Message- >> From: Ma Ke >> Sent: Wednesday, June 28, 2023 3:15 AM >> To: Leo Li >> Cc: gre...@linuxfoundation.org; linux-...@vger.kernel.org; linuxppc- >> d...@lists.ozlabs.org; linux-ker...@vger.kernel.org; Ma Ke >> >>

objtool: Seeking help for improving switch table processing

2023-06-24 Thread Christophe Leroy
Hello Josh and Peter, As mentionned in the cover letter of my series "powerpc/objtool: uaccess validation for PPC32 (v3)" [1], a few switch table lookup fail, and it would help if you had ideas on how to handle them. First one is as follows. First switch is properly detected, second is not.

Re: [PATCH] objtool: Make 'sec-address' always on

2023-06-24 Thread Christophe Leroy
Le 22/06/2023 à 08:31, Josh Poimboeuf a écrit : > On Wed, Jun 21, 2023 at 05:20:31PM +0200, Christophe Leroy wrote: >> Most of the time objtool warnings are useless without the >> absolute address within the section. >> >> Today there is --sec-address option to get it

Re: [PATCH] objtool: Make 'sec-address' always on

2023-06-24 Thread Christophe Leroy
tree, kindly drop us a note. > And when submitting patch, we suggest to use '--base' as documented in > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: > https://github.com/intel-lab-lkp/linux/commits/Christophe-Leroy/objtool-Make-sec-address-alway

[PATCH v3 08/15] objtool: Fix JUMP_ENTRY_SIZE for bi-arch like powerpc

2023-06-23 Thread Christophe Leroy
). To allow that, entries[] table must be initialised at runtime. This is easily done by moving it into its only user which is special_get_alts(). Signed-off-by: Christophe Leroy Acked-by: Peter Zijlstra (Intel) --- .../arch/powerpc/include/arch/special.h | 2 +- tools/objtool/special.c

[PATCH v3 05/15] powerpc/kuap: KUAP enabling/disabling functions must be __always_inline

2023-06-23 Thread Christophe Leroy
() with UACCESS enabled This is due to some KUAP enabling/disabling functions being outline allthough they are marked inline. Use __always_inline instead. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 26 ++-- arch/powerpc/include/asm/book3s

[PATCH v3 15/15] powerpc: Implement UACCESS validation on PPC32

2023-06-23 Thread Christophe Leroy
noreturn functions, and declare __copy_tofrom_user() and __arch_clear_user() as UACCESS safe. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 2 + arch/powerpc/include/asm/kup.h| 12 +++ arch/powerpc/include/asm/nohash/32/kup-8xx.h | 8

[PATCH v3 06/15] Revert "powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto"

2023-06-23 Thread Christophe Leroy
' in WARN_ON(), including build failures, keeping that change is not worth it allthough it is primarily a compiler bug. So revert it for now. Signed-off-by: Christophe Leroy Acked-by: Naveen N Rao --- v2: Do not remove tools/testing/selftests/powerpc/primitives/asm/extable.h and leave EX_TABLE in asm

[PATCH v3 03/15] powerpc/kuap: Refactor static branch for disabling kuap

2023-06-23 Thread Christophe Leroy
All but book3s/64 use a static branch key for disabling kuap. book3s/64 uses a memory feature. Refactor all targets except book3s/64. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/kup.h | 7 --- arch/powerpc/include/asm/book3s/64/kup.h | 1 + arch/powerpc

[PATCH v3 07/15] objtool: Allow an architecture to disable objtool on ASM files

2023-06-23 Thread Christophe Leroy
validation on ASM files. Suggested-by: Naveen N Rao Signed-off-by: Christophe Leroy --- arch/Kconfig | 5 + scripts/Makefile.build | 4 2 files changed, 9 insertions(+) diff --git a/arch/Kconfig b/arch/Kconfig index 205fd23e0cad..dd66b884bcfb 100644 --- a/arch/Kconfig +++ b/arch

[PATCH v3 12/15] objtool: Add support for more complex UACCESS control

2023-06-23 Thread Christophe Leroy
. And add ASM_UACCESS_BEGIN and ASM_UACCESS_END macros to be used in inline assembly code to annotate UACCESS enable and UACCESS disable instructions. Signed-off-by: Christophe Leroy --- include/linux/objtool.h | 14 ++ tools/objtool/check.c | 33 + 2

[PATCH v3 14/15] powerpc/bug: Annotate reachable after warning trap

2023-06-23 Thread Christophe Leroy
tion. Mark it reachable so that objtool knows that it is not a dead end in that case. Also change the unreachable() annotation by __builtin_unreachable() since objtool already knows that a BUG instruction is a dead end. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/bug.h | 14

[PATCH v3 10/15] objtool: Add support for relative switch tables

2023-06-23 Thread Christophe Leroy
C jump tables. Do the comparison using R_ABS32 and R_ABS64 which are architecture agnostic. And use correct size for 'long' instead of hard coding a size of '8'. Signed-off-by: Christophe Leroy --- tools/objtool/check.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) dif

[PATCH v3 11/15] objtool: Remove too strict constraint in jump table search

2023-06-23 Thread Christophe Leroy
here find_jump_table() contains a constraint that stops the backsearch of the table address loading when a jump is found in-between. Remove that constraint. Signed-off-by: Christophe Leroy --- tools/objtool/check.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/tools/objtool

[PATCH v3 09/15] objtool: Add INSN_RETURN_CONDITIONAL

2023-06-23 Thread Christophe Leroy
t code after that conditional return is dead. To overcome this situation, introduce INSN_RETURN_CONDITIONAL which is taken as a confirmation that a function is not noreturn but still sees following code as reachable. Signed-off-by: Christophe Leroy Acked-by: Peter Zijlstra (Intel) --- tools/obj

[PATCH v3 04/15] powerpc/kuap: Make disabling KUAP at boottime impossible except on book3s/64

2023-06-23 Thread Christophe Leroy
ive when selected in kernel config. In the future it may be re-implemented by noping the instructions instead of using static branches. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/kup.h | 4 +--- arch/powerpc/mm/book3s32/kuap.c | 15 ++- arch/powerpc/mm/init-commo

[PATCH v3 13/15] objtool: Prepare noreturns.h for more architectures

2023-06-23 Thread Christophe Leroy
noreturns.h is a mix of x86 specific functions and more generic core functions. In preparation of inclusion of powerpc, split x86 functions out of noreturns.h into arch/noreturns.h Signed-off-by: Christophe Leroy --- .../objtool/arch/x86/include/arch/noreturns.h | 20 +++ tools

[PATCH v3 00/15] powerpc/objtool: uaccess validation for PPC32 (v3)

2023-06-23 Thread Christophe Leroy
/core tree - Simplified support for relative switch tables based on relocation type - Taken comments from Peter Christophe Leroy (15): powerpc/kuap: Avoid unnecessary reads of MD_AP powerpc/kuap: Avoid useless jump_label on empty function powerpc/kuap: Refactor static branch for disabling

[PATCH v3 02/15] powerpc/kuap: Avoid useless jump_label on empty function

2023-06-23 Thread Christophe Leroy
e same with __kuap_save_and_lock() and __kuap_get_and_assert_locked(). Signed-off-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- v2: Add back comment about __kupa_lock() not needed on 64s --- arch/powerpc/include/asm/book3s/32/kup.h | 6 ++--- arch/powerpc/include/asm/book3s/64/kup.h | 10 ++--

[PATCH v3 01/15] powerpc/kuap: Avoid unnecessary reads of MD_AP

2023-06-23 Thread Christophe Leroy
BOOKE. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/nohash/32/kup-8xx.h | 8 ++-- arch/powerpc/include/asm/nohash/kup-booke.h | 6 ++ 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/nohash/32/kup-8xx.h b/arch/powerpc/include/asm/noh

Re: [PATCH v2 14/14] powerpc: Implement UACCESS validation on PPC32

2023-06-23 Thread Christophe Leroy
Le 22/06/2023 à 13:56, Peter Zijlstra a écrit : > On Thu, Jun 22, 2023 at 12:54:36PM +0200, Christophe Leroy wrote: > >> diff --git a/tools/objtool/check.c b/tools/objtool/check.c >> index f850ab892ad5..8ac5711a055f 100644 >> --- a/tools/objtool/check.c >&g

Re: [PATCH v2 10/14] objtool: Add support for relative switch tables

2023-06-23 Thread Christophe Leroy
Le 22/06/2023 à 13:48, Peter Zijlstra a écrit : > On Thu, Jun 22, 2023 at 12:54:32PM +0200, Christophe Leroy wrote: >> On powerpc, switch tables are relative, than means the address of the >> table is added to the value of the entry in order to get the pointed >> addre

Re: [PATCH 17/17] powerpc/ftrace: Create a dummy stackframe to fix stack unwind

2023-06-22 Thread Christophe Leroy
/0x350 > 16) 416 416 system_call_common+0x160/0x2c4 > > This results in two additional stores in the ftrace entry code, but > produces reliable backtraces. Note that this change now aligns with > other architectures (arm64, s390, x86). > > Signed-off-by: Naveen N Ra

Re: [PATCH 16/17] powerpc/ftrace: Add support for -fpatchable-function-entry

2023-06-22 Thread Christophe Leroy
itional store was removed in later > compiler versions for performance reasons. The same reasons apply for > ppc32 so we only patch in a 'mflr r0'. > > Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy Nit below > --- > arch/powerpc/Kconfig

Re: [PATCH 15/17] powerpc/ftrace: Implement ftrace_replace_code()

2023-06-22 Thread Christophe Leroy
> Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy > --- > arch/powerpc/kernel/trace/ftrace.c | 173 - > 1 file changed, 96 insertions(+), 77 deletions(-) > > diff --git a/arch/powerpc/kernel/trace/ftrace.c > b/arch/powerpc/kernel/tr

Re: [PATCH 14/17] powerpc/ftrace: Replace use of ftrace_call_replace() with ftrace_create_branch_inst()

2023-06-22 Thread Christophe Leroy
Le 19/06/2023 à 11:47, Naveen N Rao a écrit : > ftrace_create_branch_inst() is clearer about its intent than > ftrace_call_replace(). > > Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy > --- > arch/powerpc/kernel/trace/ftrace.c | 17 ++--- >

Re: [PATCH 13/17] powerpc/ftrace: Simplify ftrace_modify_call()

2023-06-22 Thread Christophe Leroy
cation. Note that we continue to ensure we > have the expected branch instruction at the ftrace location before > patching it with the updated branch destination. > > Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy > --- > arch/power

Re: [PATCH 12/17] powerpc/ftrace: Simplify ftrace_make_call()

2023-06-22 Thread Christophe Leroy
we continue to ensure that we have a nop at the ftrace > location before patching it. > > Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy > --- > arch/powerpc/kernel/trace/ftrace.c | 187 + > 1 file changed, 31 insertions(+), 156 deletions(-)

Re: [PATCH 11/17] powerpc/ftrace: Simplify ftrace_make_nop()

2023-06-22 Thread Christophe Leroy
we continue to ensure that we have a bl to > ftrace_[regs_]caller at the ftrace location before nop-ing it out. > > Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy > --- > arch/powerpc/kernel/trace/ftrace.c | 220 + > 1 file changed, 3

Re: [PATCH 10/17] powerpc/ftrace: Add separate ftrace_init_nop() with additional validation

2023-06-22 Thread Christophe Leroy
simply patch the necessary instructions during > enabling/disabling ftrace. > > Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy > --- > arch/powerpc/include/asm/ftrace.h | 6 +++ > arch/powerpc/kernel/trace/ftrace.c | 71 ++ > 2 files ch

Re: [PATCH 09/17] powerpc/ftrace: Stop re-purposing linker generated long branches for ftrace

2023-06-22 Thread Christophe Leroy
sons to support ftrace on > kernels beyond 64MB, we can consider adding support by using > -fpatchable-function-entry. > > Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy > --- > arch/powerpc/kernel/trace/ftrace.c | 110 + > 1 file chan

Re: [PATCH 08/17] powerpc/ftrace: Refactor ftrace_modify_code()

2023-06-22 Thread Christophe Leroy
Le 19/06/2023 à 11:47, Naveen N Rao a écrit : > Split up ftrace_modify_code() into a few helpers for future use. Also > update error messages accordingly. > > Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy > --- > arch/powerpc/kernel/t

Re: [PATCH 07/17] powerpc/ftrace: Consolidate ftrace support into fewer files

2023-06-22 Thread Christophe Leroy
c is renamed to ftrace_64_pg.c > - ftrace_64_pg.S is rename to ftrace_64_pg_entry.S The stats from git do not match., it says {ftrace_low.S => ftrace_64_pg_entry.S > > Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy > --- > arch/powerpc/kernel/trace/Makefile

Re: [PATCH 06/17] powerpc/ftrace: Extend ftrace support for large kernels to ppc32

2023-06-22 Thread Christophe Leroy
is cast to 'long long' to prevent > errors on ppc32. > Reviewed-by: Christophe Leroy > Signed-off-by: Naveen N Rao > --- > arch/powerpc/include/asm/ftrace.h | 10 +-- > arch/powerpc/include/asm/sections.h| 2 ++ > arch/powerpc/kernel/trace/ftrace.c

Re: [PATCH 05/17] powerpc/ftrace: Use FTRACE_REGS_ADDR to identify the correct ftrace trampoline

2023-06-22 Thread Christophe Leroy
Le 19/06/2023 à 11:47, Naveen N Rao a écrit : > Instead of keying off DYNAMIC_FTRACE_WITH_REGS, use FTRACE_REGS_ADDR to > identify the proper ftrace trampoline address to use. > > Signed-off-by: Naveen N Rao Reviewed-by: Christophe Leroy > --- > arch/powerpc/kernel/

<    2   3   4   5   6   7   8   9   10   11   >