cmsg_so_mark.sh / cmsg_time.sh / cmsg_ipv6.sh in net from ubuntu_kernel_selftests hang with non-amd64
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-kernel-tests |
Fix Released
|
Undecided
|
Po-Hsu Lin | ||
linux (Ubuntu) |
Fix Released
|
Medium
|
Andrea Righi | ||
Kinetic |
Fix Released
|
Medium
|
Po-Hsu Lin | ||
Lunar |
Fix Released
|
Medium
|
Andrea Righi |
Bug Description
[Impact]
cmsg_* tests in net tests from ubuntu_
non-amd64 systems and eventually causing "Incomplete" test results on
RISCV kernels due to the timeout setting.
This is because of an infinity while loop caused by a char variable
used here to take the getopt() return value in cmsg_sender.c, it should
be an int instead.
[Fix]
* 1573c68820 ("selftests: net: fix cmsg_so_mark.sh test hang")
This patch can be cherry-picked into both Kinetic and Lunar, these test
cases are only available in these newer kernels.
[Test]
Compile the patched cmsg_sender.c on a non-amd64 system, and the cmsg_*
tests will no longer hanging.
[Where problems could occur ]
Change limited to testing tools, no actual impact to real functions.
[Original Bug Report]
Issue found with 5.19.0-1010.11, 5.19.0-1011.12
This issue does not exist in 5.19.0-1009.10 because the net test can't be built by that time.
Test output:
Running 'make run_tests -C net TEST_PROGS=
make: Entering directory '/home/
make --no-builtin-rules ARCH=riscv -C ../../../.. headers_install
make[1]: Entering directory '/home/
INSTALL ./usr/include
make[1]: Leaving directory '/home/
TAP version 13
1..1
# selftests: net: cmsg_so_mark.sh
Timer expired (5400 sec.), nuking pid 82951
A manual test shows it will stuck with:
$ sudo ./cmsg_so_mark.sh
+ NS=ns
+ IP4=172.16.0.1/24
+ TGT4=172.16.0.2
+ IP6=2001:
+ TGT6=2001:db8:1::2
+ MARK=1000
+ trap cleanup EXIT
+ ip netns add ns
+ ip netns exec ns sysctl -w 'net.ipv4.
+ ip -netns ns link add type dummy
+ ip -netns ns link set dev dummy0 up
+ ip -netns ns addr add 172.16.0.1/24 dev dummy0
+ ip -netns ns addr add 2001:db8:1::1/64 dev dummy0
+ ip -netns ns rule add fwmark 1000 lookup 300
+ ip -6 -netns ns rule add fwmark 1000 lookup 300
+ ip -netns ns route add prohibit any table 300
+ ip -6 -netns ns route add prohibit any table 300
+ BAD=0
+ TOTAL=0
+ for ovr in setsock cmsg both
+ for i in 4 6
+ '[' 4 == 4 ']'
+ TGT=172.16.0.2
+ for p in u i r
+ '[' u == u ']'
+ prot=UDP
+ '[' u == i ']'
+ '[' u == r ']'
+ '[' setsock == setsock ']'
+ m=-M
+ '[' setsock == cmsg ']'
+ '[' setsock == both ']'
+ ip netns exec ns ./cmsg_sender -4 -p u -M 1001 172.16.0.2 1234
(test stuck here)
CVE References
summary: |
- cmsg_so_mark.sh in net from ubuntu_kernel_selftests hang with RISCV + cmsg_so_mark.sh in net from ubuntu_kernel_selftests hang with K-RISCV kernel |
summary: |
cmsg_so_mark.sh / cmsg_time.sh in net from ubuntu_kernel_selftests hang - with K-RISCV kernel + with non-amd64 |
Changed in ubuntu-kernel-tests: | |
assignee: | nobody → Po-Hsu Lin (cypressyew) |
status: | New → In Progress |
Changed in linux (Ubuntu Kinetic): | |
assignee: | nobody → Po-Hsu Lin (cypressyew) |
status: | New → In Progress |
Changed in linux (Ubuntu Lunar): | |
assignee: | nobody → Po-Hsu Lin (cypressyew) |
status: | Incomplete → In Progress |
Changed in linux (Ubuntu Lunar): | |
assignee: | Po-Hsu Lin (cypressyew) → Andrea Righi (arighi) |
importance: | Undecided → Medium |
status: | In Progress → Fix Committed |
Changed in linux (Ubuntu Kinetic): | |
importance: | Undecided → Medium |
status: | In Progress → Fix Committed |
Discussion upstream: /lore.kernel<email address hidden>/t/
https:/
strace, dmesg, syslog did not provide any useful information.
Investigation with gdb shows the cmsg_sender will stuck in an infinity loop when parsing arguments in cs_parse_args().
while ((o = getopt(argc, argv, "46sS:p: m:M:d:tf: F:c:C:l: L:H:")) != -1)
The "char o" is the culprit here, should be an int instead.
Otherwise it will get stuck as char(-1) is 255 on these riscv instances, it will never match the -1 here.