Re: [PATCH v3 1/3] riscv: mm: Use hint address in mmap if available

2024-08-22 Thread Yangyu Chen
> On Aug 23, 2024, at 13:57, Charlie Jenkins wrote: > > On Fri, Aug 23, 2024 at 01:28:18PM +0800, Yangyu Chen wrote: >> >> >>> On Aug 23, 2024, at 12:39, Charlie Jenkins wrote: >>> >>> On Thu, Aug 22, 2024 at 10:51:54AM +0800, Yangyu Chen wrote: > On Aug 22, 2024, at 06:17,

Re: [PATCH v3 1/3] riscv: mm: Use hint address in mmap if available

2024-08-22 Thread Charlie Jenkins
On Fri, Aug 23, 2024 at 01:28:18PM +0800, Yangyu Chen wrote: > > > > On Aug 23, 2024, at 12:39, Charlie Jenkins wrote: > > > > On Thu, Aug 22, 2024 at 10:51:54AM +0800, Yangyu Chen wrote: > >> > >> > >>> On Aug 22, 2024, at 06:17, Palmer Dabbelt wrote: > >>> > >>> On Mon, 19 Aug 2024 18:58:

[PATCH 1/1 V2] Selftests: net: Improve missing modules error message

2024-08-22 Thread David Hunter
The error message descirbing the required modules is inaccurate. Currently, only "SKIP: Need act_mirred module" is printed when any of the modules are missing. As a result, users might only include that module; however, three modules are required. Fix the error message to show any/all modules nee

Re: [PATCH v3 1/3] riscv: mm: Use hint address in mmap if available

2024-08-22 Thread Yangyu Chen
> On Aug 23, 2024, at 12:39, Charlie Jenkins wrote: > > On Thu, Aug 22, 2024 at 10:51:54AM +0800, Yangyu Chen wrote: >> >> >>> On Aug 22, 2024, at 06:17, Palmer Dabbelt wrote: >>> >>> On Mon, 19 Aug 2024 18:58:18 PDT (-0700), rsworkt...@outlook.com wrote: On 2024-08-20 01:00, Charlie

Re: [PATCH v3 1/3] riscv: mm: Use hint address in mmap if available

2024-08-22 Thread Charlie Jenkins
On Thu, Aug 22, 2024 at 10:51:54AM +0800, Yangyu Chen wrote: > > > > On Aug 22, 2024, at 06:17, Palmer Dabbelt wrote: > > > > On Mon, 19 Aug 2024 18:58:18 PDT (-0700), rsworkt...@outlook.com wrote: > >> On 2024-08-20 01:00, Charlie Jenkins wrote: > >>> On Mon, Aug 19, 2024 at 01:55:57PM +0800,

Re: [PATCH v2] selftests: fix relative rpath usage

