Re: [PATCH net-next v22 04/13] netdev: netdevice devmem allocator

2024-08-28 Thread Mina Almasry
On Tue, Aug 27, 2024 at 7:15 PM Jakub Kicinski wrote: > > On Sun, 25 Aug 2024 04:15:02 + Mina Almasry wrote: > > +void net_devmem_free_dmabuf(struct net_iov *niov) > > +{ > > + struct net_devmem_dmabuf_binding *binding = net_iov_binding(niov); > > + unsigned long dma_addr = net_devmem_

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Paolo Abeni
Adding Mat(s) for awareness, it would be great (but difficult) to have mptcp too in the long run ;) On 8/27/24 21:32, Willem de Bruijn wrote: From: Willem de Bruijn Lay the groundwork to import into kselftests the over 150 packetdrill TCP/IP conformance tests on github.com/google/packetdrill.

Re: [PATCH RFC 0/3] add support for mm-local memory allocations

2024-08-28 Thread Alexander Graf
Hey Roman, On 21.06.24 22:14, Roman Kagan wrote: In a series posted a few years ago [1], a proposal was put forward to allow the kernel to allocate memory local to a mm and thus push it out of reach for current and future speculation-based cross-process attacks. We still believe this is a nice

Re: [PATCH bpf-next v1 2/2] selftests/bpf: Fix cross-compile issue for some files and a static compile issue for "-lzstd"

