From: Mirsad Goran Todorovac <mirsad.todorovac(a)alu.unizg.hr>
Adjust size parameter in connect() to match the type of the parameter, to fix "No such file or directory"
error in selftests/net/af_unix/test_oob_unix.c:127.
The existing code happens to work provided that the autogenerated pathname is shorter than
sizeof (struct sockaddr), which is why it hasn't been noticed earlier.
Visible from the trace excerpt:
bind(3, {sa_family=AF_UNIX, sun_path="unix_oob_453059"}, 110) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7fa6a6577a10) = 453060
[pid <child>] connect(6, {sa_family=AF_UNIX, sun_path="unix_oob_45305"}, 16) = -1 ENOENT (No such file or directory)
BUG: The filename is trimmed to sizeof (struct sockaddr).
The patch is generated against the "vanilla" torvalds mainline tree 6.2-rc2.
Thanks and regards,
Mirsad Todorovac
Reported-by: Mirsad Goran Todorovac <mirsad.todorovac(a)alu.unizg.hr>
Cc: "David S. Miller" <davem(a)davemloft.net>
Cc: Eric Dumazet <edumazet(a)google.com>
Cc: Jakub Kicinski <kuba(a)kernel.org>
Cc: Paolo Abeni <pabeni(a)redhat.com>
Cc: Shuah Khan <shuah(a)kernel.org>
Cc: Kuniyuki Iwashima <kuniyu(a)amazon.co.jp>
Cc: Florian Westphal <fw(a)strlen.de>
Reviewed-by: Florian Westphal <fw(a)strlen.de>
---
tools/testing/selftests/net/af_unix/test_unix_oob.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/af_unix/test_unix_oob.c b/tools/testing/selftests/net/af_unix/test_unix_oob.c
index b57e91e1c3f2..532459a15067 100644
--- a/tools/testing/selftests/net/af_unix/test_unix_oob.c
+++ b/tools/testing/selftests/net/af_unix/test_unix_oob.c
@@ -124,7 +124,7 @@ void producer(struct sockaddr_un *consumer_addr)
wait_for_signal(pipefd[0]);
if (connect(cfd, (struct sockaddr *)consumer_addr,
- sizeof(struct sockaddr)) != 0) {
+ sizeof(*consumer_addr)) != 0) {
perror("Connect failed");
kill(0, SIGTERM);
exit(1);
--
Mirsad Goran Todorovac
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu
--
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia
The European Union
From: Ammar Faizi <ammarfaizi2(a)gnuweeb.org>
Hi Willy,
This series is a follow up of our previous discussion about getauxval()
and getpagesize() functions.
It will apply cleanly on top of your "20221227-nolibc-weak-4" branch.
Base commit: b6887ec8b0b0 ("tools/nolibc: add auxiliary vector
retrieval for mips").
I have added a selftest for the getpagesize() function, but I am not
sure how to assert the correctness of getauxval(). I think it is fine
not to add a selftest for getauxval(). If you think we should, please
give some advice on the test mechanism.
Thanks!
Signed-off-by: Ammar Faizi <ammarfaizi2(a)gnuweeb.org>
---
Ammar Faizi (3):
nolibc/stdlib: Implement `getauxval(3)` function
nolibc/sys: Implement `getpagesize(2)` function
selftests/nolibc: Add `getpagesize(2)` selftest
tools/include/nolibc/stdlib.h | 27 ++++++++++++++++++
tools/include/nolibc/sys.h | 21 ++++++++++++++
tools/testing/selftests/nolibc/nolibc-test.c | 30 ++++++++++++++++++++
3 files changed, 78 insertions(+)
base-commit: b6887ec8b0b0c78db414b78e329bf2ce234dedd5
--
Ammar Faizi
From: Ammar Faizi <ammarfaizi2(a)gnuweeb.org>
Hi,
This series adds signal handling support to the nolibc subsystem.
1) Initial implementation of nolibc sigaction(2) function.
Currently, this implementation is only available on the x86-64 arch.
sigaction() needs an architecture-dependent "signal trampoline"
function that invokes the __rt_sigreturn syscall to resume the process
after a signal gets handled.
On Linux x86-64, the "signal trampoline" function has to be written in
inline Assembly to prevent the compiler from controlling the %rsp
(e.g., with -fno-omit-frame-pointer, every function has a pushq
%rbp that makes the %rsp no longer point to struct rt_sigframe).
The "signal trampoline" function is called __arch_restore_rt in this
implementation.
2) signal(2) function.
signal() function is the simpler version of sigaction(). Unlike
sigaction(), which fully controls the struct sigaction, the caller
only cares about the sa_handler when calling the signal() function.
signal() internally calls sigaction(). This implementation is
currently only available on the x86-64 arch. When the sigaction()
function support is expanded to other architectures, this function
will automatically support those architectures. It's basically just
a sigaction() wrapper.
3) Extra nolibc updates.
Apart from the signal handling support. This series also contains
nolibc updates, they are:
- getpagesize() support.
- CFLAGS update.
- fork(2) selftest.
- sigaction(2) selftest.
- signal(2) selftest.
- getpagesize(2) selftest.
There 8 patches in this series. It has been tested on Linux x86-64 arch
and all tests OK.
$ sudo ./nolibc-test
Running test 'syscall'
...
...
66 wait_child = -1 ECHILD [OK]
67 waitpid_min = -1 ESRCH [OK]
68 waitpid_child = -1 ECHILD [OK]
69 write_badf = -1 EBADF [OK]
70 write_zero = 0 [OK]
Errors during this test: 0
Running test 'stdlib'
...
...
14 memcmp_60_20 = 64 [OK]
15 memcmp_20_e0 = -192 [OK]
16 memcmp_e0_20 = 192 [OK]
17 memcmp_80_e0 = -96 [OK]
18 memcmp_e0_80 = 96 [OK]
Errors during this test: 0
Total number of errors: 0
Exiting with status 0
$ make run -j8
Kernel: arch/x86/boot/bzImage is ready (#3)
...
82 test(s) passed.
Signed-off-by: Ammar Faizi <ammarfaizi2(a)gnuweeb.org>
---
It's also available in the Git repository.
The following changes since commit caf5c36025ec9395c8d7c78957b016a284812d23:
srcu: Update comment after the index flip (2022-12-21 09:01:53 -0800)
are available in the Git repository at:
https://github.com/ammarfaizi2/linux-block testing/rfc.v1.2022-12-22.nolibc
for you to fetch changes up to ac79aca684125907bfbefadfd6c6be0ccdfe8b33:
selftests/nolibc: Add `getpagesize(2)` selftest (2022-12-22 09:57:31 +0700)
----------------------------------------------------------------
Ammar Faizi (8):
nolibc/sys: Implement `sigaction(2)` function
nolibc/sys: Implement `signal(2)` function
nolibc/sys: Implement `getpagesize(2)` function
selftests/nolibc: Add `-Wall` and `-Wno-unsed-function` to the CFLAGS
selftests/nolibc: Add `fork(2)` selftest
selftests/nolibc: Add `sigaction(2)` selftest
selftests/nolibc: Add `signal(2)` selftest
selftests/nolibc: Add `getpagesize(2)` selftest
tools/include/nolibc/arch-x86_64.h | 12 +
tools/include/nolibc/sys.h | 224 +++++++++++++++++++
tools/testing/selftests/nolibc/Makefile | 2 +-
tools/testing/selftests/nolibc/nolibc-test.c | 219 +++++++++++++++++-
4 files changed, 454 insertions(+), 3 deletions(-)
base-commit: caf5c36025ec9395c8d7c78957b016a284812d23
--
Ammar Faizi
Commit 6b380799d251 ("selftests/vm: rename selftests/vm to
selftests/mm") in mm-unstable is missing some files that need to be
updated for the renaming. This commit adds the changes.
Fixes: 6b380799d251 ("selftests/vm: rename selftests/vm to selftests/mm") in mm-unstable
Signed-off-by: SeongJae Park <sj(a)kernel.org>
---
tools/testing/selftests/Makefile | 2 +-
tools/testing/selftests/kselftest_deps.sh | 6 +++---
tools/testing/selftests/mm/Makefile | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 41b649452560..56a29f2de8e6 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -85,7 +85,7 @@ TARGETS += tmpfs
TARGETS += tpm2
TARGETS += user
TARGETS += vDSO
-TARGETS += vm
+TARGETS += mm
TARGETS += x86
TARGETS += zram
#Please keep the TARGETS list alphabetically sorted
diff --git a/tools/testing/selftests/kselftest_deps.sh b/tools/testing/selftests/kselftest_deps.sh
index 7424a1f5babc..4bc14d9e8ff1 100755
--- a/tools/testing/selftests/kselftest_deps.sh
+++ b/tools/testing/selftests/kselftest_deps.sh
@@ -12,9 +12,9 @@ usage()
echo -e "Usage: $0 -[p] <compiler> [test_name]\n"
echo -e "\tkselftest_deps.sh [-p] gcc"
-echo -e "\tkselftest_deps.sh [-p] gcc vm"
+echo -e "\tkselftest_deps.sh [-p] gcc mm"
echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc"
-echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc vm\n"
+echo -e "\tkselftest_deps.sh [-p] aarch64-linux-gnu-gcc mm\n"
echo "- Should be run in selftests directory in the kernel repo."
echo "- Checks if Kselftests can be built/cross-built on a system."
echo "- Parses all test/sub-test Makefile to find library dependencies."
@@ -120,7 +120,7 @@ l1_tests=$(grep -r --include=Makefile "^LDLIBS" | \
# Level 2
# Some tests have multiple valid LDLIBS lines for individual sub-tests
# that need dependency checks. Find them and append them to the tests
-# e.g: vm/Makefile:$(OUTPUT)/userfaultfd: LDLIBS += -lpthread
+# e.g: mm/Makefile:$(OUTPUT)/userfaultfd: LDLIBS += -lpthread
# Filter out VAR_LDLIBS to discard the following:
# memfd/Makefile:$(OUTPUT)/fuse_mnt: LDLIBS += $(VAR_LDLIBS)
# Append space at the end of the list to append more tests.
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index 89c14e41bd43..6a4b639b2b2b 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
-# Makefile for vm selftests
+# Makefile for mm selftests
-LOCAL_HDRS += $(selfdir)/vm/local_config.h $(top_srcdir)/mm/gup_test.h
+LOCAL_HDRS += $(selfdir)/mm/local_config.h $(top_srcdir)/mm/gup_test.h
include local_config.mk
--
2.25.1
This includes some patches to fix 2 issues on ftrace selftests.
- eprobe filter and eprobe syntax test case were introduced but it
doesn't check whether the kernel supports eprobe filter. Thus the
new test case fails on the kernel which has eprobe but not support
eprobe filter. To solve this issue, add a filter description to
README file [1/3] and run the filter syntax error test only if the
description is found in the README file [2/3].
- Recently objtool adds prefix symbols for the function padding nops,
and the probepoint test case fails because this probepoint test case
tests whether the kprobe event can probe the target function and the
functions next to the target function. But the prefix symbols can not
be probed. Thus these prefix symbols must be skipped [3/3].
Thank you,
---
Masami Hiramatsu (Google) (3):
tracing/eprobe: Fix to add filter on eprobe description in README file
selftests/ftrace: Fix eprobe syntax test case to check filter support
selftests/ftrace: Fix probepoint testcase to ignore __pfx_* symbols
kernel/trace/trace.c | 2 +-
.../test.d/dynevent/eprobes_syntax_errors.tc | 4 +++-
.../selftests/ftrace/test.d/kprobe/probepoint.tc | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
--
Masami Hiramatsu (Google) <mhiramat(a)kernel.org>
On Fri, Jan 6, 2023 at 2:42 PM kernel test robot <lkp(a)intel.com> wrote:
>
> Hi Benjamin,
>
> I love your patch! Perhaps something to improve:
>
> [auto build test WARNING on hid/for-next]
> [also build test WARNING on next-20230106]
> [cannot apply to shuah-kselftest/next shuah-kselftest/fixes char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus linus/master v6.2-rc2]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Benjamin-Tissoires/selftests…
> base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next
> patch link: https://lore.kernel.org/r/20230106102332.1019632-9-benjamin.tissoires%40red…
> patch subject: [PATCH HID for-next v1 8/9] HID: bpf: clean up entrypoint
> config: i386-randconfig-a013
> compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
> reproduce (this is a W=1 build):
> wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
> chmod +x ~/bin/make.cross
> # https://github.com/intel-lab-lkp/linux/commit/46336953b47885c5111b7c1a92403…
> git remote add linux-review https://github.com/intel-lab-lkp/linux
> git fetch --no-tags linux-review Benjamin-Tissoires/selftests-hid-add-vmtest-sh/20230106-182823
> git checkout 46336953b47885c5111b7c1a92403b3d94cf3d41
> # save the config file
> mkdir build_dir && cp config build_dir/.config
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/hid/bpf/
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp(a)intel.com>
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/hid/bpf/hid_bpf_jmp_table.c:502:6: warning: no previous prototype for function 'call_hid_bpf_prog_put_deferred' [-Wmissing-prototypes]
> void call_hid_bpf_prog_put_deferred(struct work_struct *work)
> ^
> drivers/hid/bpf/hid_bpf_jmp_table.c:502:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
> void call_hid_bpf_prog_put_deferred(struct work_struct *work)
> ^
> static
> 1 warning generated.
>
>
> vim +/call_hid_bpf_prog_put_deferred +502 drivers/hid/bpf/hid_bpf_jmp_table.c
>
> f5c27da4e3c8a2 Benjamin Tissoires 2022-11-03 501
> 0baef37335dd4d Benjamin Tissoires 2022-11-03 @502 void call_hid_bpf_prog_put_deferred(struct work_struct *work)
> f5c27da4e3c8a2 Benjamin Tissoires 2022-11-03 503 {
> ade9207f04dc40 Benjamin Tissoires 2023-01-06 504 /* kept around for patch readability, to be dropped in the next commmit */
> f5c27da4e3c8a2 Benjamin Tissoires 2022-11-03 505 }
> f5c27da4e3c8a2 Benjamin Tissoires 2022-11-03 506
>
Oops, this function should have been dropped in 8/9 "HID: bpf: clean
up entrypoint". It's now dead code. I'll fix it in v2.
Cheers,
Benjamin
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests
On Wed, Jan 04, 2023 at 07:27:40PM +0100, Mirsad Goran Todorovac wrote:
> Dear all,
>
> Trying to complete `make kselftest` for the first time, so maybe I'm doing something wrong?
>
> Or we are having a regression in 6.2-rc2 release candidate ...
>
> However, the output of selftest run is:
>
> make[2]: Entering directory '.../linux_torvalds/tools/testing/selftests/proc'
> TAP version 13
> 1..21
> # selftests: proc: fd-001-lookup
> ok 1 selftests: proc: fd-001-lookup
> # selftests: proc: fd-002-posix-eq
> ok 2 selftests: proc: fd-002-posix-eq
> # selftests: proc: fd-003-kthread
> ok 3 selftests: proc: fd-003-kthread
> # selftests: proc: proc-loadavg-001
> ok 4 selftests: proc: proc-loadavg-001
> # selftests: proc: proc-empty-vm
> # proc-empty-vm: proc-empty-vm.c:184: test_proc_pid_maps: Assertion `rv == 0' failed.
> # /usr/bin/timeout: the monitored command dumped core
> # Aborted
> not ok 5 selftests: proc: proc-empty-vm # exit=134
> # selftests: proc: proc-pid-vm
> # proc-pid-vm: proc-pid-vm.c:365: main: Assertion `rv == len' failed.
> # /usr/bin/timeout: the monitored command dumped core
> # Aborted
>
> Please find attached lshw output, dmesg, config and lsmod.
>
> I am available for further diagnostics.
>
> The platform is Ubuntu 22.10 kinetic kudu on a Lenovo Ideapad 3 15ITL6 laptop.
The "bug" is that "call rel32" instruction testing for executable
vsyscall page which should be relocated to "call 0xffffffffff600000"
is messed up. Ubuntu 22.10 ships with "vsyscall=xonly" so there should not be
any faults when executing from it. But segfault happens with normal
randomised userspace address.
I'll change it to "call *rax" which should be more robust (and works)
and free from relocations.
On Wed, Jan 04, 2023 at 07:27:40PM +0100, Mirsad Goran Todorovac wrote:
> Trying to complete `make kselftest` for the first time, so maybe I'm doing something wrong?
>
> Or we are having a regression in 6.2-rc2 release candidate ...
>
> However, the output of selftest run is:
> # proc-empty-vm: proc-empty-vm.c:184: test_proc_pid_maps: Assertion `rv == 0' failed.
> # /usr/bin/timeout: the monitored command dumped core
> # Aborted
> not ok 5 selftests: proc: proc-empty-vm # exit=134
> # selftests: proc: proc-pid-vm
> # proc-pid-vm: proc-pid-vm.c:365: main: Assertion `rv == len' failed.
> # /usr/bin/timeout: the monitored command dumped core
> # Aborted
>
> Please find attached lshw output, dmesg, config and lsmod.
>
> I am available for further diagnostics.
>
> The platform is Ubuntu 22.10 kinetic kudu on a Lenovo Ideapad 3 15ITL6 laptop.
What the output of "cat /proc/self/maps" ?