When building with clang, via:
make LLVM=1 -C tools/testing/selftests
...there are several warnings, and an error. This fixes all of those and
allows these tests to run and pass.
1. Fix linker error (undefined reference to memcpy) by providing a local
version of memcpy.
2. clang complains about using this form:
if (g = h & 0xf0000000)
...so factor out the assignment into a separate step.
3. The code is passing a signed const char* to elf_hash(), which expects
a const unsigned char *. There are several callers, so fix this at
the source by allowing the function to accept a signed argument, and
then converting to unsigned operations, once inside the function.
4. clang doesn't have __attribute__((externally_visible)) and generates
a warning to that effect. Fortunately, gcc 12 and gcc 13 do not seem
to require that attribute in order to build, run and pass tests here,
so remove it.
[1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1…
Signed-off-by: John Hubbard <jhubbard(a)nvidia.com>
---
Changes since the first version:
1) Rebased onto Linux 6.10-rc1
thanks,
John Hubbard
tools/testing/selftests/vDSO/parse_vdso.c | 16 +++++++++++-----
.../selftests/vDSO/vdso_standalone_test_x86.c | 18 ++++++++++++++++--
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
index 413f75620a35..4ae417372e9e 100644
--- a/tools/testing/selftests/vDSO/parse_vdso.c
+++ b/tools/testing/selftests/vDSO/parse_vdso.c
@@ -55,14 +55,20 @@ static struct vdso_info
ELF(Verdef) *verdef;
} vdso_info;
-/* Straight from the ELF specification. */
-static unsigned long elf_hash(const unsigned char *name)
+/*
+ * Straight from the ELF specification...and then tweaked slightly, in order to
+ * avoid a few clang warnings.
+ */
+static unsigned long elf_hash(const char *name)
{
unsigned long h = 0, g;
- while (*name)
+ const unsigned char *uch_name = (const unsigned char *)name;
+
+ while (*uch_name)
{
- h = (h << 4) + *name++;
- if (g = h & 0xf0000000)
+ h = (h << 4) + *uch_name++;
+ g = h & 0xf0000000;
+ if (g)
h ^= g >> 24;
h &= ~g;
}
diff --git a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c
index 8a44ff973ee1..27f6fdf11969 100644
--- a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c
+++ b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c
@@ -18,7 +18,7 @@
#include "parse_vdso.h"
-/* We need a libc functions... */
+/* We need some libc functions... */
int strcmp(const char *a, const char *b)
{
/* This implementation is buggy: it never returns -1. */
@@ -34,6 +34,20 @@ int strcmp(const char *a, const char *b)
return 0;
}
+/*
+ * The clang build needs this, although gcc does not.
+ * Stolen from lib/string.c.
+ */
+void *memcpy(void *dest, const void *src, size_t count)
+{
+ char *tmp = dest;
+ const char *s = src;
+
+ while (count--)
+ *tmp++ = *s++;
+ return dest;
+}
+
/* ...and two syscalls. This is x86-specific. */
static inline long x86_syscall3(long nr, long a0, long a1, long a2)
{
@@ -70,7 +84,7 @@ void to_base10(char *lastdig, time_t n)
}
}
-__attribute__((externally_visible)) void c_main(void **stack)
+void c_main(void **stack)
{
/* Parse the stack */
long argc = (long)*stack;
base-commit: 2bfcfd584ff5ccc8bb7acde19b42570414bf880b
--
2.45.1
The following selftests: arm64 tests failed on FVP-aemva test and kernel
built with gcc-13 but pass with clang.
arm64_fp-stress_KERNEL-1-0/3-0/4-0/6-0 - gcc-13 - Failed
arm64_fp-stress_KERNEL-1-0/3-0/4-0/6-0 - clang-18 - Pass
Reported-by: Linux Kernel Functional Testing <lkft(a)linaro.org>
Test log:
---------
# timeout set to 45
# selftests: arm64: fp-stress
[ 269.882519] NET: Registered PF_ALG protocol family
# TAP version 13
# 1..96
# # 8 CPUs, 3 SVE VLs, 3 SME VLs, SME2 present
# # Will run for 10s
# # Started FPSIMD-0-0
# # Started KERNEL-0-0
# # Started SVE-VL-64-0
...
# ok 13 FPSIMD-1-0
# # KERNEL-1-0 exited with error code 1
# not ok 14 KERNEL-1-0
# ok 15 SVE-VL-64-1
...
# ok 37 FPSIMD-3-0
# # KERNEL-3-0 exited with error code 1
# not ok 38 KERNEL-3-0
# ok 39 SVE-VL-64-3
...
# ok 49 FPSIMD-4-0
# # KERNEL-4-0 exited with error code 1
# not ok 50 KERNEL-4-0
# ok 51 SVE-VL-64-4
...
# ok 73 FPSIMD-6-0
# # KERNEL-6-0 exited with error code 1
# not ok 74 KERNEL-6-0
# ok 75 SVE-VL-64-6
...
# # Totals: pass:92 fail:4 xfail:0 xpass:0 skip:0 error:0
ok 16 selftests: arm64: fp-stress
metadata:
------
git_describe: next-20240613
git_ref: master
git_repo: https://gitlab.com/Linaro/lkft/mirrors/next/linux-next
git_sha: 6906a84c482f098d31486df8dc98cead21cce2d0
git_short_log: 6906a84c482f ("Add linux-next specific files for 20240613")
arch: arm64
test-environment: fvp-aemva
toolchain: gcc-13
Links:
- https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20240613/te…
- https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20240613/te…
--
Linaro LKFT
https://lkft.linaro.org
Hi,
this is a patch set as a follow up of the thread about the errors
reported by kselftest mixer-test. It changes HD-audio and vmaster
control behavior to return -EINVAL for invalid input values.
There is a change in kselftest itself to skip the write tests for
volatile controls, too. It's for the channel map controls that can't
hold the stable values.
Takashi
===
Takashi Iwai (5):
ALSA: vmaster: Return error for invalid input values
ALSA: hda: Return -EINVAL for invalid volume/switch inputs
ALSA: control: Apply sanity check of input values for user elements
kselftest/alsa: mixer-test: Skip write tests for volatile controls
ALSA: chmap: Mark Channel Map controls as volatile
sound/core/control.c | 3 ++-
sound/core/pcm_lib.c | 1 +
sound/core/vmaster.c | 8 ++++++++
sound/pci/hda/hda_codec.c | 23 ++++++++++++++++++-----
tools/testing/selftests/alsa/mixer-test.c | 21 +++++++++++++++++++++
5 files changed, 50 insertions(+), 6 deletions(-)
--
2.43.0
Define a maximum allowable number of pids that can be livepatched in
test-syscall.sh as with extremely large machines the output from a
large number of processes overflows the dev/kmsg "expect" buffer in
the "check_result" function and causes a false error.
Reported-by: CKI Project <cki-project(a)redhat.com>
Signed-off-by: Ryan Sullivan <rysulliv(a)redhat.com>
---
tools/testing/selftests/livepatch/test-syscall.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/livepatch/test-syscall.sh b/tools/testing/selftests/livepatch/test-syscall.sh
index b76a881d4013..289eb7d4c4b3 100755
--- a/tools/testing/selftests/livepatch/test-syscall.sh
+++ b/tools/testing/selftests/livepatch/test-syscall.sh
@@ -15,7 +15,10 @@ setup_config
start_test "patch getpid syscall while being heavily hammered"
-for i in $(seq 1 $(getconf _NPROCESSORS_ONLN)); do
+NPROC=$(getconf _NPROCESSORS_ONLN)
+MAXPROC=128
+
+for i in $(seq 1 $(($NPROC < $MAXPROC ? $NPROC : $MAXPROC))); do
./test_klp-call_getpid &
pids[$i]="$!"
done
--
2.44.0
Dear Linux folks,
Running the ALSA kselftests with Linux 6.10-rc1, `mixer-test` shows ten
failures:
# Totals: pass:24 fail:0 xfail:0 xpass:0 skip:11 error:0
These are:
not ok 5 write_invalid.0.40
not ok 11 write_valid.0.39
not ok 18 write_valid.0.38
not ok 25 write_valid.0.37
not ok 201 write_invalid.0.12
not ok 208 write_invalid.0.11
not ok 264 write_invalid.0.3
not ok 271 write_invalid.0.2
not ok 278 write_invalid.0.1
not ok 285 write_invalid.0.0
`./pcm-test` finishes with 5 out of 5 passes.
The output `sudo alsa-info` is uploaded to the database [1], and the
full output of `mixer-test` is attached.
Kind regards,
Paul
[1]: https://alsa-project.org/db/?f=cf8e1e0f37775448b5e3361e5c3cd4d4e6037d4f
Eventually, once the build succeeds on a sufficiently old distro, the
idea is to delete $(KHDR_INCLUDES) from the selftests/mm build, and then
after that, from selftests/lib.mk and all of the other selftest builds.
For now, this series merely achieves a clean build of selftests/mm on a
not-so-old distro: Ubuntu 23.04:
1. Add __NR_mseal.
2. Add fs.h, taken as usual from a snapshot of ./usr/include/linux/fs.h
after running "make headers". This is how we have agreed to do this sort
of thing, see [1].
3. Add a few selected prctl.h values that the ksm and mdwe tests require.
[1] commit e076eaca5906 ("selftests: break the dependency upon local
header files")
John Hubbard (5):
selftests/mm: mseal, self_elf: fix missing __NR_mseal
selftests/mm: fix vm_util.c build failures: add snapshot of fs.h
mm/selftests: kvm, mdwe fixes to avoid requiring "make headers"
selftests/mm: mseal, self_elf: factor out test macros and other
duplicated items
selftests/mm: mseal, self_elf: rename TEST_END_CHECK to
REPORT_TEST_PASS
tools/include/uapi/linux/fs.h | 392 +++++++++++++++++++++
tools/testing/selftests/mm/mdwe_test.c | 1 +
tools/testing/selftests/mm/mseal_helpers.h | 45 +++
tools/testing/selftests/mm/mseal_test.c | 141 +++-----
tools/testing/selftests/mm/seal_elf.c | 35 +-
tools/testing/selftests/mm/vm_util.h | 15 +
6 files changed, 502 insertions(+), 127 deletions(-)
create mode 100644 tools/include/uapi/linux/fs.h
create mode 100644 tools/testing/selftests/mm/mseal_helpers.h
base-commit: 8a92980606e3585d72d510a03b59906e96755b8a
--
2.45.2
This patch addresses the TODO (add non fixed feature on/off check).
I have tested it manually on my system and made changes as suggested in v1
Signed-off-by: Abhinav Jain <jain.abhinav177(a)gmail.com>
---
PATCH v1:
https://lore.kernel.org/all/20240606212714.27472-1-jain.abhinav177@gmail.co…
Changes since v1:
- Removed the addition of tail command as it was not required after
below change
- Used read to parse the temp features file rather than using for loop
and took out awk/grep/sed from v1
---
tools/testing/selftests/net/netdevice.sh | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/netdevice.sh b/tools/testing/selftests/net/netdevice.sh
index e3afcb424710..196b7f985db4 100755
--- a/tools/testing/selftests/net/netdevice.sh
+++ b/tools/testing/selftests/net/netdevice.sh
@@ -124,7 +124,27 @@ kci_netdev_ethtool()
return 1
fi
echo "PASS: $netdev: ethtool list features"
- #TODO for each non fixed features, try to turn them on/off
+
+ while read -r FEATURE VALUE FIXED; do
+ [ "$FEATURE" != "Features" ] || continue # Skip "Features" line
+ [ "$FIXED" != "[fixed]" ] || continue # Skip fixed features
+ feature = "${FEATURE%:*}"
+
+ ethtool --offload "$netdev" "$feature" off
+ if [ $? -eq 0 ]; then
+ echo "PASS: $netdev: Turned off feature: $feature"
+ else
+ echo "FAIL: $netdev: Failed to turn off feature: $feature"
+ fi
+
+ ethtool --offload "$netdev" "$feature" on
+ if [ $? -eq 0 ]; then
+ echo "PASS: $netdev: Turned on feature: $feature"
+ else
+ echo "FAIL: $netdev: Failed to turn on feature: $feature"
+ fi
+ done < "$TMP_ETHTOOL_FEATURES"
+
rm "$TMP_ETHTOOL_FEATURES"
kci_netdev_ethtool_test 74 'dump' "ethtool -d $netdev"
--
2.34.1
The purpose of this series is to rethink how HID-BPF is invoked.
Currently it implies a jmp table, a prog fd bpf_map, a preloaded tracing
bpf program and a lot of manual work for handling the bpf program
lifetime and addition/removal.
OTOH, bpf_struct_ops take care of most of the bpf handling leaving us
with a simple list of ops pointers, and we can directly call the
struct_ops program from the kernel as a regular function.
The net gain right now is in term of code simplicity and lines of code
removal (though is an API breakage), but udev-hid-bpf is able to handle
such breakages.
In the near future, we will be able to extend the HID-BPF struct_ops
with entrypoints for hid_hw_raw_request() and hid_hw_output_report(),
allowing for covering all of the initial use cases:
- firewalling a HID device
- fixing all of the HID device interactions (not just device events as
it is right now).
The matching user-space loader (udev-hid-bpf) MR is at
https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/merge_requests/86
I'll put it out of draft once this is merged.
Cheers,
Benjamin
Signed-off-by: Benjamin Tissoires <bentiss(a)kernel.org>
---
Changes in v3:
- took Alexei's review into account
- Link to v2: https://lore.kernel.org/r/20240607-hid_bpf_struct_ops-v2-0-3f95f4d02292@ker…
Changes in v2:
- drop HID_BPF_FLAGS enum and use BPF_F_BEFORE instead
- fix .init_members to not open code member->offset
- allow struct hid_device to be writeable from HID-BPF for its name,
uniq and phys
- Link to v1: https://lore.kernel.org/r/20240528-hid_bpf_struct_ops-v1-0-8c6663df27d8@ker…
---
Benjamin Tissoires (16):
HID: rename struct hid_bpf_ops into hid_ops
HID: bpf: add hid_get/put_device() helpers
HID: bpf: implement HID-BPF through bpf_struct_ops
selftests/hid: convert the hid_bpf selftests with struct_ops
HID: samples: convert the 2 HID-BPF samples into struct_ops
HID: bpf: add defines for HID-BPF SEC in in-tree bpf fixes
HID: bpf: convert in-tree fixes into struct_ops
HID: bpf: remove tracing HID-BPF capability
selftests/hid: add subprog call test
Documentation: HID: amend HID-BPF for struct_ops
Documentation: HID: add a small blurb on udev-hid-bpf
HID: bpf: Artist24: remove unused variable
HID: bpf: error on warnings when compiling bpf objects
bpf: allow bpf helpers to be used into HID-BPF struct_ops
HID: bpf: rework hid_bpf_ops_btf_struct_access
HID: bpf: make part of struct hid_device writable
Documentation/hid/hid-bpf.rst | 173 ++++---
drivers/hid/bpf/Makefile | 2 +-
drivers/hid/bpf/entrypoints/Makefile | 93 ----
drivers/hid/bpf/entrypoints/README | 4 -
drivers/hid/bpf/entrypoints/entrypoints.bpf.c | 25 -
drivers/hid/bpf/entrypoints/entrypoints.lskel.h | 248 ---------
drivers/hid/bpf/hid_bpf_dispatch.c | 266 +++-------
drivers/hid/bpf/hid_bpf_dispatch.h | 12 +-
drivers/hid/bpf/hid_bpf_jmp_table.c | 565 ---------------------
drivers/hid/bpf/hid_bpf_struct_ops.c | 298 +++++++++++
drivers/hid/bpf/progs/FR-TEC__Raptor-Mach-2.bpf.c | 9 +-
drivers/hid/bpf/progs/HP__Elite-Presenter.bpf.c | 6 +-
drivers/hid/bpf/progs/Huion__Kamvas-Pro-19.bpf.c | 9 +-
.../hid/bpf/progs/IOGEAR__Kaliber-MMOmentum.bpf.c | 6 +-
drivers/hid/bpf/progs/Makefile | 2 +-
.../hid/bpf/progs/Microsoft__XBox-Elite-2.bpf.c | 6 +-
drivers/hid/bpf/progs/Wacom__ArtPen.bpf.c | 6 +-
drivers/hid/bpf/progs/XPPen__Artist24.bpf.c | 10 +-
drivers/hid/bpf/progs/XPPen__ArtistPro16Gen2.bpf.c | 24 +-
drivers/hid/bpf/progs/hid_bpf.h | 5 +
drivers/hid/hid-core.c | 6 +-
include/linux/hid_bpf.h | 119 +++--
samples/hid/Makefile | 5 +-
samples/hid/hid_bpf_attach.bpf.c | 18 -
samples/hid/hid_bpf_attach.h | 14 -
samples/hid/hid_mouse.bpf.c | 26 +-
samples/hid/hid_mouse.c | 39 +-
samples/hid/hid_surface_dial.bpf.c | 10 +-
samples/hid/hid_surface_dial.c | 53 +-
tools/testing/selftests/hid/hid_bpf.c | 100 +++-
tools/testing/selftests/hid/progs/hid.c | 100 +++-
.../testing/selftests/hid/progs/hid_bpf_helpers.h | 19 +-
32 files changed, 800 insertions(+), 1478 deletions(-)
---
base-commit: 70ec81c2e2b4005465ad0d042e90b36087c36104
change-id: 20240513-hid_bpf_struct_ops-e3212a224555
Best regards,
--
Benjamin Tissoires <bentiss(a)kernel.org>