2024-08-28 Thread Yikai Lin
On 2024/8/28 06:49:18, Lin Yikai reply: [Some people who received this message don't often get email from andrii.nakry...@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ] On Tue, Aug 27, 2024 at 6:40 AM Lin Yikai wrote: 1. Fix cross-compile issue fo

Re: [PATCH] selftests/arm64: Fix build warnings for abi

2024-08-28 Thread Mark Brown
On Tue, Aug 27, 2024 at 10:48:51AM +0530, Dev Jain wrote: > - ksft_exit_fail_msg("PTRACE_TRACEME", strerror(errno)); > + ksft_exit_fail_perror("PTRACE_TRACEME"); > > if (raise(SIGSTOP)) > - ksft_exit_fail_msg("raise(SIGSTOP)", strerror(errno)); > +

Re: [PATCH] selftests/arm64: Fix build warnings for abi

2024-08-28 Thread Mark Brown
On Tue, Aug 27, 2024 at 01:33:47PM +0100, Will Deacon wrote: > On Tue, Aug 27, 2024 at 10:48:51AM +0530, Dev Jain wrote: > > A "%s" is missing in ksft_exit_fail_msg(); instead, use the newly > > introduced ksft_exit_fail_perror(). Also, uint64_t corresponds to > > unsigned 64-bit integer, so use %l

[PATCH bpf-next v3 0/8] libbpf, selftests/bpf: Support cross-endian usage

2024-08-28 Thread Tony Ambardar
Hello all, This patch series targets a long-standing BPF usability issue - the lack of general cross-compilation support - by enabling cross-endian usage of libbpf and bpftool, as well as supporting cross-endian build targets for selftests/bpf. Benefits include improved BPF development and testin

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

2024-08-28 Thread Tony Ambardar
Fix missing newlines and extraneous terminal spaces in messages. Signed-off-by: Tony Ambardar --- tools/lib/bpf/btf.c | 6 +++--- tools/lib/bpf/btf_dump.c | 2 +- tools/lib/bpf/btf_relocate.c | 2 +- tools/lib/bpf/libbpf.c | 4 ++-- tools/lib/bpf/relo_core.c| 2 +- 5 files

[PATCH bpf-next v3 3/8] libbpf: Fix output .symtab byte-order during linking

2024-08-28 Thread Tony Ambardar
Object linking output data uses the default ELF_T_BYTE type for '.symtab' section data, which disables any libelf-based translation. Explicitly set the ELF_T_SYM type for output to restore libelf's byte-order conversion, noting that input '.symtab' data is already correctly translated. Fixes: faf6

[PATCH bpf-next v3 2/8] libbpf: Fix header comment typos for BTF.ext

2024-08-28 Thread Tony Ambardar
Mention struct btf_ext_info_sec rather than non-existent btf_sec_func_info in BTF.ext struct documentation. Signed-off-by: Tony Ambardar --- tools/lib/bpf/libbpf_internal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/lib

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

2024-08-28 Thread 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.ext handling in either

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

2024-08-28 Thread 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. Loading BPF objects of non-native byte-order is still disallowed however. Signed-off-by: Tony Ambardar --- tools/lib/bpf/libbpf.c | 34 +

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

2024-08-28 Thread 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 to target byte-order. T

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

2024-08-28 Thread 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 to convert to target b

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

2024-08-28 Thread 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 --- tools/testing/selftests/bp

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Jason A. Donenfeld
On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: > > On Thu, Aug 22, 2024 at 09:13:13AM +0200, Christophe Leroy wrote: > > > With the current implementation, __cvdso_getrandom_data() calls > > > memset(), which is un

[PATCH 2/2] selftests: tpm2: test_smoke: Run only when TPM2 is avaialable.

2024-08-28 Thread Michal Suchanek
Since Linux 5.6 tpm_version_major sysfs file is avaialble which gives the TPM version. Using this file the test can be skipped on systems with TPM 1.2. Signed-off-by: Michal Suchanek --- tools/testing/selftests/tpm2/test_smoke.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testi

[PATCH 1/2] MAINTAINERS: Add selftest files to TPM section

2024-08-28 Thread Michal Suchanek
tools/testing/selftests/tpm2/ is TPM-specific test Signed-off-by: Michal Suchanek --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 878dcd23b331..c2ee92c7c16c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23184,6 +23184,7 @@ Q: https://pat

Re: [PATCH v4 3/4] selftests/vDSO: Use KHDR_INCLUDES to locate UAPI headers for vdso_test_getrandom

2024-08-28 Thread Jason A. Donenfeld
On Tue, Aug 27, 2024 at 05:29:56PM +0200, Jason A. Donenfeld wrote: > On Tue, Aug 27, 2024 at 5:29 PM Xi Ruoyao wrote: > > Or, I can add $(KHDR_INCLUDES) but also keep > > -isystem $(top_srcdir)/include/uapi, so "make -C tools/testing/selftests > > TARGETS=vDSO" will still (happens to) work on x86

Re: [PATCH v4 3/4] selftests/vDSO: Use KHDR_INCLUDES to locate UAPI headers for vdso_test_getrandom

2024-08-28 Thread Xi Ruoyao
On Wed, 2024-08-28 at 13:36 +0200, Jason A. Donenfeld wrote: > On Tue, Aug 27, 2024 at 05:29:56PM +0200, Jason A. Donenfeld wrote: > > On Tue, Aug 27, 2024 at 5:29 PM Xi Ruoyao wrote: > > > Or, I can add $(KHDR_INCLUDES) but also keep > > > -isystem $(top_srcdir)/include/uapi, so "make -C tools/te

[PATCH bpf-next v2 0/2] selftests/bpf: Enable vmtest for cross-compile arm64 on x86_64 host, and fix some issues.

2024-08-28 Thread Lin Yikai
These two patch enable the use of "vmtest.sh" for cross-compile arm64 on x86_64 host. This is essential for utilizing BPF on Android (arm64), as the compilation server is running on Ubuntu (x86). Following previous guidance from V1, the two changes are as follow: V2: - patch 2: - [1/2] In Ma

[PATCH bpf-next v2 1/2] selftests/bpf: Enable vmtest for cross-compile arm64 on x86_64 host, and fix some issues.

2024-08-28 Thread Lin Yikai
In Makefile, we use $(SRCARCH) to access target arch's uapi include. This allow us to obtain the definition of 'struct user_pt_regs' for "ptrace.h" header file. Thus, it is no longer necessary to execute "make headers_install". Signed-off-by: Lin Yikai --- tools/testing/selftests/bpf/Makefile

[PATCH bpf-next v2 2/2] selftests/bpf: fix static cross-compile error for liblstd.a linking.

2024-08-28 Thread Lin Yikai
Regard "LDLIBS += -lzstd" as a separate patch for static compile. To fix static cross-compile error like this: $LDLIBS=-static LDFLAGS=--sysroot=/aarch64-linux-gnu/libc ./vmtest.sh -s -- ./test_progs /aarch64-linux-gnu/bin/ld: aarch64-linux-gnu/libc/usr/lib/libelf.a(elf_compress.o): in func

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Arnd Bergmann
On Wed, Aug 28, 2024, at 11:18, Jason A. Donenfeld wrote: > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: >> On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: >> > >> > Is there a compiler flag that could be used to disable the generation of >> > calls >> > to me

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Jason A. Donenfeld
On Wed, Aug 28, 2024 at 2:24 PM Arnd Bergmann wrote: > > On Wed, Aug 28, 2024, at 11:18, Jason A. Donenfeld wrote: > > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > >> On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: > >> > > >> > Is there a compiler flag that

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Segher Boessenkool
On Wed, Aug 28, 2024 at 01:18:34PM +0200, Jason A. Donenfeld wrote: > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > > On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: > > > > + for (i = 0; i < ARRAY_SIZE(params->reserved); i++) > > > > +

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Jason A. Donenfeld
On Wed, Aug 28, 2024 at 07:33:13AM -0500, Segher Boessenkool wrote: > On Wed, Aug 28, 2024 at 01:18:34PM +0200, Jason A. Donenfeld wrote: > > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > > > On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: > > > > > +

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Segher Boessenkool
On Wed, Aug 28, 2024 at 12:24:12PM +, Arnd Bergmann wrote: > On Wed, Aug 28, 2024, at 11:18, Jason A. Donenfeld wrote: > > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > >> On Tue, Aug 27, 2024 at 11:08:19AM -0700, Eric Biggers wrote: > >> > > >> > Is there a compiler fl

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Segher Boessenkool
On Wed, Aug 28, 2024 at 02:26:08PM +0200, Jason A. Donenfeld wrote: > On Wed, Aug 28, 2024 at 2:24 PM Arnd Bergmann wrote: > > > > On Wed, Aug 28, 2024, at 11:18, Jason A. Donenfeld wrote: > > > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > > >> On Tue, Aug 27, 2024 at 11:0

Re: [PATCH 2/2] selftests: tpm2: test_smoke: Run only when TPM2 is avaialable.

2024-08-28 Thread Jarkko Sakkinen
On Wed Aug 28, 2024 at 2:23 PM EEST, Michal Suchanek wrote: > Since Linux 5.6 tpm_version_major sysfs file is avaialble which gives > the TPM version. > > Using this file the test can be skipped on systems with TPM 1.2. > > Signed-off-by: Michal Suchanek > --- > tools/testing/selftests/tpm2/test_

[PATCH] selftests/vDSO: open code basic chacha instead of linking to libsodium

2024-08-28 Thread Jason A. Donenfeld
Linking to libsodium makes building this test annoying in cross compilation environments and is just way too much. Since this is just a basic correctness test, simply open code a simple, unoptimized, dumb chacha, rather than linking to libsodium. Signed-off-by: Jason A. Donenfeld --- tools/testi

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Willem de Bruijn
Jakub Kicinski wrote: > Very exciting to see packetdrill tests making their way upstream! > > On Tue, 27 Aug 2024 15:32:29 -0400 Willem de Bruijn wrote: > > RFC points for discussion > > > > ksft: the choice for this python framework introduces a dependency on > > the YNL scripts, and some non-ob

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Willem de Bruijn
Paolo Abeni wrote: > Adding Mat(s) for awareness, it would be great (but difficult) to have > mptcp too in the long run ;) > > On 8/27/24 21:32, Willem de Bruijn wrote: > > From: Willem de Bruijn > > > > Lay the groundwork to import into kselftests the over 150 packetdrill > > TCP/IP conformanc

