When a vDSO symbol is not found, all the testcases in vdso_test_abi usually
report a SKIP, which, in turn, is reported back to Kselftest as a PASS.
Testcase vdso_test_time, instead, reporting a SKIP, causes the whole set of
tests within vdso_test_abi to be considered FAIL when symbol is not found.
Fix it reporting a PASS when vdso_test_time cannot find the vdso symbol.
Signed-off-by: Cristian Marussi <cristian.marussi(a)arm.com>
---
Seen as a failure on both a JUNO and a Dragonboard on both recent and old
kernels/testruns:
root@deb-buster-arm64:~# /opt/ksft/vDSO/vdso_test_abi
[vDSO kselftest] VDSO_VERSION: LINUX_2.6.39
The time is 1637922136.675304
The time is 1637922136.675361000
The resolution is 0 1
clock_id: CLOCK_REALTIME [PASS]
The time is 1927.760604900
The resolution is 0 1
clock_id: CLOCK_BOOTTIME [PASS]
The time is 1637922136.675649700
The resolution is 0 1
clock_id: CLOCK_TAI [PASS]
The time is 1637922136.672000000
The resolution is 0 4000000
clock_id: CLOCK_REALTIME_COARSE [PASS]
The time is 1927.761005600
The resolution is 0 1
clock_id: CLOCK_MONOTONIC [PASS]
The time is 1927.761132780
The resolution is 0 1
clock_id: CLOCK_MONOTONIC_RAW [PASS]
The time is 1927.757093740
The resolution is 0 4000000
clock_id: CLOCK_MONOTONIC_COARSE [PASS]
Could not find __kernel_time <<< This caused a FAIL as a whole
root@deb-buster-arm64:~# echo $?
1
e.g.: https://lkft.validation.linaro.org/scheduler/job/2192570#L27778
---
tools/testing/selftests/vDSO/vdso_test_abi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/vDSO/vdso_test_abi.c b/tools/testing/selftests/vDSO/vdso_test_abi.c
index 3d603f1394af..7dcc66d1cecf 100644
--- a/tools/testing/selftests/vDSO/vdso_test_abi.c
+++ b/tools/testing/selftests/vDSO/vdso_test_abi.c
@@ -90,8 +90,9 @@ static int vdso_test_time(void)
(vdso_time_t)vdso_sym(version, name[2]);
if (!vdso_time) {
+ /* Skip if symbol not found: consider skipped tests as passed */
printf("Could not find %s\n", name[2]);
- return KSFT_SKIP;
+ return KSFT_PASS;
}
long ret = vdso_time(NULL);
--
2.17.1
There might be an arbitrary free open fd slot when we run the addfd
sub-test, so checking for progressive numbers of file descriptors
starting from memfd is not always a reliable check and we could get the
following failure:
# RUN global.user_notification_addfd ...
# seccomp_bpf.c:3989:user_notification_addfd:Expected listener (18) == nextfd++ (9)
# user_notification_addfd: Test terminated by assertion
Simply check if memfd and listener are valid file descriptors and start
counting for progressive file checking with the listener fd.
Fixes: 93e720d710df ("selftests/seccomp: More closely track fds being assigned")
Signed-off-by: Andrea Righi <andrea.righi(a)canonical.com>
---
tools/testing/selftests/seccomp/seccomp_bpf.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index d425688cf59c..4f37153378a1 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -3975,18 +3975,17 @@ TEST(user_notification_addfd)
/* There may be arbitrary already-open fds at test start. */
memfd = memfd_create("test", 0);
ASSERT_GE(memfd, 0);
- nextfd = memfd + 1;
ret = prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
ASSERT_EQ(0, ret) {
TH_LOG("Kernel does not support PR_SET_NO_NEW_PRIVS!");
}
- /* fd: 4 */
/* Check that the basic notification machinery works */
listener = user_notif_syscall(__NR_getppid,
SECCOMP_FILTER_FLAG_NEW_LISTENER);
- ASSERT_EQ(listener, nextfd++);
+ ASSERT_GE(listener, 0);
+ nextfd = listener + 1;
pid = fork();
ASSERT_GE(pid, 0);
--
2.32.0
As I work my way to unlocked and zero-copy TLS Rx the obvious bugs
in the splice_read implementation get harder and harder to ignore.
This is to say the fixes here are discovered by code inspection,
I'm not aware of anyone actually using splice_read.
Jakub Kicinski (9):
selftests: tls: add helper for creating sock pairs
selftests: tls: factor out cmsg send/receive
selftests: tls: add tests for handling of bad records
tls: splice_read: fix record type check
selftests: tls: test splicing cmsgs
tls: splice_read: fix accessing pre-processed records
selftests: tls: test splicing decrypted records
tls: fix replacing proto_ops
selftests: tls: test for correct proto_ops
net/tls/tls_main.c | 47 ++-
net/tls/tls_sw.c | 40 ++-
tools/testing/selftests/net/tls.c | 521 ++++++++++++++++++++++--------
3 files changed, 456 insertions(+), 152 deletions(-)
--
2.31.1
From: Joerg Vehlow <joerg.vehlow(a)aox-tech.de>
This fixes
make: *** No rule to make target 'tools/testing/selftests/exec/pipe', needed by 'all'. Stop.
Targets defined in TEST_DEN_FILES must exist as targets in the makefile,
but pipe is only created by the test at runtime, so it should be cleaned only.
Fixes: 61016db15b8e ("selftests/exec: Verify execve of non-regular files fail")
Signed-off-by: Joerg Vehlow <joerg.vehlow(a)aox-tech.de>
---
tools/testing/selftests/exec/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
index dd61118df66e..ac8acca7a942 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -5,14 +5,14 @@ CFLAGS += -D_GNU_SOURCE
TEST_PROGS := binfmt_script non-regular
TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216
-TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir pipe
+TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
# Makefile is a run-time dependency, since it's accessed by the execveat test
TEST_FILES := Makefile
TEST_GEN_PROGS += recursion-depth
EXTRA_CLEAN := $(OUTPUT)/subdir.moved $(OUTPUT)/execveat.moved $(OUTPUT)/xxxxx* \
- $(OUTPUT)/S_I*.test
+ $(OUTPUT)/S_I*.test $(OUTPUT)/pipe
include ../lib.mk
--
2.25.1
Here's the tenth revision of the simulator.
As there was no reasoning with configfs maintainers for many months,
this time the whole concept of committable items has been dropped. Instead,
each configfs chip item (or rather a group - more on that later) exposes a new
attribute called 'live'. Writing 1 to it brings the chip on-line (registers
the platform device) and writing 0 tears it down.
There are some caveats to that approach - for example: we can't block
the user-space from deleting chip items when chips are live but is just
handled by silently destroying the chip device in the background.
Andy (rightfully) pointed out that parsing of the lists of line names is
awkward so in this iteration it's been replaced by a system that is more
elegant and will allow to easily extend configuration options for
specific GPIO lines. This is achieved by turning the chip's configfs
item into a configfs group and allowing the user-space to create
additional items inside it. The items must be called line<offset> (e.g.
line0, line12 etc.) where the offset part indicates to the module the
offset for which given item stores the configuration for. Within each
such line item, there are additional attributes that allow specifying
configuration for specific lines.
In v10 there are additional significant changes:
Kent and Andy suggested that we should wait for probe() to finish and
propagate any errors to user-space. In this version that is implemented.
However there's no mechanism for propagating error codes from probe so
we always return -ENXIO to the user-space if probe fails. Thanks to this
approach, there's no longer need for using udev in user-space to wait
for the device to appear. Once we return from the write() to live, the
device is good to go.
The lines can now be hogged from the kernel-space. This will allow the
user-space to tests various use-cases involving busy lines without
having to use the very tested interface to take them in the first place.
I dropped the separate locks for lines because in most cases the chip
lock needed to be taken anyway. It simplified the locking in general a
lot.
The sysfs interface has been reworked. Instead of creating a single
group with a variable number of attributes (for each line) we go for a
separate group for each line and a constant number of attributes that
can be easily extended in the future.
v1 -> v2:
- add selftests for gpio-sim
- add helper programs for selftests
- update the configfs rename callback to work with the new API introduced in
v5.11
- fix a missing quote in the documentation
- use !! whenever using bits operation that are required to return 0 or 1
- use provided bitmap API instead of reimplementing copy or fill operations
- fix a deadlock in gpio_sim_direction_output()
- add new read-only configfs attributes for mapping of configfs items to GPIO
device names
- and address other minor issues pointed out in reviews of v1
v2 -> v3:
- use devm_bitmap_alloc() instead of the zalloc variant if we're initializing
the bitmap with 1s
- drop the patch exporting device_is_bound()
- don't return -ENODEV from dev_nam and chip_name configfs attributes, return
a string indicating that the device is not available yet ('n/a')
- fix indentation where it makes sense
- don't protect IDA functions which use their own locking and where it's not
needed
- use kmemdup() instead of kzalloc() + memcpy()
- collected review tags
- minor coding style fixes
v3 -> v4:
- return 'none' instead of 'n/a' from dev_name and chip_name before the device
is registered
- use sysfs_emit() instead of s*printf()
- drop GPIO_SIM_MAX_PROP as it's only used in an array's definition where it's
fine to hardcode the value
v4 -> v5:
- drop lib patches that are already upstream
- use BIT() instead of (1UL << bit) for flags
- fix refcounting for the configfs_dirent in rename()
- drop d_move() from the rename() callback
- free memory allocated for the live and pending groups in configfs_d_iput()
and not in detach_groups()
- make sure that if a group of some name is in the live directory, a new group
with the same name cannot be created in the pending directory
v5 -> v6:
- go back to using (1UL << bit) instead of BIT()
- if the live group dentry doesn't exist for whatever reason at the time when
mkdir() in the pending group is called (would be a BUG()), return -ENOENT
instead of -EEXIST which should only be returned if given subsystem already
exists in either live or pending group
v6 -> v7:
- as detailed by Andy in commit 6fda593f3082 ("gpio: mockup: Convert to use
software nodes") removing device properties after the platform device is
removed but before the GPIO device gets dropped can lead to a use-after-free
bug - use software nodes to manually control the freeing of the properties
v7 -> v8:
- fixed some minor coding style issues as pointed out by Andy
v8 -> v9:
- dropped the patches implementing committable-items and reworked the
driver to not use them
- reworked the gpio-line-names property and configuring specific lines
in general
- many smaller tweaks here and there
v9 -> v10:
- make writing to 'live' wait for the probe to finish and report an
error to user-space if it failed
- add the ability to hog lines from the kernel-space
- rework locking (drop separate locks for line context objects)
- rework the sysfs interface (create a separate group for each line with
a constant number of attributes instead of going the other way around)
Bartosz Golaszewski (5):
gpiolib: provide gpiod_remove_hogs()
gpio: sim: new testing module
selftests: gpio: provide a helper for reading chip info
selftests: gpio: add a helper for reading GPIO line names
selftests: gpio: add test cases for gpio-sim
Documentation/admin-guide/gpio/gpio-sim.rst | 80 +
drivers/gpio/Kconfig | 8 +
drivers/gpio/Makefile | 1 +
drivers/gpio/gpio-sim.c | 1370 +++++++++++++++++
drivers/gpio/gpiolib.c | 11 +
include/linux/gpio/machine.h | 2 +
tools/testing/selftests/gpio/.gitignore | 2 +
tools/testing/selftests/gpio/Makefile | 4 +-
tools/testing/selftests/gpio/config | 1 +
tools/testing/selftests/gpio/gpio-chip-info.c | 57 +
tools/testing/selftests/gpio/gpio-line-name.c | 55 +
tools/testing/selftests/gpio/gpio-sim.sh | 306 ++++
12 files changed, 1895 insertions(+), 2 deletions(-)
create mode 100644 Documentation/admin-guide/gpio/gpio-sim.rst
create mode 100644 drivers/gpio/gpio-sim.c
create mode 100644 tools/testing/selftests/gpio/gpio-chip-info.c
create mode 100644 tools/testing/selftests/gpio/gpio-line-name.c
create mode 100755 tools/testing/selftests/gpio/gpio-sim.sh
--
2.25.1