[PATCH v6 14/25] powerpc: Provide do_ppc64_personality helper

2022-09-21 Thread Rohan McLure
Avoid duplication in future patch that will define the ppc64_personality syscall handler in terms of the SYSCALL_DEFINE and COMPAT_SYSCALL_DEFINE macros, by extracting the common body of ppc64_personality into a helper function. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V3

[PATCH v6 13/25] powerpc: Remove direct call to mmap2 syscall handlers

2022-09-21 Thread Rohan McLure
' on static mmap helper. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V2: Move mmap2 compat implementation to asm/kernel/syscalls.c. V4: Move to be applied before syscall wrapper introduced. V5: Remove 'inline' in helper. --- arch/powerpc/kernel/sys_ppc32.c | 9 - arch/powerpc

[PATCH v6 12/25] powerpc: Remove direct call to personality syscall handler

2022-09-21 Thread Rohan McLure
inline helper in . Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V2: Use inline helper to deduplicate bodies in compat/regular implementations. V4: Move to be applied before syscall wrapper. --- arch/powerpc/kernel/syscalls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH v6 11/25] powerpc/32: Remove powerpc select specialisation

2022-09-21 Thread Rohan McLure
both implement this syscall with oldselect semantics. Remove the powerpc implementation, and update syscall.tbl to refer to emit a reference to sys_old_select and compat_sys_old_select for 32-bit binaries, in keeping with how other architectures support syscall #82. Signed-off-by: Rohan McLure

[PATCH v6 10/25] powerpc: Use generic fallocate compatibility syscall

2022-09-21 Thread Rohan McLure
ll replace more architecture-defined syscall handlers with generic implementations, dependent on introducing generic implementations that are compatible with powerpc and arm's parameter reorderings. Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure Reviewed-by: Arnd Bergmann --- V2: Remove arc

[PATCH v6 09/25] asm-generic: compat: Support BE for long long args in 32-bit ABIs

2022-09-21 Thread Rohan McLure
supporting big endianness may benefit from reciprocal argument translation, but are welcome also to implement their own. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin Reviewed-by: Arnd Bergmann --- V5: New patch. --- include/asm-generic/compat.h | 9 +++-- 1 file changed, 7 insert

[PATCH v6 08/25] powerpc: Fix fallocate and fadvise64_64 compat parameter combination

2022-09-21 Thread Rohan McLure
...@www.fastmail.com/ Fixes: 57f48b4b74e7 ("powerpc/compat_sys: swap hi/lo parts of 64-bit syscall args in LE mode") Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure Reviewed-by: Arnd Bergmann Reviewed-by: Nicholas Piggin --- V5: New patch. --- arch/powerpc/include/asm/sysca

[PATCH v6 07/25] powerpc/64s: Fix comment on interrupt handler prologue

2022-09-21 Thread Rohan McLure
where r11-r12 are saved to the PACA. Signed-off-by: Rohan McLure Reported-by: Nicholas Piggin Reviewed-by: Nicholas Piggin --- V2: Given its own commit V3: Annotate r11-r12 save locations with comment. --- arch/powerpc/kernel/exceptions-64s.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions

[PATCH v6 06/25] powerpc/64e: Clarify register saves and clears with {SAVE,ZEROIZE}_GPRS

2022-09-21 Thread Rohan McLure
of SAVE_GPRS targetting all non-volatile registers to SAVE_NVGPRS. Signed-off-by: Rohan Mclure Reported-by: Nicholas Piggin Reviewed-by: Nicholas Piggin --- V4: New commit. V6: Split REST_GPRS(0, 1, r1) to remove dependence on macro implementation ordering the r0 restore before r1 restore. --- arch

[PATCH v6 05/25] powerpc/32: Clarify interrupt restores with REST_GPR macro in entry_32.S

2022-09-21 Thread Rohan McLure
is not consumed earlier in the handler code. Signed-off-by: Rohan McLure Reported-by: Christophe Leroy Reviewed-by: Nicholas Piggin --- V3: New patch. V4: Minimise restores in the unrecoverable window between restoring SRR0/1 and return from interrupt. --- arch/powerpc/kernel/entry_32.S | 33

[PATCH v6 04/25] powerpc/64s: Use {ZEROIZE,SAVE,REST}_GPRS macros in sc, scv 0 handlers

2022-09-21 Thread Rohan McLure
handlers, user register state is sometimes juggled between registers. Hold-off from issuing the SAVE_GPR macro for applicable neighbouring lines to highlight the delicate register save logic. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V2: Update summary V3: Update summary regarding

[PATCH v6 03/25] powerpc: Add ZEROIZE_GPRS macros for register clears

2022-09-21 Thread Rohan McLure
restore and save macros, and usage of zeroize to describe this operation elsewhere in the kernel. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V2: Change 'ZERO' usage in naming to 'NULLIFY', a more obvious verb V3: Change 'NULLIFY' usage in naming to 'ZEROIZE', which has ent

[PATCH v6 02/25] powerpc: Save caller r3 prior to system_call_exception

2022-09-21 Thread Rohan McLure
3cc ("powerpc/syscall: implement system call entry/exit logic in C for PPC32") when 32-bit adopted system_call_exception. Revert its removal of orig_r3 saves. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V3: New commit. V5: New commit message, as we do more than just revert