2024-08-22 Thread kernel test robot
Hi Eugene, kernel test robot noticed the following build warnings: [auto build test WARNING on shuah-kselftest/next] [also build test WARNING on shuah-kselftest/fixes tiwai-sound/for-next tiwai-sound/for-linus bpf-next/master bpf/master linus/master v6.11-rc3 next-20240816] [If your patch is ap

Re: [PATCH v3] Documentation: KUnit: Update filename best practices

2024-08-22 Thread Kees Cook
On Fri, Jul 26, 2024 at 03:14:36PM +0800, David Gow wrote: > On Thu, 25 Jul 2024 at 04:14, Kees Cook wrote: > > > > Based on feedback from Linus[1] and follow-up discussions, change the > > suggested file naming for KUnit tests. > > > > Link: > > https://lore.kernel.org/lkml/CAHk-=wgim6pNiGTBMhP8

Re: [PATCH v9 net-next 0/3] Enhance network interface feature testing

2024-08-22 Thread patchwork-bot+netdevbpf
Hello: This series was applied to netdev/net-next.git (main) by Jakub Kicinski : On Wed, 21 Aug 2024 22:49:00 +0530 you wrote: > This small series includes fixes for creation of veth pairs for > networkless kernels & adds tests for turning the different network > interface features on and off in

Re: [PATCH bpf-next v2 1/8] libbpf: Improve log message formatting

2024-08-22 Thread Andrii Nakryiko
On Thu, Aug 22, 2024 at 2:24 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Fix missing newlines and extraneous terminal spaces in messages. > > Signed-off-by: Tony Ambardar > --- > tools/lib/bpf/btf.c | 7 --- > tools/lib/bpf/btf_dump.c | 2 +- > tools/lib/bpf/btf_relocat

Re: [PATCH bpf-next v2 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-08-22 Thread Andrii Nakryiko
I ran out of time looking through this, I'll try to get back to this patch set later today or tomorrow. So please don't repost, but see my comments below. On Thu, Aug 22, 2024 at 2:25 AM Tony Ambardar wrote: > > From: Tony Ambardar > > Support for handling BTF data of either endianness was added

Re: [PATCH 4/4] kunit: Add example with alternate function redirection method

2024-08-22 Thread Rae Moar
On Wed, Aug 21, 2024 at 6:00 PM Michal Wajdeczko wrote: > > > > On 21.08.2024 23:22, Rae Moar wrote: > > On Wed, Aug 21, 2024 at 10:43 AM Michal Wajdeczko > > wrote: > >> > >> Add example how to use KUNIT_FIXED_STUB_REDIRECT and compare its > >> usage with the KUNIT_STATIC_STUB_REDIRECT. Also sho

Re: [PATCH] tools: Copy linux/align.h into tools/

2024-08-22 Thread Ackerley Tng
Sean Christopherson writes: > On Mon, Feb 27, 2023, Ackerley Tng wrote: >> This provides alignment macros for use in selftests. >> >> Also clean up tools/include/linux/bitmap.h's inline definition of >> IS_ALIGNED(). >> >> Signed-off-by: Ackerley Tng >> --- > > FYI, an almost-equivalent change

Re: [PATCH] tools: Copy linux/align.h into tools/

2024-08-22 Thread Sean Christopherson
On Mon, Feb 27, 2023, Ackerley Tng wrote: > This provides alignment macros for use in selftests. > > Also clean up tools/include/linux/bitmap.h's inline definition of > IS_ALIGNED(). > > Signed-off-by: Ackerley Tng > --- FYI, an almost-equivalent change went through net/, commit 10a04ff09bcc ("

[PATCH] selftests/livepatch: wait for atomic replace to occur

2024-08-22 Thread Ryan Sullivan
On some machines with a large number of CPUs there is a sizable delay between an atomic replace occurring and when sysfs updates accordingly. This fix uses 'loop_until' to wait for the atomic replace to unload all previous livepatches. Signed-off-by: Ryan Sullivan --- tools/testing/selftests/liv

Re: [PATCH v11 19/39] arm64/mm: Handle GCS data aborts

2024-08-22 Thread Mark Brown
On Thu, Aug 22, 2024 at 06:19:38PM +0100, Catalin Marinas wrote: > On Thu, Aug 22, 2024 at 05:44:19PM +0100, Mark Brown wrote: > > On Thu, Aug 22, 2024 at 05:12:30PM +0100, Catalin Marinas wrote: > > > On Thu, Aug 22, 2024 at 02:15:22AM +0100, Mark Brown wrote: > > > > > > +static bool is_invalid_

Re: [PATCH] selftests/livepatch: wait for atomic replace to occur

2024-08-22 Thread Joe Lawrence
On 8/22/24 12:34, Ryan Sullivan wrote: > Uses 'loop_until' to wait for the atomic replace to unload all previous > livepatches, as on some machines with a large number of CPUs there is a > sizable delay between the atomic replace ocurring and when sysfs > updates accordingly. > Small nit: flip th

Re: [PATCH v11 19/39] arm64/mm: Handle GCS data aborts

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 05:44:19PM +0100, Mark Brown wrote: > On Thu, Aug 22, 2024 at 05:12:30PM +0100, Catalin Marinas wrote: > > On Thu, Aug 22, 2024 at 02:15:22AM +0100, Mark Brown wrote: > > > > +static bool is_invalid_gcs_access(struct vm_area_struct *vma, u64 esr) > > > > + } else if (unlik

Re: [PATCH v11 19/39] arm64/mm: Handle GCS data aborts

2024-08-22 Thread Mark Brown
On Thu, Aug 22, 2024 at 05:12:30PM +0100, Catalin Marinas wrote: > On Thu, Aug 22, 2024 at 02:15:22AM +0100, Mark Brown wrote: > > +static bool is_invalid_gcs_access(struct vm_area_struct *vma, u64 esr) > > + } else if (unlikely(vma->vm_flags & VM_SHADOW_STACK)) { > > + /* Only GCS op

[PATCH] selftests/livepatch: wait for atomic replace to occur

2024-08-22 Thread Ryan Sullivan
Uses 'loop_until' to wait for the atomic replace to unload all previous livepatches, as on some machines with a large number of CPUs there is a sizable delay between the atomic replace ocurring and when sysfs updates accordingly. Signed-off-by: Ryan Sullivan --- tools/testing/selftests/livepatch

Re: [PATCH v2 8/9] KVM: selftests: Add a CoCo-specific test for KVM_PRE_FAULT_MEMORY

2024-08-22 Thread Pratik R. Sampat
On 8/20/2024 1:24 AM, Aithal, Srikanth wrote: > On 8/17/2024 12:53 AM, Pratik R. Sampat wrote: >> From: Michael Roth >> >> SEV, SEV-ES, and SNP have a few corner cases where there is potential >> for KVM_PRE_FAULT_MEMORY to behave differently depending on when it is >> issued during initial gue

Re: [PATCH v11 18/39] arm64/traps: Handle GCS exceptions

2024-08-22 Thread Mark Brown
On Thu, Aug 22, 2024 at 04:44:12PM +0100, Catalin Marinas wrote: > On Thu, Aug 22, 2024 at 02:15:21AM +0100, Mark Brown wrote: > > +void do_el0_gcs(struct pt_regs *regs, unsigned long esr) > > +{ > > + force_signal_inject(SIGSEGV, SEGV_CPERR, regs->pc, 0); > > +} > Just double checking: a GCSPO

Re: [PATCH v2 3/3] kselftest: Provide __cpuid_count() stub on non-x86 archs

2024-08-22 Thread Reinette Chatre
Hi Ilpo, On 8/22/24 1:11 AM, Ilpo Järvinen wrote: Building resctrl selftest fails on ARM because it uses __cpuid_count() that fails the build with error: CC resctrl_tests In file included from resctrl.h:24, from cat_test.c:11: In function 'arch_supports_noncont_cat',

Re: [PATCH v2 2/3] selftests/resctrl: Always initialize ecx to avoid build warnings

2024-08-22 Thread Reinette Chatre
Hi Ilpo, On 8/22/24 1:11 AM, Ilpo Järvinen wrote: To avoid warnings when __cpuid_count() is an empty stub, always initialize ecx because it is used in the return statement. Signed-off-by: Ilpo Järvinen Reviewed-by: Muhammad Usama Anjum --- Acked-by: Reinette Chatre Reinette

Re: [PATCH v2 1/3] selftests/resctrl: Generalize non-contiguous CAT check

2024-08-22 Thread Reinette Chatre
Hi Ilpo, On 8/22/24 1:11 AM, Ilpo Järvinen wrote: arch_supports_noncont_cat() checks if vendor is ARCH_AMD and if that is not true, ARCH_INTEL is assumed which might not be true either because get_vendor() can also return zero if neither AMD nor Intel is detected. Generalize the vendor check us

Re: [PATCH v11 21/39] arm64/gcs: Ensure that new threads have a GCS

2024-08-22 Thread Mark Brown
On Thu, Aug 22, 2024 at 05:17:14PM +0100, Catalin Marinas wrote: > > /* > > -* Ensure that GCS changes are observable by/from other PEs in > > -* case of migration. > > +* Ensure that GCS memory effects of the 'prev' thread are > > +* ordered before other memory accesses with r

Re: [PATCH v11 21/39] arm64/gcs: Ensure that new threads have a GCS

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 02:15:24AM +0100, Mark Brown wrote: > @@ -512,10 +538,16 @@ static void gcs_thread_switch(struct task_struct *next) > gcs_set_el0_mode(next); > > /* > - * Ensure that GCS changes are observable by/from other PEs in > - * case of migration. > +

Re: [PATCH v11 20/39] arm64/gcs: Context switch GCS state for EL0

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 02:15:23AM +0100, Mark Brown wrote: > There are two registers controlling the GCS state of EL0, GCSPR_EL0 which > is the current GCS pointer and GCSCRE0_EL1 which has enable bits for the > specific GCS functionality enabled for EL0. Manage these on context switch > and proce

Re: [PATCH v11 19/39] arm64/mm: Handle GCS data aborts

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 02:15:22AM +0100, Mark Brown wrote: > diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c > index 451ba7cbd5ad..3ada31c2ac12 100644 > --- a/arch/arm64/mm/fault.c > +++ b/arch/arm64/mm/fault.c > @@ -486,6 +486,14 @@ static void do_bad_area(unsigned long far, unsigned l

Re: [PATCH v11 18/39] arm64/traps: Handle GCS exceptions

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 02:15:21AM +0100, Mark Brown wrote: > +static void noinstr el0_gcs(struct pt_regs *regs, unsigned long esr) > +{ > + enter_from_user_mode(regs); > + local_daif_restore(DAIF_PROCCTX); > + do_el0_gcs(regs, esr); > + exit_to_user_mode(regs); > +} > + > static v

[PATCH v5 20/30] arm64/ptrace: add support for FEAT_POE

2024-08-22 Thread Joey Gouly
Add a regset for POE containing POR_EL0. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Mark Brown Reviewed-by: Catalin Marinas Reviewed-by: Anshuman Khandual --- arch/arm64/kernel/ptrace.c | 46 ++ include/uapi/linux/elf.h |

[PATCH v5 27/30] kselftest/arm64: add HWCAP test for FEAT_S1POE

2024-08-22 Thread Joey Gouly
Check that when POE is enabled, the POR_EL0 register is accessible. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Brown Cc: Shuah Khan Reviewed-by: Mark Brown --- tools/testing/selftests/arm64/abi/hwcap.c | 14 ++ 1 file changed, 14 insertions(+) diff -

[PATCH v5 30/30] KVM: selftests: get-reg-list: add Permission Overlay registers

2024-08-22 Thread Joey Gouly
Add new system registers: - POR_EL1 - POR_EL0 Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Marc Zyngier Cc: Oliver Upton Cc: Shuah Khan Reviewed-by: Mark Brown --- tools/testing/selftests/kvm/aarch64/get-reg-list.c | 14 ++ 1 file changed, 14 insertions

[PATCH v5 26/30] selftests: mm: make protection_keys test work on arm64

2024-08-22 Thread Joey Gouly
The encoding of the pkey register differs on arm64, than on x86/ppc. On those platforms, a bit in the register is used to disable permissions, for arm64, a bit enabled in the register indicates that the permission is allowed. This drops two asserts of the form: assert(read_pkey_reg() <= o

[PATCH v5 29/30] kselftest/arm64: Add test case for POR_EL0 signal frame records

2024-08-22 Thread Joey Gouly
Ensure that we get signal context for POR_EL0 if and only if POE is present on the system. Copied from the TPIDR2 test. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Brown Cc: Shuah Khan Reviewed-by: Mark Brown Acked-by: Shuah Khan --- .../testing/selftests/arm64/

[PATCH v5 28/30] kselftest/arm64: parse POE_MAGIC in a signal frame

2024-08-22 Thread Joey Gouly
Teach the signal frame parsing about the new POE frame, avoids warning when it is generated. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Mark Brown Cc: Shuah Khan Reviewed-by: Mark Brown --- tools/testing/selftests/arm64/signal/testcases/testcases.c | 4 1 file ch

[PATCH v5 05/30] arm64: cpufeature: add Permission Overlay Extension cpucap

2024-08-22 Thread Joey Gouly
This indicates if the system supports POE. This is a CPUCAP_BOOT_CPU_FEATURE as the boot CPU will enable POE if it has it, so secondary CPUs must also have this feature. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Acked-by: Catalin Marinas Reviewed-by: Anshuman Khandual ---

[PATCH v5 25/30] selftests: mm: move fpregs printing

2024-08-22 Thread Joey Gouly
arm64's fpregs are not at a constant offset from sigcontext. Since this is not an important part of the test, don't print the fpregs pointer on arm64. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Andrew Morton Cc: Shuah Khan Cc: Dave Hansen Cc: Aneesh Kumar K.V Acked-by

[PATCH v5 24/30] kselftest/arm64: move get_header()

2024-08-22 Thread Joey Gouly
Put this function in the header so that it can be used by other tests, without needing to link to testcases.c. This will be used by selftest/mm/protection_keys.c Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Andrew Morton Cc: Shuah Khan Cc: Dave Hansen Cc: Aneesh Kumar K

[PATCH v5 04/30] arm64: disable trapping of POR_EL0 to EL2

2024-08-22 Thread Joey Gouly
Allow EL0 or EL1 to access POR_EL0 without being trapped to EL2. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Acked-by: Catalin Marinas Reviewed-by: Anshuman Khandual --- arch/arm64/include/asm/el2_setup.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff

[PATCH v5 22/30] arm64: enable PKEY support for CPUs with S1POE

2024-08-22 Thread Joey Gouly
Now that PKEYs support has been implemented, enable it for CPUs that support S1POE. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Acked-by: Catalin Marinas Reviewed-by: Anshuman Khandual --- arch/arm64/include/asm/pkeys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH v5 23/30] arm64: add Permission Overlay Extension Kconfig

2024-08-22 Thread Joey Gouly
Now that support for POE and Protection Keys has been implemented, add a config to allow users to actually enable it. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Anshuman Khandual Acked-by: Catalin Marinas --- arch/arm64/Kconfig | 23 +++ 1

[PATCH v5 21/30] arm64: enable POE and PIE to coexist

2024-08-22 Thread Joey Gouly
Permission Indirection Extension and Permission Overlay Extension can be enabled independently. When PIE is disabled and POE is enabled, the permissions set by POR_EL0 will be applied on top of the permissions set in the PTE. When both PIE and POE are enabled, the permissions set by POR_EL0 will

[PATCH v5 12/30] arm64: re-order MTE VM_ flags

2024-08-22 Thread Joey Gouly
VM_PKEY_BIT[012] will use VM_HIGH_ARCH_[012], move the MTE VM flags to accommodate this. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Acked-by: Catalin Marinas --- include/linux/mm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git include/linux/mm.h incl

[PATCH v5 19/30] arm64: add POE signal support

2024-08-22 Thread Joey Gouly
Add PKEY support to signals, by saving and restoring POR_EL0 from the stackframe. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Mark Brown Acked-by: Szabolcs Nagy Reviewed-by: Catalin Marinas Reviewed-by: Anshuman Khandual --- arch/arm64/include/uapi/asm/sigco

[PATCH v5 18/30] arm64: implement PKEYS support

2024-08-22 Thread Joey Gouly
Implement the PKEYS interface, using the Permission Overlay Extension. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/mmu.h | 1 + arch/arm64/include/asm/mmu_context.h | 46 +++- arch/arm64/include/asm/p

[PATCH v5 17/30] arm64: add pte_access_permitted_no_overlay()

2024-08-22 Thread Joey Gouly
We do not want take POE into account when clearing the MTE tags. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Catalin Marinas Reviewed-by: Anshuman Khandual --- arch/arm64/include/asm/pgtable.h | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) d

[PATCH v5 15/30] arm64: mask out POIndex when modifying a PTE

2024-08-22 Thread Joey Gouly
When a PTE is modified, the POIndex must be masked off so that it can be modified. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Catalin Marinas Reviewed-by: Anshuman Khandual --- arch/arm64/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 delet

[PATCH v5 16/30] arm64: handle PKEY/POE faults

2024-08-22 Thread Joey Gouly
If a memory fault occurs that is due to an overlay/pkey fault, report that to userspace with a SEGV_PKUERR. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/traps.h | 1 + arch/arm64/kernel/traps.c | 6 arch/arm6

[PATCH v5 14/30] arm64: convert protection key into vm_flags and pgprot values

2024-08-22 Thread Joey Gouly
Modify arch_calc_vm_prot_bits() and vm_get_page_prot() such that the pkey value is set in the vm_flags and then into the pgprot value. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/include/asm/mman.h | 10 +- arch/arm64/mm/mmap.c | 11 +++

[PATCH v5 13/30] arm64: add POIndex defines

2024-08-22 Thread Joey Gouly
The 3-bit POIndex is stored in the PTE at bits 60..62. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Acked-by: Catalin Marinas --- arch/arm64/include/asm/pgtable-hwdef.h | 10 ++ 1 file changed, 10 insertions(+) diff --git arch/arm64/include/asm/pgtable-hwdef.h arch/

[PATCH v5 06/30] arm64: context switch POR_EL0 register

2024-08-22 Thread Joey Gouly
POR_EL0 is a register that can be modified by userspace directly, so it must be context switched. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/cpufeature.h | 6 ++ arch/arm64/include/asm/processor.h | 1 + arch/ar

[PATCH v5 11/30] arm64: enable the Permission Overlay Extension for EL0

2024-08-22 Thread Joey Gouly
Expose a HWCAP and ID_AA64MMFR3_EL1_S1POE to userspace, so they can be used to check if the CPU supports the feature. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Catalin Marinas Reviewed-by: Anshuman Khandual --- Documentation/arch/arm64/elf_hwcaps.rst | 2 ++

[PATCH v5 10/30] KVM: arm64: Sanitise ID_AA64MMFR3_EL1

2024-08-22 Thread Joey Gouly
Add the missing sanitisation of ID_AA64MMFR3_EL1, making sure we solely expose S1POE and TCRX (we currently don't support anything else). [joey: Took Marc's patch for S1PIE, and changed it for S1POE] Signed-off-by: Marc Zyngier Signed-off-by: Joey Gouly --- arch/arm64/kvm/sys_regs.c | 6 +-

[PATCH v5 09/30] KVM: arm64: use `at s1e1a` for POE

2024-08-22 Thread Joey Gouly
FEAT_ATS1E1A introduces a new instruction: `at s1e1a`. This is an address translation, without permission checks. POE allows read permissions to be removed from S1 by the guest. This means that an `at` instruction could fail, and not get the IPA. Switch to using `at s1e1a` so that KVM can get th

[PATCH v5 08/30] KVM: arm64: make kvm_at() take an OP_AT_*

2024-08-22 Thread Joey Gouly
To allow using newer instructions that current assemblers don't know about, replace the `at` instruction with the underlying SYS instruction. Signed-off-by: Joey Gouly Cc: Marc Zyngier Cc: Oliver Upton Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Marc Zyngier --- arch/arm64/include/asm/

[PATCH v5 07/30] KVM: arm64: Save/restore POE registers

2024-08-22 Thread Joey Gouly
Define the new system registers that POE introduces and context switch them. Signed-off-by: Joey Gouly Cc: Marc Zyngier Cc: Oliver Upton Cc: Catalin Marinas Cc: Will Deacon Reviewed-by: Marc Zyngier --- arch/arm64/include/asm/kvm_host.h | 4 arch/arm64/include/asm/vncr_mappin

[PATCH v5 02/30] x86/mm: add ARCH_PKEY_BITS to Kconfig

2024-08-22 Thread Joey Gouly
The new config option specifies how many bits are in each PKEY. Signed-off-by: Joey Gouly Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: H. Peter Anvin Cc: x...@kernel.org Acked-by: Dave Hansen --- arch/x86/Kconfig | 4 1 file changed, 4 insertions(+) dif

[PATCH v5 03/30] mm: use ARCH_PKEY_BITS to define VM_PKEY_BITN

2024-08-22 Thread Joey Gouly
Use the new CONFIG_ARCH_PKEY_BITS to simplify setting these bits for different architectures. Signed-off-by: Joey Gouly Cc: Andrew Morton Cc: linux-fsde...@vger.kernel.org Cc: linux...@kvack.org Acked-by: Dave Hansen Reviewed-by: Anshuman Khandual --- fs/proc/task_mmu.c | 2 ++ include/linu

[PATCH v5 01/30] powerpc/mm: add ARCH_PKEY_BITS to Kconfig

2024-08-22 Thread Joey Gouly
The new config option specifies how many bits are in each PKEY. Signed-off-by: Joey Gouly Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: "Aneesh Kumar K.V" Cc: "Naveen N. Rao" Cc: linuxppc-...@lists.ozlabs.org Acked-by: Michael Ellerman --- arch/powerpc/Kconfig | 4

[PATCH v5 00/30] Permission Overlay Extension

2024-08-22 Thread Joey Gouly
Hi all, This series implements the Permission Overlay Extension introduced in 2022 VMSA enhancements [1]. It is based on v6.11-rc4. Changes since v4[2]: - Added Acks and R-bs, thanks! - KVM: - Move POR_EL{0,1} handling inside TCR_EL2 blocks - Add vi

[PATCH rc 2/2] iommu: Do not return 0 from map_pages if it doesn't do anything

2024-08-22 Thread Jason Gunthorpe
These three implementations of map_pages() all succeed if a mapping is requested with no read or write. Since they return back to __iommu_map() leaving the mapped output as 0 it triggers an infinite loop. Therefore nothing is using no-access protection bits. Further, VFIO and iommufd rely on iommu

[PATCH rc 0/2] Fix maps created without READ or WRITE

2024-08-22 Thread Jason Gunthorpe
I noticed some bugs here while working on iommupt. Fix them up. Joerg, can you pick this both for your -rc branch? Thanks, Jason Jason Gunthorpe (2): iommufd: Do not allow creating areas without READ or WRITE iommu: Do not return 0 from map_pages if it doesn't do anything drivers/iommu/io-

[PATCH rc 1/2] iommufd: Do not allow creating areas without READ or WRITE

2024-08-22 Thread Jason Gunthorpe
This results in passing 0 or just IOMMU_CACHE to iommu_map(). Most of the page table formats don't like this: amdv1 - -EINVAL armv7s - returns 0, doesn't update mapped arm-lpae - returns 0 doesn't update mapped dart - returns 0, doesn't update mapped VT-D - returns -EINVAL Unfortunately

[RFC PATCH net-next 4/5] selftests: mlxsw: sch_red_*: Use defer for qdisc management

2024-08-22 Thread Petr Machata
Use defer scopes to manage qdisc lifetime. Signed-off-by: Petr Machata --- .../drivers/net/mlxsw/sch_red_ets.sh | 32 +-- .../drivers/net/mlxsw/sch_red_root.sh | 24 ++ 2 files changed, 34 insertions(+), 22 deletions(-) diff --git a/tools/testing/sel

[RFC PATCH net-next 5/5] selftests: sch_tbf_core: Use defer for stopping traffic

2024-08-22 Thread Petr Machata
Tests interrupted part-way through leave behind a running mausezahn. Use defer to schedule a traffic stop after traffic is started. Signed-off-by: Petr Machata --- tools/testing/selftests/net/forwarding/sch_tbf_core.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/t

[RFC PATCH net-next 3/5] selftests: mlxsw: sch_red_core: Use defer for stopping traffic

2024-08-22 Thread Petr Machata
Tests interrupted part-way through leave behind a running mausezahn. Use defer to schedule a traffic stop after traffic is started. Mark the functions that run traffic as defer-scoped, such that the traffic is stopped right after the function returns. Signed-off-by: Petr Machata --- .../drivers/

[RFC PATCH net-next 2/5] selftests: mlxsw: sch_red_core: Use defer for test cleanup

2024-08-22 Thread Petr Machata
Instead of having a suite of dedicated cleanup functions, use the defer framework to schedule cleanups right as their setup functions are run. This makes a dedicated cleanup() moot, instead fall back to the lib.sh-provided one, which invokes the necessary defer cleanups as well. Signed-off-by: Pe

[RFC PATCH net-next 1/5] selftests: forwarding: Introduce deferred commands

2024-08-22 Thread Petr Machata
In commit 8510801a9dbd ("selftests: drv-net: add ability to schedule cleanup with defer()"), a defer helper was added to Python selftests. The idea is to keep cleanup commands close to their dirtying counterparts, thereby making it more transparent what is cleaning up what, making it harder to miss

[RFC PATCH net-next 0/5] selftests: forwarding: Introduce deferred commands

2024-08-22 Thread Petr Machata
Recently, a defer helper was added to Python selftests. The idea is to keep cleanup commands close to their dirtying counterparts, thereby making it more transparent what is cleaning up what, making it harder to miss a cleanup, and make the whole cleanup business exception safe. All these benefits

Re: [PATCH] ftrace/selftest: Test combination of function_graph tracer and function profiler

2024-08-22 Thread Steven Rostedt
On Wed, 21 Aug 2024 21:54:42 -0600 Shuah Khan wrote: > On 8/21/24 13:09, Steven Rostedt wrote: > > From: Steven Rostedt > > > > Masami reported a bug when running function graph tracing then the > > function profiler. The following commands would cause a kernel crash: > > > ># cd /sys/kern

[PATCH v2 3/3] kunit: Improve format of the KUNIT_EXPECT_EQ assertion

2024-08-22 Thread Michal Wajdeczko
Diagnostic message for failed KUNIT_ASSERT|EXPECT_EQ shows in case of integers only raw values, like for this example: bool flag; KUNIT_EXPECT_EQ(test, -ENODATA, kstrtobool("dunno", &flag)); we will get: [ ] Expected -61 == kstrtobool("dunno", &flag), but [ ] kstrtobool("dunno", &fla

[PATCH v2 2/3] kunit: Improve format of the PTR_EQ|NE|NULL assertion

2024-08-22 Thread Michal Wajdeczko
Diagnostic message for failed KUNIT_ASSERT|EXPECT_PTR_EQ|NE|NULL shows only raw pointer value, like for this example: void *ptr1 = ERR_PTR(-ENOMEM); void *ptr2 = NULL; KUNIT_EXPECT_PTR_EQ(test, ptr1, ptr2); KUNIT_EXPECT_NULL(test, ptr1); we will get: [ ] Expected ptr1 == ptr2, but [

[PATCH v2 0/3] kunit: Improve format of some assertion messages

2024-08-22 Thread Michal Wajdeczko
v1: https://patchwork.kernel.org/project/linux-kselftest/list/?series=881867 v2: keep numerical values (David) Cc: David Gow Cc: Rae Moar Michal Wajdeczko (3): kunit: Improve format of the NOT_ERR_OR_NULL assertion kunit: Improve format of the PTR_EQ|NE|NULL assertion kunit: Improve forma

[PATCH v2 1/3] kunit: Improve format of the NOT_ERR_OR_NULL assertion

2024-08-22 Thread Michal Wajdeczko
Diagnostic message for failed KUNIT_ASSERT|EXPECT_NOT_ERR_OR_NULL shows only raw error code, like for this example: void *myptr = ERR_PTR(-ENOMEM); KUNIT_EXPECT_NOT_ERR_OR_NULL(test, myptr); we will get: [ ] Expected myptr is not error, but is: -12 but we can improve it by using more frie

Re: [PATCH v2] selftests:mm: Fix mmap() error paths to check for MAP_FAILED

2024-08-22 Thread Dev Jain
On 8/22/24 17:30, Yang Ruibin wrote: To correctly detect whether mmap is successful, must use if (map_ptr == MAP_FAILED)to avoid incorrectly handling a valid mapping.Fix mmap() error paths to check for MAP_FAILED. Shouldn't you have written "avoid processing the return value from a failed mm

[PATCH v6 2/2] selftests: Add a test mangling with uc_sigmask

2024-08-22 Thread Dev Jain
The test is motivated by the following observation: Raise a signal, jump to signal handler. The ucontext_t structure dumped by kernel to userspace has a uc_sigmask field having the mask of blocked signals. If you run a fresh minimalistic program doing this, this field is empty, even if you block s

[PATCH v6 1/2] selftests: Rename sigaltstack to generic signal

2024-08-22 Thread Dev Jain
Rename sigaltstack to generic signal directory, to allow adding more signal tests in the future. Signed-off-by: Dev Jain Reviewed-by: Mark Brown --- tools/testing/selftests/Makefile| 2 +- tools/testing/selftests/{sigaltstack => signal}/.gitignore | 0 tools

[PATCH v6 0/2] Add test to distinguish between thread's signal mask and ucontext_t

2024-08-22 Thread Dev Jain
This patch series is motivated by the following observation: Raise a signal, jump to signal handler. The ucontext_t structure dumped by kernel to userspace has a uc_sigmask field having the mask of blocked signals. If you run a fresh minimalistic program doing this, this field is empty, even if yo

Re: [PATCH v6 1/2] selftests: Rename sigaltstack to generic signal

2024-08-22 Thread Dev Jain
On 8/22/24 17:39, Dev Jain wrote: Rename sigaltstack to signal, and rename the existing test to sigaltstack.c. Sorry, hastily copied the commit message from the previous iteration :) will send again, kindly ignore this. Signed-off-by: Dev Jain Reviewed-by: Mark Brown --- tools/testing

[PATCH v6 2/2] selftests: Add a test mangling with uc_sigmask

2024-08-22 Thread Dev Jain
The test is motivated by the following observation: Raise a signal, jump to signal handler. The ucontext_t structure dumped by kernel to userspace has a uc_sigmask field having the mask of blocked signals. If you run a fresh minimalistic program doing this, this field is empty, even if you block s

[PATCH v6 1/2] selftests: Rename sigaltstack to generic signal

2024-08-22 Thread Dev Jain
Rename sigaltstack to signal, and rename the existing test to sigaltstack.c. Signed-off-by: Dev Jain Reviewed-by: Mark Brown --- tools/testing/selftests/Makefile| 2 +- tools/testing/selftests/{sigaltstack => signal}/.gitignore | 0 tools/testing/selftests/{

[PATCH v6 0/2] Add test to distinguish between thread's signal mask and ucontext_t

2024-08-22 Thread Dev Jain
This patch series is motivated by the following observation: Raise a signal, jump to signal handler. The ucontext_t structure dumped by kernel to userspace has a uc_sigmask field having the mask of blocked signals. If you run a fresh minimalistic program doing this, this field is empty, even if yo

[PATCH v2] selftests:mm: Fix mmap() error paths to check for MAP_FAILED

2024-08-22 Thread Yang Ruibin
To correctly detect whether mmap is successful, must use if (map_ptr == MAP_FAILED)to avoid incorrectly handling a valid mapping.Fix mmap() error paths to check for MAP_FAILED. Signed-off-by: Yang Ruibin <11162...@vivo.com> --- tools/testing/selftests/mm/ksm_tests.c | 2 +- tools/testing/self

Re: [PATCH v11 18/39] arm64/traps: Handle GCS exceptions

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 02:15:21AM +0100, Mark Brown wrote: > A new exception code is defined for GCS specific faults other than > standard load/store faults, for example GCS token validation failures, > add handling for this. These faults are reported to userspace as > segfaults with code SEGV_CPE

Re: [PATCH v11 17/39] arm64/hwcap: Add hwcap for GCS

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 02:15:20AM +0100, Mark Brown wrote: > Provide a hwcap to enable userspace to detect support for GCS. > > Reviewed-by: Thiago Jung Bauermann > Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas

Re: [PATCH v11 16/39] arm64/idreg: Add overrride for GCS

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 02:15:19AM +0100, Mark Brown wrote: > Hook up an override for GCS, allowing it to be disabled from the command > line by specifying arm64.nogcs in case there are problems. > > Reviewed-by: Thiago Jung Bauermann > Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas

Re: [PATCH v5 1/2] selftests: Rename sigaltstack to generic signal

2024-08-22 Thread Dev Jain
On 8/22/24 08:33, Shuah Khan wrote: On 8/21/24 00:15, Dev Jain wrote: Rename sigaltstack to signal, and rename the existing test to sigaltstack.c. Can you elaborate on the benefits if renaming the test? Also you have such a good information in the cover-letter for this patch - it would be g

Re: [PATCH net-next v3] selftests: net: add helper for checking if nettest is available

2024-08-22 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to netdev/net-next.git (main) by Paolo Abeni : On Tue, 20 Aug 2024 18:22:27 -0700 you wrote: > A few tests check if nettest exists in the $PATH before adding > $PWD to $PATH and re-checking. They don't discard stderr on > the first check (and nettest is built as part

Re: [PATCH v11 14/39] arm64/mm: Map pages for guarded control stack

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 02:15:17AM +0100, Mark Brown wrote: > diff --git a/arch/arm64/include/asm/mman.h b/arch/arm64/include/asm/mman.h > index c21849ffdd88..37dfd2882f04 100644 > --- a/arch/arm64/include/asm/mman.h > +++ b/arch/arm64/include/asm/mman.h > @@ -61,6 +61,15 @@ static inline bool arch

Re: [PATCH v11 13/39] mm: Define VM_SHADOW_STACK for arm64 when we support GCS

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 02:15:16AM +0100, Mark Brown wrote: > Use VM_HIGH_ARCH_5 for guarded control stack pages. > > Reviewed-by: Thiago Jung Bauermann > Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas

Re: [PATCH net-next v3 4/8] selftests/net: Open /proc/thread-self in open_netns()

2024-08-22 Thread Simon Horman
On Wed, Aug 21, 2024 at 10:44:30PM +0100, Dmitry Safonov wrote: > On Wed, 21 Aug 2024 at 20:11, Simon Horman wrote: > > > > On Thu, Aug 15, 2024 at 10:32:29PM +0100, Dmitry Safonov via B4 Relay wrote: > > > From: Dmitry Safonov <0x7f454...@gmail.com> > > > > > > It turns to be that open_netns() is

Re: [PATCH net-next v3 2/8] selftests/net: Provide test_snprintf() helper

2024-08-22 Thread Simon Horman
On Wed, Aug 21, 2024 at 10:35:10PM +0100, Dmitry Safonov wrote: > Hi Simon, > > On Wed, 21 Aug 2024 at 20:10, Simon Horman wrote: > > > > On Thu, Aug 15, 2024 at 10:32:27PM +0100, Dmitry Safonov via B4 Relay wrote: > > > From: Dmitry Safonov <0x7f454...@gmail.com> > > > > > > Instead of pre-alloc

Re: [PATCH v11 06/39] arm64/gcs: Document the ABI for Guarded Control Stacks

2024-08-22 Thread Catalin Marinas
On Thu, Aug 22, 2024 at 02:15:09AM +0100, Mark Brown wrote: > Add some documentation of the userspace ABI for Guarded Control Stacks. > > Reviewed-by: Thiago Jung Bauermann > Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas

[PATCH net-next v7] net: netconsole: selftests: Create a new netconsole selftest

2024-08-22 Thread Breno Leitao
Adds a selftest that creates two virtual interfaces, assigns one to a new namespace, and assigns IP addresses to both. It listens on the destination interface using socat and configures a dynamic target on netconsole, pointing to the destination IP address. The test then checks if the message was

Re: [RFC PATCH v1 1/4] x86/cpufeatures: Add CPUID feature bit for the Bus Lock Threshold

2024-08-22 Thread Manali Shukla
Hi Sean, Thank you for reviewing my patches. On 8/17/2024 1:07 AM, Sean Christopherson wrote: > On Tue, Jul 09, 2024, Manali Shukla wrote: >> Malicious guests can cause bus locks to degrade the performance of > > I would say "misbehaving", I bet the overwhelming majority of bus locks in > pract

[PATCH bpf-next v2 8/8] selftests/bpf: Support cross-endian building

2024-08-22 Thread Tony Ambardar
From: Tony Ambardar Update Makefile build rules to compile BPF programs with target endianness rather than host byte-order. With recent changes, this allows building the full selftests/bpf suite hosted on x86_64 and targeting s390x or mips64eb for example. Signed-off-by: Tony Ambardar --- tool

[PATCH bpf-next v2 4/8] libbpf: Support BTF.ext loading and output in either endianness

2024-08-22 Thread Tony Ambardar
From: Tony Ambardar Support for handling BTF data of either endianness was added in [1], but did not include BTF.ext data for lack of use cases. Later, support for static linking [2] provided a use case, but this feature and later ones were restricted to native-endian usage. Add support for BTF.

[PATCH bpf-next v2 7/8] libbpf: Support creating light skeleton of either endianness

2024-08-22 Thread Tony Ambardar
From: Tony Ambardar Track target endianness in 'struct bpf_gen' and process in-memory data in native byte-order, but on finalization convert the embedded loader BPF insns to target endianness. The light skeleton also includes a target-accessed data blob which is heterogeneous and thus difficult

[PATCH bpf-next v2 6/8] libbpf: Support linking bpf objects of either endianness

2024-08-22 Thread Tony Ambardar
From: Tony Ambardar Allow static linking object files of either endianness, checking that input files have consistent byte-order, and setting output endianness from input. Linking requires in-memory processing of programs, relocations, sections, etc. in native endianness, and output conversion t

[PATCH bpf-next v2 5/8] libbpf: Support opening bpf objects of either endianness

2024-08-22 Thread Tony Ambardar
From: Tony Ambardar Allow bpf_object__open() to access files of either endianness, and convert included BPF programs to native byte-order in-memory for introspection. Signed-off-by: Tony Ambardar --- tools/lib/bpf/libbpf.c | 21 +++-- tools/lib/bpf/libbpf_internal.h |

  1   2   >