The test case for SME vector length changes via sigreturn use a bit too
much cut'n'paste and only actually changed the SVE vector length in the
test itself. Andre's recent factoring out of the initialisation code caused
this to be exposed and the test to start failing. Fix the test to actually
cover the thing it's supposed to test.
Fixes: 4963aeb35a9e ("kselftest/arm64: signal: Add SME signal handling tests")
Signed-off-by: Mark Brown <broonie(a)kernel.org>
---
.../arm64/signal/testcases/fake_sigreturn_sme_change_vl.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/arm64/signal/testcases/fake_sigreturn_sme_change_vl.c b/tools/testing/selftests/arm64/signal/testcases/fake_sigreturn_sme_change_vl.c
index cb8c051b5c8f..dfd6a2badf9f 100644
--- a/tools/testing/selftests/arm64/signal/testcases/fake_sigreturn_sme_change_vl.c
+++ b/tools/testing/selftests/arm64/signal/testcases/fake_sigreturn_sme_change_vl.c
@@ -35,30 +35,30 @@ static int fake_sigreturn_ssve_change_vl(struct tdescr *td,
{
size_t resv_sz, offset;
struct _aarch64_ctx *head = GET_SF_RESV_HEAD(sf);
- struct sve_context *sve;
+ struct za_context *za;
/* Get a signal context with a SME ZA frame in it */
if (!get_current_context(td, &sf.uc, sizeof(sf.uc)))
return 1;
resv_sz = GET_SF_RESV_SIZE(sf);
- head = get_header(head, SVE_MAGIC, resv_sz, &offset);
+ head = get_header(head, ZA_MAGIC, resv_sz, &offset);
if (!head) {
- fprintf(stderr, "No SVE context\n");
+ fprintf(stderr, "No ZA context\n");
return 1;
}
- if (head->size != sizeof(struct sve_context)) {
+ if (head->size != sizeof(struct za_context)) {
fprintf(stderr, "Register data present, aborting\n");
return 1;
}
- sve = (struct sve_context *)head;
+ za = (struct za_context *)head;
/* No changes are supported; init left us at minimum VL so go to max */
fprintf(stderr, "Attempting to change VL from %d to %d\n",
- sve->vl, vls[0]);
- sve->vl = vls[0];
+ za->vl, vls[0]);
+ za->vl = vls[0];
fake_sigreturn(&sf, sizeof(sf), 0);
---
base-commit: b18bbfc14a38b5234e09c2adcf713e38063a7e6e
change-id: 20240829-arm64-sme-signal-vl-change-test-cebe4035856a
Best regards,
--
Mark Brown <broonie(a)kernel.org>
Unlike the check for the standalone x86 test the check for building the
vDSO getrandom and chacaha tests looks at the architecture for the host
rather than the architecture for the target when deciding if they should
be built. Since the chacha test includes some assembler code this means
that cross building with x86 as either the target or host is broken. Use
a check for ARCH instead.
Fixes: 4920a2590e91 ("selftests/vDSO: add tests for vgetrandom")
Signed-off-by: Mark Brown <broonie(a)kernel.org>
---
The x86_64 build is still broken for me because nothing installs
tools/arch/x86_64/vdso/vgetrandom-chacha.S (I beleive it's supposed to
be copied from ./arch/x86/entry/vdso/vgetrandom-chacha.S but I don't see
how?) but this at least fixes all the other architectures.
---
tools/testing/selftests/vDSO/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/Makefile b/tools/testing/selftests/vDSO/Makefile
index e21e78aae24d..7fb59310718c 100644
--- a/tools/testing/selftests/vDSO/Makefile
+++ b/tools/testing/selftests/vDSO/Makefile
@@ -10,7 +10,7 @@ ifeq ($(ARCH),$(filter $(ARCH),x86 x86_64))
TEST_GEN_PROGS += vdso_standalone_test_x86
endif
TEST_GEN_PROGS += vdso_test_correctness
-ifeq ($(uname_M),x86_64)
+ifeq ($(ARCH),$(filter $(ARCH),x86_64))
TEST_GEN_PROGS += vdso_test_getrandom
TEST_GEN_PROGS += vdso_test_chacha
endif
---
base-commit: 985bf40edf4343dcb04c33f58b40b4a85c1776d4
change-id: 20240830-vdso-chacha-build-8d3789bf695c
Best regards,
--
Mark Brown <broonie(a)kernel.org>
From: Jeff Xu <jeffxu(a)chromium.org>
This series increase the test coverage of mseal_test by:
Add check for vma_size, prot, and error code for existing tests.
Add more testcases for madvise, munmap, mmap and mremap to cover
sealing in different scenarios.
The increase test coverage hopefully help to prevent future regression.
It doesn't change any existing mm api's semantics, i.e. it will pass on
linux main and 6.10 branch.
Note: in order to pass this test in mm-unstable, mm-unstable must have
Liam's fix on mmap [1]
[1] https://lore.kernel.org/linux-kselftest/vyllxuh5xbqmaoyl2mselebij5ox7cseekj…
History:
V2:
- remove the mmap fix (Liam R. Howlett will fix it separately)
- Add cover letter (Lorenzo Stoakes)
- split the testcase for ease of review (Mark Brown)
V1:
- https://lore.kernel.org/linux-kselftest/20240828225522.684774-1-jeffxu@chro…
Jeff Xu (4):
selftests/mm: mseal_test, add vma size check
selftests/mm: mseal_test add sealed madvise type
selftests/mm: mseal_test add more tests for mmap
selftests/mm: mseal_test add more tests for mremap
tools/testing/selftests/mm/mseal_test.c | 829 ++++++++++++++++++++++--
1 file changed, 762 insertions(+), 67 deletions(-)
--
2.46.0.469.g59c65b2a67-goog
This patch series adds a some not yet picked selftests to the kvm s390x
selftest suite.
The additional test cases are covering:
* Assert KVM_EXIT_S390_UCONTROL exit on not mapped memory access
* Assert functionality of storage keys in ucontrol VM
* Assert that memory region operations are rejected for ucontrol VMs
Running the test cases requires sys_admin capabilities to start the
ucontrol VM.
This can be achieved by running as root or with a command like:
sudo setpriv --reuid nobody --inh-caps -all,+sys_admin \
--ambient-caps -all,+sys_admin --bounding-set -all,+sys_admin \
./ucontrol_test
---
The patches in this series have been part of the previous patch series.
The test cases added here do depend on the fixture added in the earlier patches.
From v5 PATCH 7-9 the segment and page table generation has been removed and DAT
has been disabled. Since DAT is not necessary to validate the KVM code.
Previeous series:
https://lore.kernel.org/kvm/20240807154512.316936-1-schlameuss@linux.ibm.co…
Also see:
https://lore.kernel.org/kvm/d97f4dec-31c3-45c0-ac33-90e665eb6e99@linux.ibm.…
Christoph Schlameuss (3):
selftests: kvm: s390: Add uc_map_unmap VM test case
selftests: kvm: s390: Add uc_skey VM test case
selftests: kvm: s390: Verify reject memory region operations for
ucontrol VMs
.../selftests/kvm/s390x/ucontrol_test.c | 218 +++++++++++++++++-
1 file changed, 217 insertions(+), 1 deletion(-)
--
2.46.0
This series wires up getrandom() vDSO implementation on powerpc.
Tested on PPC32.
Performance on powerpc 885 (using kernel selftest):
~# ./vdso_test_getrandom bench-single
vdso: 2500000 times in 7.897495392 seconds
libc: 2500000 times in 56.091632232 seconds
syscall: 2500000 times in 55.704851989 seconds
Performance on powerpc 8321 (using kernel selftest):
~# ./vdso_test_getrandom bench-single
vdso: 2500000 times in 2.017183250 seconds
libc: 2500000 times in 13.088533630 seconds
syscall: 2500000 times in 12.952458068 seconds
Only build tested on PPC64. There is a problem with vdso_test_getrandom
selftest, it doesn't find vDSO symbol __kernel_getrandom. There is the
same problem with vdso_test_gettimeofday so it is not related to
getrandom.
On strange things to be clarified, there is the format of the key passed
to __arch_chacha20_blocks_nostack(). In struct vgetrandom_state it is
declared as a table of u32, but in reality it seems it is a flat storage
that needs to be loaded in reversed byte order, so it should either be
defined as a table of bytes, or as a table of __le32 but not a table of
u32. But this has no impact and can be clarified later and fixed in a
follow-up patch.
Changes in v2:
- Define VM_DROPPABLE for powerpc/32
- Fixes generic vDSO getrandom headers to enable CONFIG_COMPAT build.
- Fixed size of generation counter
- Fixed selftests to work on non x86 architectures
Christophe Leroy (17):
asm-generic/unaligned.h: Extract common header for vDSO
vdso: Clean header inclusion in getrandom
vdso: Add __arch_get_k_vdso_rng_data()
vdso: Add missing c-getrandom-y in Makefile
vdso: Avoid call to memset() by getrandom
vdso: Change getrandom's generation to unsigned long
mm: Define VM_DROPPABLE for powerpc/32
powerpc: Add little endian variants of LWZX_BE and STWX_BE
powerpc/vdso32: Add crtsavres
powerpc/vdso: Refactor CFLAGS for CVDSO build
powerpc/vdso: Wire up getrandom() vDSO implementation
selftests: vdso: Fix powerpc64 vdso_config
selftests: vdso: Don't hard-code location of vDSO sources
selftests: vdso: Make test_vdso_getrandom look for the right vDSO
function
selftests: vdso: Fix build of test_vdso_chacha
selftests: vdso: Make VDSO function call more generic
selftests: vdso: Add support for vdso_test_random for powerpc
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/asm-compat.h | 8 +
arch/powerpc/include/asm/mman.h | 2 +-
arch/powerpc/include/asm/vdso/getrandom.h | 67 ++++
arch/powerpc/include/asm/vdso/vsyscall.h | 6 +
arch/powerpc/include/asm/vdso_datapage.h | 2 +
arch/powerpc/kernel/asm-offsets.c | 1 +
arch/powerpc/kernel/vdso/Makefile | 45 ++-
arch/powerpc/kernel/vdso/getrandom.S | 58 ++++
arch/powerpc/kernel/vdso/gettimeofday.S | 13 -
arch/powerpc/kernel/vdso/vdso32.lds.S | 1 +
arch/powerpc/kernel/vdso/vdso64.lds.S | 1 +
arch/powerpc/kernel/vdso/vgetrandom-chacha.S | 297 ++++++++++++++++++
arch/powerpc/kernel/vdso/vgetrandom.c | 14 +
arch/x86/entry/vdso/vma.c | 3 +
arch/x86/include/asm/pvclock.h | 1 +
arch/x86/include/asm/vdso/vsyscall.h | 10 +-
drivers/char/random.c | 5 +-
fs/proc/task_mmu.c | 4 +-
include/asm-generic/unaligned.h | 11 +-
include/linux/mm.h | 4 +-
include/trace/events/mmflags.h | 4 +-
include/vdso/datapage.h | 2 +-
include/vdso/getrandom.h | 2 +-
include/vdso/helpers.h | 1 +
include/vdso/unaligned.h | 15 +
lib/vdso/Makefile | 1 +
lib/vdso/getrandom.c | 30 +-
tools/arch/powerpc/vdso | 1 +
tools/arch/x86/vdso | 1 +
tools/include/linux/linkage.h | 4 +
tools/testing/selftests/vDSO/Makefile | 12 +-
tools/testing/selftests/vDSO/vdso_call.h | 52 +++
tools/testing/selftests/vDSO/vdso_config.h | 14 +-
.../selftests/vDSO/vdso_test_getrandom.c | 11 +-
35 files changed, 628 insertions(+), 76 deletions(-)
create mode 100644 arch/powerpc/include/asm/vdso/getrandom.h
create mode 100644 arch/powerpc/kernel/vdso/getrandom.S
create mode 100644 arch/powerpc/kernel/vdso/vgetrandom-chacha.S
create mode 100644 arch/powerpc/kernel/vdso/vgetrandom.c
create mode 100644 include/vdso/unaligned.h
create mode 120000 tools/arch/powerpc/vdso
create mode 120000 tools/arch/x86/vdso
create mode 100644 tools/testing/selftests/vDSO/vdso_call.h
--
2.44.0