[PATCH v6 01/25] powerpc: Remove asmlinkage from syscall handler definitions

2022-09-21 Thread Rohan McLure
ge provide far from complete support for C++ toolchains, and so the macro serves no purpose in powerpc. Remove all invocations of asmlinkage in arch/powerpc. These incidentally only occur in syscall definitions and prototypes. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin Reviewed-

[PATCH v6 00/25] powerpc: Syscall wrapper and register clearing

2022-09-21 Thread Rohan McLure
. - Remove extraneous clears of the high-order words of syscall parameters, which is now redundant thanks to use of COMPAT_SYSCALL_DEFINE everywhere. Rohan McLure (25): powerpc: Remove asmlinkage from syscall handler definitions powerpc: Save caller r3 prior to system_call_exception

Re: [PATCH 20/23] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-09-20 Thread Rohan McLure
> On 20 Sep 2022, at 2:54 pm, Rohan McLure wrote: > >> On 20 Sep 2022, at 12:03 pm, Nicholas Piggin wrote: >> >> On Fri Sep 16, 2022 at 3:32 PM AEST, Rohan McLure wrote: >>> Clear user state in gprs (assign to zero) to reduce the influence of user >>&

Re: [PATCH 19/23] powerpc: Provide syscall wrapper

2022-09-20 Thread Rohan McLure
> On 20 Sep 2022, at 11:59 am, Nicholas Piggin wrote: > > On Fri Sep 16, 2022 at 3:32 PM AEST, Rohan McLure wrote: >> Implement syscall wrapper as per s390, x86, arm64. When enabled >> cause handlers to accept parameters from a stack frame rather than >> from

Re: [PATCH 20/23] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-09-20 Thread Rohan McLure
> On 20 Sep 2022, at 12:03 pm, Nicholas Piggin wrote: > > On Fri Sep 16, 2022 at 3:32 PM AEST, Rohan McLure wrote: >> Clear user state in gprs (assign to zero) to reduce the influence of user >> registers on speculation within kernel syscall handlers. Clears occur >

Re: [PATCH 00/23] powerpc: Syscall wrapper and register clearing

2022-09-15 Thread Rohan McLure
> On 16 Sep 2022, at 3:32 pm, Rohan McLure wrote: > > V4 available here: > > Link: > https://lore.kernel.org/all/20220824020548.62625-1-rmcl...@linux.ibm.com/ > > Implement a syscall wrapper, causing arguments to handlers to be passed > via a struct pt_regs on the

Re: [PATCH 15/23] powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers

2022-09-15 Thread Rohan McLure
> On 16 Sep 2022, at 3:32 pm, Rohan McLure wrote: > > Arch-specific implementations of syscall handlers are currently used > over generic implementations for the following reasons: > > 1. Semantics unique to powerpc > 2. Compatibility syscalls require 'argument padding'

[PATCH 00/23] powerpc: Syscall wrapper and register clearing

2022-09-15 Thread Rohan McLure
hether non-syscall interrupts should clear registers is now configurable by INTERRUPT_SANITIZE_REGISTERS. Rohan McLure (23): powerpc: Remove asmlinkage from syscall handler definitions powerpc: Save caller r3 prior to system_call_exception powerpc: Add ZEROIZE_GPRS macros for register

[PATCH 12/23] powerpc: Remove direct call to personality syscall handler

2022-09-15 Thread Rohan McLure
inline helper in . Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V1 -> V2: Use inline helper to deduplicate bodies in compat/regular implementations. V3 -> V4: Move to be applied before syscall wrapper. --- arch/powerpc/kernel/syscalls.c | 2 +- 1 file changed, 1 insertion

[PATCH 20/23] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-09-15 Thread Rohan McLure
-by: Rohan McLure --- V1 -> V2: Update summary V2 -> V3: Remove erroneous summary paragraph on syscall_exit_prepare V3 -> V4: Use ZEROIZE instead of NULLIFY. Clear r0 also. V4 -> V5: Move to end of patch series. --- arch/powerpc/kernel/interrupt_64.S | 9 ++--- 1 file changed, 6 inse

[PATCH 11/23] powerpc/32: Remove powerpc select specialisation

2022-09-15 Thread Rohan McLure
both implement this syscall with oldselect semantics. Remove the powerpc implementation, and update syscall.tbl to refer to emit a reference to sys_old_select and compat_sys_old_select for 32-bit binaries, in keeping with how other architectures support syscall #82. Signed-off-by: Rohan McLure

[PATCH 07/23] powerpc/64s: Fix comment on interrupt handler prologue

2022-09-15 Thread Rohan McLure
where r11-r12 are saved to the PACA. Signed-off-by: Rohan McLure Reported-by: Nicholas Piggin --- V1 -> V2: Given its own commit V2 -> V3: Annotate r11-r12 save locations with comment. --- arch/powerpc/kernel/exceptions-64s.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH 15/23] powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers

2022-09-15 Thread Rohan McLure
, through the __ARCH_WANT_COMPAT_SYS_... convention. Signed-off-by: Rohan McLure --- V1 -> V2: All syscall handlers wrapped by this macro. V2 -> V3: Move creation of do_ppc64_personality helper to prior patch. V3 -> V4: Fix parenthesis alignment. Don't emit sys_*** symbols. V4 -> V5

[PATCH 08/23] powerpc: Fix fallocate and fadvise64_64 compat parameter combination

2022-09-15 Thread Rohan McLure
...@www.fastmail.com/ Fixes: 57f48b4b74e7 ("powerpc/compat_sys: swap hi/lo parts of 64-bit syscall args in LE mode") Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure --- V4 -> V5: New patch. --- arch/powerpc/include/asm/syscalls.h | 12 arch/powerpc/kernel/sys_ppc

[PATCH 17/23] powerpc: Enable compile-time check for syscall handlers

2022-09-15 Thread Rohan McLure
/syscalls.h headers for prototypes. Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure Reported-by: Nicholas Piggin --- V1 -> V2: New patch. V4 -> V5: For this patch only, represent handler function pointers as unsigned long. Remove reference to syscall wrappers. Use asm/syscalls.h

[PATCH 10/23] powerpc: Use generic fallocate compatibility syscall

2022-09-15 Thread Rohan McLure
ll replace more architecture-defined syscall handlers with generic implementations, dependent on introducing generic implementations that are compatible with powerpc and arm's parameter reorderings. Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure --- V1 -> V2: Remove arch-specific fallocat

[PATCH 22/23] powerpc/64s: Clear gprs on interrupt routine entry in Book3S

2022-09-15 Thread Rohan McLure
interrupt handlers. This mitigation is disabled by default, but enabled with CONFIG_INTERRUPT_SANITIZE_REGISTERS. Signed-off-by: Rohan McLure --- V1 -> V2: Add benchmark data V2 -> V3: Use ZEROIZE_GPR{,S} macro renames, clarify interrupt_exit_user_prepare changes in summary. V4 -> V5: Configu

[PATCH 21/23] powerpc/64: Add INTERRUPT_SANITIZE_REGISTERS Kconfig

2022-09-15 Thread Rohan McLure
state, meaning that the mitigation when implemented will have minimal overhead. Signed-off-by: Rohan McLure --- V4 -> V5: New patch --- arch/powerpc/Kconfig | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index ef6c83e79c9b..a643ebd83

[PATCH 05/23] powerpc/32: Clarify interrupt restores with REST_GPR macro in entry_32.S

2022-09-15 Thread Rohan McLure
is not consumed earlier in the handler code. Signed-off-by: Rohan McLure Reported-by: Christophe Leroy --- V2 -> V3: New patch. V3 -> V4: Minimise restores in the unrecoverable window between restoring SRR0/1 and return from interrupt. --- arch/powerpc/kernel/entry_32.

[PATCH 02/23] powerpc: Save caller r3 prior to system_call_exception

2022-09-15 Thread Rohan McLure
3cc ("powerpc/syscall: implement system call entry/exit logic in C for PPC32") when 32-bit adopted system_call_exception. Revert its removal of orig_r3 saves. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V2 -> V3: New commit. V4 -> V5: New commit message, a

[PATCH 04/23] powerpc/64s: Use {ZEROIZE,SAVE,REST}_GPRS macros in sc, scv 0 handlers

2022-09-15 Thread Rohan McLure
handlers, user register state is sometimes juggled between registers. Hold-off from issuing the SAVE_GPR macro for applicable neighbouring lines to highlight the delicate register save logic. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V1 -> V2: Update summary V2 -> V3: Update s

[PATCH 18/23] powerpc: Use common syscall handler type

2022-09-15 Thread Rohan McLure
. Fixup comparisons in VDSO to avoid pointer-integer comparison. Introduce explicit cast on systems with SPUs. Signed-off-by: Rohan McLure --- V1 -> V2: New patch. V2 -> V3: Remove unnecessary cast from const syscall_fn to syscall_fn V4 -> V5: Update patch description. --- arch/powerpc/in

[PATCH 19/23] powerpc: Provide syscall wrapper

2022-09-15 Thread Rohan McLure
xed in a successive patch, but requires spu_sys_callback to allocate a pt_regs structure to satisfy the wrapped calling convention. Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan Signed-off-by: Rohan McLure --- V1 -> V2: Generate prototypes for symbols produced by the wrapper. V2

[PATCH 09/23] asm-generic: compat: Support BE for long long args in 32-bit ABIs

2022-09-15 Thread Rohan McLure
supporting big endianness may benefit from reciprocal argument translation, but are welcome also to implement their own. Signed-off-by: Rohan McLure --- V4 -> V5: New patch. --- include/asm-generic/compat.h | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includ

[PATCH 14/23] powerpc: Provide do_ppc64_personality helper

2022-09-15 Thread Rohan McLure
Avoid duplication in future patch that will define the ppc64_personality syscall handler in terms of the SYSCALL_DEFINE and COMPAT_SYSCALL_DEFINE macros, by extracting the common body of ppc64_personality into a helper function. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V2

[PATCH 06/23] powerpc/64e: Clarify register saves and clears with {SAVE,ZEROIZE}_GPRS