Re: [PATCH] selftests/vDSO: open code basic chacha instead of linking to libsodium

2024-08-28 Thread LEROY Christophe
Hi Jason, Le 28/08/2024 à 15:55, Jason A. Donenfeld a écrit : > Linking to libsodium makes building this test annoying in cross > compilation environments and is just way too much. Since this is just a > basic correctness test, simply open code a simple, unoptimized, dumb > chacha, rather than lin

Re: [PATCH nf-next v3 1/2] netfilter: Make IP_NF_IPTABLES_LEGACY selectable

2024-08-28 Thread Jakub Kicinski
On Tue, 27 Aug 2024 07:52:40 -0700 Breno Leitao wrote: > +++ b/tools/testing/selftests/net/config You gotta check all the configs, net is now fine, but bpf still breaks. There may be more configs we don't use in CI. BTW I'm not saying anything about the change itself. There's a non-zero chance th

Re: [PATCH] selftests/vDSO: open code basic chacha instead of linking to libsodium

2024-08-28 Thread Jason A. Donenfeld
Hi Christophe, On Wed, Aug 28, 2024 at 4:38 PM LEROY Christophe wrote: > - key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7] > + le32toh(key[0]), le32toh(key[1]), le32toh(key[2]), > le32toh(key[3]), > + le32toh(key[4]), le32toh(key[5]), le3

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Stanislav Fomichev
On 08/27, Willem de Bruijn wrote: > From: Willem de Bruijn > > Lay the groundwork to import into kselftests the over 150 packetdrill > TCP/IP conformance tests on github.com/google/packetdrill. > > Florian recently added support for packetdrill tests in nf_conntrack, > in commit a8a388c2aae49 ("

Re: [PATCH nf-next v3 1/2] netfilter: Make IP_NF_IPTABLES_LEGACY selectable

2024-08-28 Thread Breno Leitao
Hello Jakub, On Wed, Aug 28, 2024 at 07:42:40AM -0700, Jakub Kicinski wrote: > On Tue, 27 Aug 2024 07:52:40 -0700 Breno Leitao wrote: > > +++ b/tools/testing/selftests/net/config > > You gotta check all the configs, net is now fine, but bpf still breaks. > There may be more configs we don't use i

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Jakub Kicinski
On Wed, 28 Aug 2024 08:01:02 -0700 Stanislav Fomichev wrote: > I don't see anything about building the binary itself. Am I missing > something or should we also have some makefile magic to do it? > I'm not sure packetdrill is packaged by the distros... Presumably > we want the existing NIPA runners

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Ard Biesheuvel
On Wed, 28 Aug 2024 at 14:57, Segher Boessenkool wrote: > > On Wed, Aug 28, 2024 at 12:24:12PM +, Arnd Bergmann wrote: > > On Wed, Aug 28, 2024, at 11:18, Jason A. Donenfeld wrote: > > > On Tue, Aug 27, 2024 at 05:53:30PM -0500, Segher Boessenkool wrote: > > >> On Tue, Aug 27, 2024 at 11:08:19

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Willem de Bruijn
Stanislav Fomichev wrote: > On 08/27, Willem de Bruijn wrote: > > From: Willem de Bruijn > > > > Lay the groundwork to import into kselftests the over 150 packetdrill > > TCP/IP conformance tests on github.com/google/packetdrill. > > > > Florian recently added support for packetdrill tests in nf

Re: [RFC PATCH v1 3/4] KVM: x86: nSVM: Implement support for nested Bus Lock Threshold

2024-08-28 Thread Manali Shukla
On 8/17/2024 1:35 AM, Sean Christopherson wrote: > On Tue, Jul 09, 2024, Manali Shukla wrote: >> Expose the Bus Lock Threshold in the guest CPUID and support its >> functionality in nested guest. > > Why? This is a rather messy feature to support in a nested setup, and I'd > much > prefer to not

Re: [PATCH] selftests/bpf: Fix incorrect parameters in NULL pointer checking

2024-08-28 Thread patchwork-bot+netdevbpf
Hello: This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov : On Tue, 20 Aug 2024 10:36:22 +0800 you wrote: > From: Hao Ge > > Smatch reported the following warning: > ./tools/testing/selftests/bpf/testing_helpers.c:455 get_xlated_program() > warn: variable derefere

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Jakub Kicinski
On Wed, 28 Aug 2024 10:03:55 -0400 Willem de Bruijn wrote: > > > A single script is much > > > simpler, optionally with nested KTAP (not supported yet by ksft). But, > > > I'm afraid that running time without intermediate output will be very > > > long when we integrate all packetdrill scripts. >

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Matthieu Baerts
Hi Willem, Paolo, Thank you for this series, that would be great to have the CI validating these packetdrill tests! (Having the Netdev CI validating these packetdrill tests was part of my suggestions for the discussion we will have at NetConf :) ) On 28/08/2024 16:03, Willem de Bruijn wrote: > P

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Segher Boessenkool
Hi! On Wed, Aug 28, 2024 at 05:40:23PM +0200, Ard Biesheuvel wrote: > On Wed, 28 Aug 2024 at 14:57, Segher Boessenkool > wrote: > > > > On Wed, Aug 28, 2024 at 12:24:12PM +, Arnd Bergmann wrote: > > > On Wed, Aug 28, 2024, at 11:18, Jason A. Donenfeld wrote: > > > > On Tue, Aug 27, 2024 at 05