2022-09-15 Thread Rohan McLure
of SAVE_GPRS targetting all non-volatile registers to SAVE_NVGPRS. Signed-off-by: Rohan Mclure Reported-by: Nicholas Piggin --- V3 -> V4: New commit. --- arch/powerpc/kernel/exceptions-64e.S | 27 +++--- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/arch/powe

[PATCH 13/23] powerpc: Remove direct call to mmap2 syscall handlers

2022-09-15 Thread Rohan McLure
' on static mmap helper. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V1 -> V2: Move mmap2 compat implementation to asm/kernel/syscalls.c. V3 -> V4: Move to be applied before syscall wrapper introduced. V4 -> V5: Remove 'inline' in helper. --- arch/powerpc/kernel/sys_ppc

[PATCH 01/23] powerpc: Remove asmlinkage from syscall handler definitions

2022-09-15 Thread Rohan McLure
ge provide far from complete support for C++ toolchains, and so the macro serves no purpose in powerpc. Remove all invocations of asmlinkage in arch/powerpc. These incidentally only occur in syscall definitions and prototypes. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin Reviewed-

[PATCH 03/23] powerpc: Add ZEROIZE_GPRS macros for register clears

2022-09-15 Thread Rohan McLure
restore and save macros, and usage of zeroize to describe this operation elsewhere in the kernel. Signed-off-by: Rohan McLure Reviewed-by: Nicholas Piggin --- V1 -> V2: Change 'ZERO' usage in naming to 'NULLIFY', a more obvious verb V2 -> V3: Change 'NULLIFY' usage in naming to 'ZEROIZE',

[PATCH 16/23] powerpc: Include all arch-specific syscall prototypes

2022-09-15 Thread Rohan McLure
handlers are expressed in terms of types in ppc32.h. Expose this header globally. Signed-off-by: Rohan McLure --- V1 -> V2: Explicitly include prototypes. V2 -> V3: Remove extraneous #include and ppc_fallocate prototype. Rename header. V4 -> V5: Clean. Elaborate comment on long long mungin

[PATCH 23/23] powerpc/64e: Clear gprs on interrupt routine entry on Book3E

2022-09-15 Thread Rohan McLure
safely, without loss of register state prior to the interrupt, as the common prologue saves the initial values of non-volatiles, which are unconditionally restored in interrupt_64.S. Mitigation defaults to enabled by INTERRUPT_SANITIZE_REGISTERS. Signed-off-by: Rohan McLure --- V3 -> V4: New pa

Re: [PATCH v4 19/20] powerpc/64s: Clear gprs on interrupt routine entry in Book3S

2022-09-15 Thread Rohan McLure
> On 12 Sep 2022, at 10:15 pm, Nicholas Piggin wrote: > > On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote: >> Zero GPRS r0, r2-r11, r14-r31, on entry into the kernel for all >> other interrupt sources to limit influence of user-space values >> in po

Re: [PATCH v4 11/20] powerpc: Add ZEROIZE_GPRS macros for register clears

2022-09-14 Thread Rohan McLure
> On 12 Sep 2022, at 9:09 pm, Nicholas Piggin wrote: > > On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote: >> Macros for restoring and saving registers to and from the stack exist. >> Provide macros with the same interface for clearing a range of gprs by >&

Re: [PATCH v4 10/20] powerpc: Use common syscall handler type

2022-09-14 Thread Rohan McLure
> On 12 Sep 2022, at 8:56 pm, Nicholas Piggin wrote: > > On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote: >> Cause syscall handlers to be typed as follows when called indirectly >> throughout the kernel. >> >> typedef long (*syscall_fn)(unsigned l

Re: [PATCH v4 06/20] powerpc: Remove direct call to mmap2 syscall handlers

2022-09-14 Thread Rohan McLure
> On 12 Sep 2022, at 7:47 pm, Nicholas Piggin wrote: > > On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote: >> Syscall handlers should not be invoked internally by their symbol names, >> as these symbols defined by the architecture-defined SYSCALL_

Re: [PATCH v4 03/20] powerpc/32: Remove powerpc select specialisation

2022-09-14 Thread Rohan McLure
> On 12 Sep 2022, at 7:03 pm, Nicholas Piggin wrote: > > On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote: >> Syscall #82 has been implemented for 32-bit platforms in a unique way on >> powerpc systems. This hack will in effect guess whether the caller is &g

Re: [PATCH v4 08/20] powerpc: Include all arch-specific syscall prototypes

2022-09-13 Thread Rohan McLure
> On 12 Sep 2022, at 8:33 pm, Nicholas Piggin wrote: > > On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote: >> Forward declare all syscall handler prototypes where a generic prototype >> is not provided in either linux/syscalls.h or linux/compat.h in >> asm/s

Re: [PATCH 3/3] powerpc: mm: support page table check

2022-09-12 Thread Rohan McLure
> On 12 Sep 2022, at 4:11 pm, Christophe Leroy > wrote: > > > > Le 12/09/2022 à 03:47, Rohan McLure a écrit : >> On creation and clearing of a page table mapping, instrument such calls >> by invoking page_table_check_pte_set and page_table_check_pte_clear >

Re: [PATCH 2/3] powerpc: mm: add p{te,md,ud}_user_accessible_page helpers

2022-09-12 Thread Rohan McLure
>> +static inline bool pmd_user_accessible_page(pmd_t pmd) >> +{ >> +return pmd_is_leaf(pmd) && pmd_present(pmd) >> +&& pte_user(pmd_pte(pmd)); > > The && goes on previous line. > By the way, there is a great tool that can help you : > > $

Re: [PATCH 1/3] powerpc: mm: move pud_pfn stub to common pgtable header

2022-09-11 Thread Rohan McLure
This patch and its successor would be avoidable if architectures could specify that they wish to use page_table_check_p{ud,md}_{clear,set}. > On 12 Sep 2022, at 11:47 am, Rohan McLure wrote: > > The pud_pfn inline call is only referenced on 64-bit Book3S systems, > but its invocatio

[PATCH 3/3] powerpc: mm: support page table check

2022-09-11 Thread Rohan McLure
rm64/mm: enable ARCH_SUPPORTS_PAGE_TABLE_CHECK") x86_64 in commit d283d422c6c4 ("x86: mm: add x86_64 support for page table check") Signed-off-by: Rohan McLure --- arch/powerpc/Kconfig | 1 + arch/powerpc/include/asm/book3s/32/pgtable.h | 7 ++- arch

[PATCH 2/3] powerpc: mm: add p{te,md,ud}_user_accessible_page helpers

2022-09-11 Thread Rohan McLure
prior to this commit. On 32-bit systems, provide stub implementations for these methods, with BUG(), as debug features such as page table checks will emit functions that call p{md,ud}_user_accessible_page but must not be used. Signed-off-by: Rohan McLure --- arch/powerpc/include/asm/pgtable.h | 35

[PATCH 1/3] powerpc: mm: move pud_pfn stub to common pgtable header

2022-09-11 Thread Rohan McLure
on it at least being defined. Signed-off-by: Rohan McLure --- arch/powerpc/include/asm/book3s/64/pgtable.h | 10 -- arch/powerpc/include/asm/pgtable.h | 12 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch

Re: [PATCH v4 00/20] powerpc: Syscall wrapper and register clearing

2022-09-11 Thread Rohan McLure
Any comments for this revision? Hopefully these revisions address 32-bit and embedded systems appropriately. Thanks, Rohan > On 24 Aug 2022, at 12:05 pm, Rohan McLure wrote: > > V3 available here: > > Link: > https://lore.kernel.org/all/4c3a8815-67ff-41eb-a703-981920ca1.

[PATCH v4 19/20] powerpc/64s: Clear gprs on interrupt routine entry in Book3S

2022-08-23 Thread Rohan McLure
interrupt handlers. Signed-off-by: Rohan McLure --- V1 -> V2: Add benchmark data V2 -> V3: Use ZEROIZE_GPR{,S} macro renames, clarify interrupt_exit_user_prepare changes in summary. --- arch/powerpc/kernel/exceptions-64s.S | 21 - arch/powerpc/kernel/interrupt_64.S

[PATCH v4 20/20] powerpc/64e: Clear gprs on interrupt routine entry

2022-08-23 Thread Rohan McLure
safely, without loss of register state prior to the interrupt, as the common prologue saves the initial values of non-volatiles, which are unconditionally restored in interrupt_64.S. Signed-off-by: Rohan McLure --- V3 -> V4: New patch. --- arch/powerpc/kernel/exceptions-64e.S | 4 +++- 1 f

[PATCH v4 14/20] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-08-23 Thread Rohan McLure
-by: Rohan McLure --- V1 -> V2: Update summary V2 -> V3: Remove erroneous summary paragraph on syscall_exit_prepare V3 -> V4: Use ZEROIZE instead of NULLIFY --- arch/powerpc/kernel/interrupt_64.S | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/power

[PATCH v4 18/20] powerpc/64s: Fix comment on interrupt handler prologue

2022-08-23 Thread Rohan McLure
where r11-r12 are saved to the PACA. Signed-off-by: Rohan McLure --- V1 -> V2: Given its own commit V2 -> V3: Annotate r11-r12 save locations with comment. --- arch/powerpc/kernel/exceptions-64s.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/exce

[PATCH v4 16/20] powerpc/32: Clarify interrupt restores with REST_GPR macro in entry_32.S

2022-08-23 Thread Rohan McLure
is not consumed earlier in the handler code. Signed-off-by: Rohan McLure Reported-by: Christophe Leroy --- V2 -> V3: New patch. V3 -> V4: Minimise restores in the unrecoverable window between restoring SRR0/1 and return from interrupt. --- arch/powerpc/kernel/entry_32.

[PATCH v4 17/20] powerpc/64e: Clarify register saves and clears with {SAVE,ZEROIZE}_GPRS

2022-08-23 Thread Rohan McLure
of SAVE_GPRS targetting all non-volatile registers to SAVE_NVGPRS. Signed-off-by: Rohan Mclure --- V3 -> V4: New commit. --- arch/powerpc/kernel/exceptions-64e.S | 27 +++--- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64e.S

[PATCH v4 15/20] powerpc/64s: Use {ZEROIZE,SAVE,REST}_GPRS macros in sc, scv 0 handlers

2022-08-23 Thread Rohan McLure
handlers, user register state is sometimes juggled between registers. Hold-off from issuing the SAVE_GPR macro for applicable neighbouring lines to highlight the delicate register save logic. Signed-off-by: Rohan McLure --- V1 -> V2: Update summary V2 -> V3: Update summary regarding excl

[PATCH v4 13/20] powerpc: Provide syscall wrapper

2022-08-23 Thread Rohan McLure
xed in a successive patch, but requires spu_sys_callback to allocate a pt_regs structure to satisfy the wrapped calling convention. Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan Signed-off-by: Rohan McLure --- V1 -> V2: Generate prototypes for symbols produced by the wrapper. V2

[PATCH v4 12/20] Revert "powerpc/syscall: Save r3 in regs->orig_r3"

2022-08-23 Thread Rohan McLure
ement system call entry/exit logic in C for PPC32") when 32-bit adopted system_call_exception. Revert its removal of orig_r3 saves. Signed-off-by: Rohan McLure --- V2 -> V3: New commit. --- arch/powerpc/kernel/entry_32.S | 1 + arch/powerpc/kernel/interrupt_64.S | 2 ++ arch/powerpc/ker

[PATCH v4 11/20] powerpc: Add ZEROIZE_GPRS macros for register clears

2022-08-23 Thread Rohan McLure
of the accompanying restore and save macros, and usage of zeroize to describe this operation elsewhere in the kernel. Signed-off-by: Rohan McLure --- V1 -> V2: Change 'ZERO' usage in naming to 'NULLIFY', a more obvious verb V2 -> V3: Change 'NULLIFY' usage in naming to 'ZEROIZE', which has precedent in

[PATCH v4 09/20] powerpc: Enable compile-time check for syscall handlers

2022-08-23 Thread Rohan McLure
/syscalls.h headers for prototypes. Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure --- V1 -> V2: New patch. --- arch/powerpc/kernel/{systbl.S => systbl.c} | 27 ++-- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/kernel/systbl.S b/arch/p

[PATCH v4 10/20] powerpc: Use common syscall handler type

2022-08-23 Thread Rohan McLure
six machine-word length parameters to a function to be passed by registers, even handlers which admit fewer than six parameters may be viewed as having the above type. Fixup comparisons in VDSO to avoid pointer-integer comparison. Introduce explicit cast on systems with SPUs. Signed-off-by: Rohan

[PATCH v4 00/20] powerpc: Syscall wrapper and register clearing

2022-08-23 Thread Rohan McLure
of these systems feature hardware speculation, and we already unconditionally restore NVGPRS. Rohan McLure (20): powerpc: Remove asmlinkage from syscall handler definitions powerpc: Use generic fallocate compatibility syscall powerpc/32: Remove powerpc select specialisation powerpc

[PATCH v4 08/20] powerpc: Include all arch-specific syscall prototypes

2022-08-23 Thread Rohan McLure
handlers are expressed in terms of types in ppc32.h. Expose this header globally. Signed-off-by: Rohan McLure --- V1 -> V2: Explicitly include prototypes. V2 -> V3: Remove extraneous #include and ppc_fallocate prototype. Rename header. --- arch/powerpc/include/asm/syscalls.h

[PATCH v4 07/20] powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers

2022-08-23 Thread Rohan McLure
the __ARCH_WANT_COMPAT_SYS_... convention. Signed-off-by: Rohan McLure --- V1 -> V2: All syscall handlers wrapped by this macro. V2 -> V3: Move creation of do_ppc64_personality helper to prior patch. V3 -> V4: Fix parenthesis alignment. Don't emit sys_*** symbols. --- arch/powerpc/in

[PATCH v4 06/20] powerpc: Remove direct call to mmap2 syscall handlers

2022-08-23 Thread Rohan McLure
with the personality handlers. Signed-off-by: Rohan McLure --- V1 -> V2: Move mmap2 compat implementation to asm/kernel/syscalls.c. V3 -> V4: Move to be applied before syscall wrapper introduced. --- arch/powerpc/kernel/sys_ppc32.c | 9 - arch/powerpc/kernel/syscalls.c | 11

[PATCH v4 05/20] powerpc: Remove direct call to personality syscall handler

2022-08-23 Thread Rohan McLure
inline helper in . Signed-off-by: Rohan McLure --- V1 -> V2: Use inline helper to deduplicate bodies in compat/regular implementations. V3 -> V4: Move to be applied before syscall wrapper. --- arch/powerpc/kernel/syscalls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH v4 03/20] powerpc/32: Remove powerpc select specialisation

2022-08-23 Thread Rohan McLure
both implement this syscall with oldselect semantics. Remove the powerpc implementation, and update syscall.tbl to refer to emit a reference to sys_old_select for 32-bit binaries, in keeping with how other architectures support syscall #82. Signed-off-by: Rohan McLure --- V1 -> V2: Remove a

[PATCH v4 04/20] powerpc: Provide do_ppc64_personality helper

2022-08-23 Thread Rohan McLure
Avoid duplication in future patch that will define the ppc64_personality syscall handler in terms of the SYSCALL_DEFINE and COMPAT_SYSCALL_DEFINE macros, by extracting the common body of ppc64_personality into a helper function. Signed-off-by: Rohan McLure --- V2 -> V3: New commit. --- a

[PATCH v4 01/20] powerpc: Remove asmlinkage from syscall handler definitions

2022-08-23 Thread Rohan McLure
ge provide far from complete support for C++ toolchains, and so the macro serves no purpose in powerpc. Remove all invocations of asmlinkage in arch/powerpc. These incidentally only occur in syscall definitions and prototypes. Signed-off-by: Rohan McLure --- V2 -> V3: new patch --- arch/powerp

[PATCH v4 02/20] powerpc: Use generic fallocate compatibility syscall

2022-08-23 Thread Rohan McLure
ll replace more architecture-defined syscall handlers with generic implementations, dependent on introducing generic implementations that are compatible with powerpc and arm's parameter reorderings. Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure --- V1 -> V2: Remove arch-specific fallocat

Re: [PATCH v3 18/18] powerpc/64s: Clear gprs on interrupt routine entry

2022-08-23 Thread Rohan McLure
> What about arch/powerpc/kernel/exceptions-64e.S, no change required > inside it ? As interru_64.S applies to both 64s and 64e, I would have > expected changes in exceptions_64e too. As it stands the changes in interrupt_64.S cause non-volatiles to be unconditionally restored. This may lead to

Re: [PATCH v3 14/18] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-08-21 Thread Rohan McLure
> On 19 Aug 2022, at 4:52 pm, Christophe Leroy > wrote: > > > > Le 19/08/2022 à 05:38, Rohan McLure a écrit : >> Clear user state in gprs (assign to zero) to reduce the influence of user >> registers on speculation within kernel syscall handlers. Clears

[PATCH v3 11/18] powerpc: Add ZEROIZE_GPRS macros for register clears

2022-08-18 Thread Rohan McLure
of the accompanying restore and save macros, and usage of nullify to describe this operation elsewhere in the kernel. Signed-off-by: Rohan McLure --- V1 -> V2: Change 'ZERO' usage in naming to 'NULLIFY', a more obvious verb V2 -> V3: Change 'NULLIFY' usage in naming to 'ZEROIZE', which has precedent in

[PATCH v3 16/18] powerpc/32: Clarify interrupt restores with REST_GPR macro in entry_32.S

2022-08-18 Thread Rohan McLure
is not consumed earlier in the handler code. Signed-off-by: Rohan McLure Reported-by: Christophe Leroy --- V2 -> V3: New patch. --- arch/powerpc/kernel/entry_32.S | 35 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/kernel/entry_32.

[PATCH v3 07/18] powerpc: Remove direct call to mmap2 syscall handlers

2022-08-18 Thread Rohan McLure
with the personality handlers. Signed-off-by: Rohan McLure --- V1 -> V2: Move mmap2 compat implementation to asm/kernel/syscalls.c. --- arch/powerpc/kernel/sys_ppc32.c | 10 -- arch/powerpc/kernel/syscalls.c | 11 +++ 2 files changed, 11 insertions(+), 10 deletions(-) diff --

[PATCH v3 02/18] powerpc: Use generic fallocate compatibility syscall

2022-08-18 Thread Rohan McLure
ll replace more architecture-defined syscall handlers with generic implementations, dependent on introducing generic implementations that are compatible with powerpc and arm's parameter reorderings. Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure --- V1 -> V2: Remove arch-specific fallocat

[PATCH v3 09/18] powerpc: Enable compile-time check for syscall handlers

2022-08-18 Thread Rohan McLure
/syscalls.h headers for prototypes. Reported-by: Arnd Bergmann Signed-off-by: Rohan McLure --- V1 -> V2: New patch. --- arch/powerpc/kernel/{systbl.S => systbl.c} | 27 ++-- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/arch/powerpc/kernel/systbl.S b/arch/p

[PATCH v3 17/18] powerpc/64s: Fix comment on interrupt handler prologue

2022-08-18 Thread Rohan McLure
where r11-r12 are saved to the PACA. Signed-off-by: Rohan McLure --- V1 -> V2: Given its own commit V2 -> V3: Annotate r11-r12 save locations with comment. --- arch/powerpc/kernel/exceptions-64s.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/exce

[PATCH v3 18/18] powerpc/64s: Clear gprs on interrupt routine entry

2022-08-18 Thread Rohan McLure
interrupt handlers. Signed-off-by: Rohan McLure --- V1 -> V2: Add benchmark data V2 -> V3: Use ZEROIZE_GPR{,S} macro renames, clarify interrupt_exit_user_prepare changes in summary. --- arch/powerpc/kernel/exceptions-64s.S | 21 - arch/powerpc/kernel/interrupt_64.S

[PATCH v3 05/18] powerpc: Adopt SYSCALL_DEFINE for arch-specific syscall handlers

2022-08-18 Thread Rohan McLure
the __ARCH_WANT_COMPAT_SYS_... convention. Signed-off-by: Rohan McLure --- V1 -> V2: All syscall handlers wrapped by this macro. V2 -> V3: Move creation of do_ppc64_personality helper to prior patch. --- arch/powerpc/include/asm/syscalls.h | 18 +++--- arch/powerpc/kernel/sys_p

[PATCH v3 14/18] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-08-18 Thread Rohan McLure
-by: Rohan McLure --- V1 -> V2: Update summary V2 -> V3: Remove erroneous summary paragraph on syscall_exit_prepare --- arch/powerpc/kernel/interrupt_64.S | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/interrupt_64.S b/arch/powerpc/

[PATCH v3 15/18] powerpc/64s: Use {ZEROIZE,SAVE,REST}_GPRS macros in sc, scv 0 handlers

2022-08-18 Thread Rohan McLure
handlers, user register state is sometimes juggled between registers. Hold-off from issuing the SAVE_GPR macro for applicable neighbouring lines to highlight the delicate register save logic. Signed-off-by: Rohan McLure --- V1 -> V2: Update summary V2 -> V3: Update summary regarding excl

[PATCH v3 13/18] powerpc: Provide syscall wrapper

2022-08-18 Thread Rohan McLure
xed in a successive patch, but requires spu_sys_callback to allocate a pt_regs structure to satisfy the wrapped calling convention. Co-developed-by: Andrew Donnellan Signed-off-by: Andrew Donnellan Signed-off-by: Rohan McLure --- V1 -> V2: Generate prototypes for symbols produced by the wrapper. V2

[PATCH v3 10/18] powerpc: Use common syscall handler type

2022-08-18 Thread Rohan McLure
six machine-word length parameters to a function to be passed by registers, even handlers which admit fewer than six parameters may be viewed as having the above type. Fixup comparisons in VDSO to avoid pointer-integer comparison. Introduce explicit cast on systems with SPUs. Signed-off-by: Rohan

[PATCH v3 03/18] powerpc/32: Remove powerpc select specialisation

2022-08-18 Thread Rohan McLure
both implement this syscall with oldselect semantics. Remove the powerpc implementation, and update syscall.tbl to refer to emit a reference to sys_old_select for 32-bit binaries, in keeping with how other architectures support syscall #82. Signed-off-by: Rohan McLure --- V1 -> V2: Remove a

[PATCH v3 08/18] powerpc: Include all arch-specific syscall prototypes

2022-08-18 Thread Rohan McLure
handlers are expressed in terms of types in ppc32.h. Expose this header globally. Signed-off-by: Rohan McLure --- V1 -> V2: Explicitly include prototypes. V2 -> V3: Remove extraneous #include and ppc_fallocate prototype. Rename header. --- arch/powerpc/include/asm/syscalls.h

[PATCH v3 00/18] powerpc: Syscall wrapper and register clearing

2022-08-18 Thread Rohan McLure
with new macros - Acknowledge system_call_exception move to syscall.c - Save caller r3 for system calls in interrupt handlers rather than in system_call_exception - Remove asmlinkage from arch/powerpc - Rearrange patches, realign changes to their relevant patches Rohan McLure (18): powerpc

[PATCH v3 04/18] powerpc: Provide do_ppc64_personality helper

2022-08-18 Thread Rohan McLure
Avoid duplication in future patch that will define the ppc64_personality syscall handler in terms of the SYSCALL_DEFINE and COMPAT_SYSCALL_DEFINE macros, by extracting the common body of ppc64_personality into a helper function. Signed-off-by: Rohan McLure --- V2 -> V3: New commit. --- a

[PATCH v3 01/18] powerpc: Remove asmlinkage from syscall handler definitions

2022-08-18 Thread Rohan McLure
ge provide far from complete support for C++ toolchains, and so the macro serves no purpose in powerpc. Remove all invocations of asmlinkage in arch/powerpc. These incidentally only occur in syscall defintions and prototypes. Signed-off-by: Rohan McLure --- V2 -> V3: new patch --- arch/powerp

[PATCH v3 12/18] Revert "powerpc/syscall: Save r3 in regs->orig_r3"

2022-08-18 Thread Rohan McLure
ystem call entry/exit logic in C for PPC32") when 32-bit adopted system_call_exception. Revert its removal of orig_r3 saves. Signed-off-by: Rohan McLure --- V2 -> V3: New commit. --- arch/powerpc/kernel/entry_32.S | 1 + arch/powerpc/kernel/interrupt_64.S | 2 ++ arch/powerpc/kernel/sysca

[PATCH v3 06/18] powerpc: Remove direct call to personality syscall handler

2022-08-18 Thread Rohan McLure
inline helper in . Signed-off-by: Rohan McLure --- V1 -> V2: Use inline helper to deduplicate bodies in compat/regular implementations. --- arch/powerpc/kernel/syscalls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscall

Re: [PATCH v2 11/14] powerpc/64s: Clear/restore caller gprs in syscall interrupt/return

2022-08-14 Thread Rohan McLure
> On 11 Aug 2022, at 8:11 pm, Andrew Donnellan wrote: > > On Mon, 2022-07-25 at 16:31 +1000, Rohan McLure wrote: >> Clear user state in gprs (assign to zero) to reduce the influence of >> user >> registers on speculation within kernel syscall handlers. Clears occ

<    1   2   3   4   >