Re: [RFC PATCH v1 2/4] KVM: SVM: Enable Bus lock threshold exit

2024-08-28 Thread Manali Shukla
> >> /* >> * Use nested page tables by default. Note, NPT may get forced off by >> * svm_hardware_setup() if it's unsupported by hardware or the host kernel. >> @@ -3231,6 +3234,19 @@ static int invpcid_interception(struct kvm_vcpu *vcpu) >> return kvm_handle_invpcid(vcpu, type, gva);

Re: [PATCH] selftests/vDSO: open code basic chacha instead of linking to libsodium

2024-08-28 Thread Christophe Leroy
Le 28/08/2024 à 16:49, Jason A. Donenfeld a écrit : Hi Christophe, On Wed, Aug 28, 2024 at 4:38 PM LEROY Christophe wrote: - key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7] + le32toh(key[0]), le32toh(key[1]), le32toh(key[2]), le32toh(key[3]), +

Re: [PATCH] selftests/vDSO: open code basic chacha instead of linking to libsodium

2024-08-28 Thread Jason A. Donenfeld
On Wed, Aug 28, 2024 at 6:54 PM Christophe Leroy wrote: > The only thing is that you must describe this behaviour change in your > commit message, you can't just let people believe it is a one-to-one > replacement of the previous test implementation that used Sodium. Good point, will do.

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Ard Biesheuvel
On Wed, 28 Aug 2024 at 18:24, Segher Boessenkool wrote: > > Hi! > > On Wed, Aug 28, 2024 at 05:40:23PM +0200, Ard Biesheuvel wrote: > > On Wed, 28 Aug 2024 at 14:57, Segher Boessenkool > > wrote: > > > > > > On Wed, Aug 28, 2024 at 12:24:12PM +, Arnd Bergmann wrote: > > > > On Wed, Aug 28, 20

Re: [PATCH] MAINTAINERS: Add selftests/x86 entry

2024-08-28 Thread Dave Hansen
On 6/9/24 22:28, Muhammad Usama Anjum wrote: > diff --git a/MAINTAINERS b/MAINTAINERS > index 523d84b2d6139..f3a17e5d954a3 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -24378,6 +24378,7 @@ T:git > git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/core > F: Documentation/a

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Stanislav Fomichev
On 08/28, Willem de Bruijn wrote: > Stanislav Fomichev wrote: > > On 08/27, Willem de Bruijn wrote: > > > From: Willem de Bruijn > > > > > > Lay the groundwork to import into kselftests the over 150 packetdrill > > > TCP/IP conformance tests on github.com/google/packetdrill. > > > > > > Florian

Re: [PATCH 07/16] powerpc: mm: Support MAP_BELOW_HINT

2024-08-28 Thread Charlie Jenkins
On Wed, Aug 28, 2024 at 08:34:49AM +0200, Christophe Leroy wrote: > Hi Charlie, > > Le 28/08/2024 à 07:49, Charlie Jenkins a écrit : > > Add support for MAP_BELOW_HINT to arch_get_mmap_base() and > > arch_get_mmap_end(). > > > > Signed-off-by: Charlie Jenkins > > --- > > arch/powerpc/include/a

Re: [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom

2024-08-28 Thread Segher Boessenkool
On Wed, Aug 28, 2024 at 07:12:55PM +0200, Ard Biesheuvel wrote: > On Wed, 28 Aug 2024 at 18:24, Segher Boessenkool > wrote: > > > In my experience, this is likely to do the opposite: it causes the > > > compiler to 'forget' the semantics of memcpy() and memset(), so that > > > explicit trivial cal

Re: [PATCH v11 25/39] arm64/signal: Expose GCS state in signal frames

2024-08-28 Thread Mark Brown
On Mon, Aug 26, 2024 at 01:00:09PM +0300, Catalin Marinas wrote: > On Fri, Aug 23, 2024 at 11:01:13PM +0100, Mark Brown wrote: > > On Fri, Aug 23, 2024 at 04:59:11PM +0100, Catalin Marinas wrote: > gcs_preserve_current_state() only a context switch thing. Would it work > if we don't touch the thre

Re: [PATCH 16/16] selftests/mm: Create MAP_BELOW_HINT test

2024-08-28 Thread Lorenzo Stoakes
On Tue, Aug 27, 2024 at 10:49:22PM GMT, Charlie Jenkins wrote: > Add a selftest for MAP_BELOW_HINT that maps until it runs out of space > below the hint address. > > Signed-off-by: Charlie Jenkins > --- > tools/testing/selftests/mm/Makefile | 1 + > tools/testing/selftests/mm/map_below_h

Re: [PATCH 16/16] selftests/mm: Create MAP_BELOW_HINT test

2024-08-28 Thread Charlie Jenkins
On Wed, Aug 28, 2024 at 06:48:33PM +0100, Lorenzo Stoakes wrote: > On Tue, Aug 27, 2024 at 10:49:22PM GMT, Charlie Jenkins wrote: > > Add a selftest for MAP_BELOW_HINT that maps until it runs out of space > > below the hint address. > > > > Signed-off-by: Charlie Jenkins > > --- > > tools/testing

Re: [PATCH 00/16] mm: Introduce MAP_BELOW_HINT

2024-08-28 Thread Lorenzo Stoakes
On Tue, Aug 27, 2024 at 10:49:06PM GMT, Charlie Jenkins wrote: > Some applications rely on placing data in free bits addresses allocated > by mmap. Various architectures (eg. x86, arm64, powerpc) restrict the > address returned by mmap to be less than the maximum address space, > unless the hint ad

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Jakub Kicinski
On Wed, 28 Aug 2024 10:20:47 -0700 Stanislav Fomichev wrote: > > As Jakub responded. > > > > Indeed importing the whole application into the kernel sources is what > > stopped me from attempting this before. Florian's nf_conntrack charted > > the path here. > > Thanks both. I was expecting to f

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Mina Almasry
On Tue, Aug 27, 2024 at 12:34 PM Willem de Bruijn wrote: > > From: Willem de Bruijn > > Lay the groundwork to import into kselftests the over 150 packetdrill > TCP/IP conformance tests on github.com/google/packetdrill. > > Florian recently added support for packetdrill tests in nf_conntrack, > in

Re: [PATCH 00/16] mm: Introduce MAP_BELOW_HINT

2024-08-28 Thread Dave Hansen
On 8/27/24 22:49, Charlie Jenkins wrote: > Some applications rely on placing data in free bits addresses allocated > by mmap. Various architectures (eg. x86, arm64, powerpc) restrict the > address returned by mmap to be less than the maximum address space, > unless the hint address is greater than

Re: [PATCH 00/16] mm: Introduce MAP_BELOW_HINT

2024-08-28 Thread Liam R. Howlett
* Charlie Jenkins [240828 01:49]: > Some applications rely on placing data in free bits addresses allocated > by mmap. Various architectures (eg. x86, arm64, powerpc) restrict the > address returned by mmap to be less than the maximum address space, > unless the hint address is greater than this v

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Stanislav Fomichev
On 08/28, Jakub Kicinski wrote: > On Wed, 28 Aug 2024 10:20:47 -0700 Stanislav Fomichev wrote: > > > As Jakub responded. > > > > > > Indeed importing the whole application into the kernel sources is what > > > stopped me from attempting this before. Florian's nf_conntrack charted > > > the path he

[net-next, v3 0/2] Adding SO_PEEK_OFF for TCPv6

2024-08-28 Thread jmaloy
From: Jon Maloy Adding SO_PEEK_OFF for TCPv6 and selftest for both TCPv4 and TCPv6 Jon Maloy (2): tcp: add SO_PEEK_OFF socket option tor TCPv6 selftests: add selftest for tcp SO_PEEK_OFF support net/ipv6/af_inet6.c | 1 + tools/testing/selftests/net/Makefile

[net-next, v3 1/2] tcp: add SO_PEEK_OFF socket option tor TCPv6

2024-08-28 Thread jmaloy
From: Jon Maloy When doing further testing of the recently added SO_PEEK_OFF feature for TCP I realized I had omitted to add it for TCP/IPv6. I do that here. Fixes: 05ea491641d3 ("tcp: add support for SO_PEEK_OFF socket option") Reviewed-by: Eric Dumazet Reviewed-by: David Gibson Reviewed-by:

[net-next, v3 2/2] selftests: add selftest for tcp SO_PEEK_OFF support

2024-08-28 Thread jmaloy
From: Jon Maloy We add a selftest to check that the new feature added in commit 05ea491641d3 ("tcp: add support for SO_PEEK_OFF socket option") works correctly. Reviewed-by: Jason Xing Reviewed-by: Stefano Brivio Tested-by: Stefano Brivio Signed-off-by: Jon Maloy --- v2: Made correction bas

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Jakub Kicinski
On Wed, 28 Aug 2024 11:26:28 -0700 Mina Almasry wrote: > I did not know about run_kselftest.sh. From a quick look, it seems to > require selftests to be installed to run them. I think nipa relies on > something slightly different, it does something like this, AFAIU this > runs an individual kselfte

Re: [PATCH nf-next v3 1/2] netfilter: Make IP_NF_IPTABLES_LEGACY selectable

2024-08-28 Thread Jakub Kicinski
On Wed, 28 Aug 2024 08:05:09 -0700 Breno Leitao wrote: > On Wed, Aug 28, 2024 at 07:42:40AM -0700, Jakub Kicinski wrote: > > On Tue, 27 Aug 2024 07:52:40 -0700 Breno Leitao wrote: > > > +++ b/tools/testing/selftests/net/config > > > > You gotta check all the configs, net is now fine, but bpf s

Re: [PATCH net-next v22 04/13] netdev: netdevice devmem allocator

2024-08-28 Thread Jakub Kicinski
On Wed, 28 Aug 2024 00:20:23 -0700 Mina Almasry wrote: > > On Sun, 25 Aug 2024 04:15:02 + Mina Almasry wrote: > > > +void net_devmem_free_dmabuf(struct net_iov *niov) > > > +{ > > > + struct net_devmem_dmabuf_binding *binding = net_iov_binding(niov); > > > + unsigned long dma_addr = n

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Willem de Bruijn
Jakub Kicinski wrote: > On Wed, 28 Aug 2024 10:03:55 -0400 Willem de Bruijn wrote: > > > > A single script is much > > > > simpler, optionally with nested KTAP (not supported yet by ksft). But, > > > > I'm afraid that running time without intermediate output will be very > > > > long when we integr

Re: [PATCH 00/16] mm: Introduce MAP_BELOW_HINT

2024-08-28 Thread Charlie Jenkins
On Wed, Aug 28, 2024 at 11:29:56AM -0700, Dave Hansen wrote: > On 8/27/24 22:49, Charlie Jenkins wrote: > > Some applications rely on placing data in free bits addresses allocated > > by mmap. Various architectures (eg. x86, arm64, powerpc) restrict the > > address returned by mmap to be less than

Re: [PATCH 00/16] mm: Introduce MAP_BELOW_HINT

2024-08-28 Thread Charlie Jenkins
On Wed, Aug 28, 2024 at 02:31:42PM -0400, Liam R. Howlett wrote: > * Charlie Jenkins [240828 01:49]: > > Some applications rely on placing data in free bits addresses allocated > > by mmap. Various architectures (eg. x86, arm64, powerpc) restrict the > > address returned by mmap to be less than th

Re: [PATCH net-next RFC] selftests/net: integrate packetdrill with ksft

2024-08-28 Thread Jakub Kicinski
On Wed, 28 Aug 2024 15:33:33 -0400 Willem de Bruijn wrote: > That could work. > > Is reporting one KTAP and exitcode per directory vs per packetdrill > invocation good/bad/neither? To me "neither", hopefully and unhelpfully I won't tell you anything that's not common sense :) The balance is betwe

Re: [PATCH 1/6] KVM: x86: selftests: Fix typos in macro variable use

2024-08-28 Thread Colton Lewis
Mingwei Zhang writes: On Tue, Aug 13, 2024, Colton Lewis wrote: Without the leading underscore, these variables are referencing a variable in the calling scope. It only worked before by accident because all calling scopes had a variable with the right name. Signed-off-by: Colton Lewis T

Re: [PATCH 00/16] mm: Introduce MAP_BELOW_HINT

2024-08-28 Thread Charlie Jenkins
On Wed, Aug 28, 2024 at 01:59:18PM -0700, Charlie Jenkins wrote: > On Wed, Aug 28, 2024 at 02:31:42PM -0400, Liam R. Howlett wrote: > > * Charlie Jenkins [240828 01:49]: > > > Some applications rely on placing data in free bits addresses allocated > > > by mmap. Various architectures (eg. x86, arm

Re: [PATCH 2/6] KVM: x86: selftests: Define AMD PMU CPUID leaves

2024-08-28 Thread Colton Lewis
Hi Mingwei, thanks for reviewing! Mingwei Zhang writes: On Tue, Aug 13, 2024, Colton Lewis wrote: This defined the CPUID calls to determine what extensions and properties are available. AMD reference manual names listed below. * PerfCtrExtCore (six core counters instead of four) * PerfCtrE

Re: [PATCH 3/6] KVM: x86: selftests: Set up AMD VM in pmu_counters_test

2024-08-28 Thread Colton Lewis
Hi Mingwei Mingwei Zhang writes: On Tue, Aug 13, 2024, Colton Lewis wrote: Branch in main() depending on if the CPU is Intel or AMD. They are subject to vastly different requirements because the AMD PMU lacks many properties defined by the Intel PMU including the entire CPUID 0xa function whe

[PATCH v1 1/2] mseal: fix mmap(FIXED) error code.

2024-08-28 Thread jeffxu
From: Jeff Xu mmap(MAP_FIXED) should return EPERM when memory is sealed. Fixes: 4205a39e06da ("mm/munmap: replace can_modify_mm with can_modify_vma") Signed-off-by: Jeff Xu --- mm/mmap.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/mmap.c b/mm/mmap.c index 80d70ed

[PATCH v1 2/2] selftests/mm: mseal_test add more tests

2024-08-28 Thread jeffxu
From: Jeff Xu Add more testcases and increase test coverage, e.g. add get_vma_size to check VMA size and prot bits. Signed-off-by: Jeff Xu --- tools/testing/selftests/mm/mseal_test.c | 826 ++-- 1 file changed, 759 insertions(+), 67 deletions(-) diff --git a/tools/testing/

Re: [PATCH 3/6] KVM: x86: selftests: Set up AMD VM in pmu_counters_test

2024-08-28 Thread Mingwei Zhang
On Wed, Aug 28, 2024 at 3:39 PM Colton Lewis wrote: > > Hi Mingwei > > Mingwei Zhang writes: > > > On Tue, Aug 13, 2024, Colton Lewis wrote: > >> Branch in main() depending on if the CPU is Intel or AMD. They are > >> subject to vastly different requirements because the AMD PMU lacks > >> many pr

[PATCH v12 00/39] arm64/gcs: Provide support for GCS in userspace

2024-08-28 Thread Mark Brown
The arm64 Guarded Control Stack (GCS) feature provides support for hardware protected stacks of return addresses, intended to provide hardening against return oriented programming (ROP) attacks and to make it easier to gather call stacks for applications such as profiling. When GCS is active a sec

[PATCH v12 01/39] mm: Introduce ARCH_HAS_USER_SHADOW_STACK

2024-08-28 Thread Mark Brown
Since multiple architectures have support for shadow stacks and we need to select support for this feature in several places in the generic code provide a generic config option that the architectures can select. Suggested-by: David Hildenbrand Acked-by: David Hildenbrand Reviewed-by: Deepak Gupt

[PATCH v12 02/39] arm64/mm: Restructure arch_validate_flags() for extensibility

2024-08-28 Thread Mark Brown
Currently arch_validate_flags() is written in a very non-extensible fashion, returning immediately if MTE is not supported and writing the MTE check as a direct return. Since we will want to add more checks for GCS refactor the existing code to be more extensible, no functional change intended. Re

[PATCH v12 03/39] prctl: arch-agnostic prctl for shadow stack

2024-08-28 Thread Mark Brown
Three architectures (x86, aarch64, riscv) have announced support for shadow stacks with fairly similar functionality. While x86 is using arch_prctl() to control the functionality neither arm64 nor riscv uses that interface so this patch adds arch-agnostic prctl() support to get and set status of s

[PATCH v12 04/39] mman: Add map_shadow_stack() flags

2024-08-28 Thread Mark Brown
In preparation for adding arm64 GCS support make the map_shadow_stack() SHADOW_STACK_SET_TOKEN flag generic and add _SET_MARKER. The existing flag indicates that a token usable for stack switch should be added to the top of the newly mapped GCS region while the new flag indicates that a top of stac

[PATCH v12 05/39] arm64: Document boot requirements for Guarded Control Stacks

2024-08-28 Thread Mark Brown
FEAT_GCS introduces a number of new system registers, we require that access to these registers is not trapped when we identify that the feature is present. There is also a HCRX_EL2 control to make GCS operations functional. Since if GCS is enabled any function call instruction will cause a fault

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

2024-08-28 Thread Mark Brown
Add some documentation of the userspace ABI for Guarded Control Stacks. Reviewed-by: Thiago Jung Bauermann Reviewed-by: Catalin Marinas Signed-off-by: Mark Brown --- Documentation/arch/arm64/gcs.rst | 230 + Documentation/arch/arm64/index.rst | 1 + 2 fi

[PATCH v12 07/39] arm64/sysreg: Add definitions for architected GCS caps

2024-08-28 Thread Mark Brown
The architecture defines a format for guarded control stack caps, used to mark the top of an unused GCS in order to limit the potential for exploitation via stack switching. Add definitions associated with these. Reviewed-by: Thiago Jung Bauermann Acked-by: Catalin Marinas Signed-off-by: Mark Br

[PATCH v12 08/39] arm64/gcs: Add manual encodings of GCS instructions

2024-08-28 Thread Mark Brown
Define C callable functions for GCS instructions used by the kernel. In order to avoid ambitious toolchain requirements for GCS support these are manually encoded, this means we have fixed register numbers which will be a bit limiting for the compiler but none of these should be used in sufficientl

[PATCH v12 09/39] arm64/gcs: Provide put_user_gcs()

2024-08-28 Thread Mark Brown
In order for EL1 to write to an EL0 GCS it must use the GCSSTTR instruction rather than a normal STTR. Provide a put_user_gcs() which does this. Reviewed-by: Thiago Jung Bauermann Reviewed-by: Catalin Marinas Signed-off-by: Mark Brown --- arch/arm64/include/asm/uaccess.h | 18 +

[PATCH v12 10/39] arm64/gcs: Provide basic EL2 setup to allow GCS usage at EL0 and EL1

2024-08-28 Thread Mark Brown
There is a control HCRX_EL2.GCSEn which must be set to allow GCS features to take effect at lower ELs and also fine grained traps for GCS usage at EL0 and EL1. Configure all these to allow GCS usage by EL0 and EL1. We also initialise GCSCR_EL1 and GCSCRE0_EL1 to ensure that we can execute functio

[PATCH v12 11/39] arm64/cpufeature: Runtime detection of Guarded Control Stack (GCS)

2024-08-28 Thread Mark Brown
Add a cpufeature for GCS, allowing other code to conditionally support it at runtime. Reviewed-by: Thiago Jung Bauermann Reviewed-by: Catalin Marinas Signed-off-by: Mark Brown --- arch/arm64/include/asm/cpufeature.h | 6 ++ arch/arm64/kernel/cpufeature.c | 9 + arch/arm64/tool

[PATCH v12 12/39] arm64/mm: Allocate PIE slots for EL0 guarded control stack

2024-08-28 Thread Mark Brown
Pages used for guarded control stacks need to be described to the hardware using the Permission Indirection Extension, GCS is not supported without PIE. In order to support copy on write for guarded stacks we allocate two values, one for active GCSs and one for GCS pages marked as read only prior t

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

2024-08-28 Thread Mark Brown
Use VM_HIGH_ARCH_5 for guarded control stack pages. Reviewed-by: Thiago Jung Bauermann Reviewed-by: Catalin Marinas Signed-off-by: Mark Brown --- Documentation/filesystems/proc.rst | 2 +- include/linux/mm.h | 12 +++- 2 files changed, 12 insertions(+), 2 deletions(-)

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

2024-08-28 Thread Mark Brown
Map pages flagged as being part of a GCS as such rather than using the full set of generic VM flags. This is done using a conditional rather than extending the size of protection_map since that would make for a very sparse array. Reviewed-by: Thiago Jung Bauermann Reviewed-by: Catalin Marinas S

[PATCH v12 15/39] KVM: arm64: Manage GCS access and registers for guests

2024-08-28 Thread Mark Brown
GCS introduces a number of system registers for EL1 and EL0, on systems with GCS we need to context switch them and expose them to VMMs to allow guests to use GCS. In order to allow guests to use GCS we also need to configure HCRX_EL2.GCSEn, if this is not set GCS instructions will be noops and CH

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

2024-08-28 Thread Mark Brown
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 Reviewed-by: Catalin Marinas Acked-by: Catalin Marinas Signed-off-by: Mark Brown --- Documentation/admin-guide/kernel-paramete

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

2024-08-28 Thread Mark Brown
Provide a hwcap to enable userspace to detect support for GCS. Reviewed-by: Thiago Jung Bauermann Reviewed-by: Catalin Marinas Signed-off-by: Mark Brown --- Documentation/arch/arm64/elf_hwcaps.rst | 2 ++ arch/arm64/include/asm/hwcap.h | 1 + arch/arm64/include/uapi/asm/hwcap.h |

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

2024-08-28 Thread Mark Brown
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_CPERR (protection error), mirroring the reporting for x86 shadow stack

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

2024-08-28 Thread Mark Brown
All GCS operations at EL0 must happen on a page which is marked as having UnprivGCS access, including read operations. If a GCS operation attempts to access a page without this then it will generate a data abort with the GCS bit set in ESR_EL1.ISS2. EL0 may validly generate such faults, for examp

  1   2   >