Bug 4510 - [Anck 5.10 nightly][ANCK-5.10-14][Anolis8][x86_64]kernel-selftests:执行net目录下reuseaddr_ports_exhausted.sh用例fail,not ok 3 global.reuseaddr_ports_exhausted_reusable_different_euid
Summary: [Anck 5.10 nightly][ANCK-5.10-14][Anolis8][x86_64]kernel-selftests:执行net目录下re...
Status: CLOSED FIXED
Alias: None
Product: Antest
Classification: Infrastructures
Component: 测试用例 (show other bugs) 测试用例
Version: unspecified
Hardware: x86_64 Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: 宁畅
QA Contact:
URL:
Whiteboard:
Keywords:
: 4512 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-03-14 14:42 UTC by shanxifanshi
Modified: 2023-07-25 15:12 UTC (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description shanxifanshi alibaba_cloud_group 2023-03-14 14:42:48 UTC
[缺陷描述]:
kernel-selftests:执行net目录下reuseaddr_ports_exhausted.sh用例fail,not ok 3 global.reuseaddr_ports_exhausted_reusable_different_euid

测试日志:
# ./reuseaddr_ports_exhausted.sh
TAP version 13
1..3
# Starting 3 tests from 1 test cases.
#  RUN           global.reuseaddr_ports_exhausted_unreusable ...
#            OK  global.reuseaddr_ports_exhausted_unreusable
ok 1 global.reuseaddr_ports_exhausted_unreusable
#  RUN           global.reuseaddr_ports_exhausted_reusable_same_euid ...
#            OK  global.reuseaddr_ports_exhausted_reusable_same_euid
ok 2 global.reuseaddr_ports_exhausted_reusable_same_euid
#  RUN           global.reuseaddr_ports_exhausted_reusable_different_euid ...
# reuseaddr_ports_exhausted.c:153:reuseaddr_ports_exhausted_reusable_different_euid:Expected -1 (-1) == ret (0)
# reuseaddr_ports_exhausted.c:153:reuseaddr_ports_exhausted_reusable_different_euid:should fail to listen because only one uid reserves the port in TCP_LISTEN.
# reuseaddr_ports_exhausted.c:153:reuseaddr_ports_exhausted_reusable_different_euid:Expected -1 (-1) == ret (0)
# reuseaddr_ports_exhausted.c:153:reuseaddr_ports_exhausted_reusable_different_euid:should fail to listen because only one uid reserves the port in TCP_LISTEN.
# reuseaddr_ports_exhausted.c:153:reuseaddr_ports_exhausted_reusable_different_euid:Expected -1 (-1) == ret (0)
# reuseaddr_ports_exhausted.c:153:reuseaddr_ports_exhausted_reusable_different_euid:should fail to listen because only one uid reserves the port in TCP_LISTEN.
# reuseaddr_ports_exhausted.c:153:reuseaddr_ports_exhausted_reusable_different_euid:Expected -1 (-1) == ret (0)
# reuseaddr_ports_exhausted.c:153:reuseaddr_ports_exhausted_reusable_different_euid:should fail to listen because only one uid reserves the port in TCP_LISTEN.
# reuseaddr_ports_exhausted_reusable_different_euid: Test failed at step #13
#          FAIL  global.reuseaddr_ports_exhausted_reusable_different_euid
not ok 3 global.reuseaddr_ports_exhausted_reusable_different_euid
# FAILED: 2 / 3 tests passed.
# Totals: pass:2 fail:1 xfail:0 xpass:0 skip:0 error:0

[环境信息]:
复现环境:
anck 5.10 x86机器

复现概率:
必现

内核信息:
# uname -r
5.10.134-335.git.b9e0e840126f.an8.x86_64

操作系统信息:
# cat /etc/os-release
NAME="Anolis OS"
VERSION="8.8"
ID="anolis"
ID_LIKE="rhel fedora centos"
VERSION_ID="8.8"
PLATFORM_ID="platform:an8"
PRETTY_NAME="Anolis OS 8.8"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"

cpu信息:
# lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  2
Core(s) per socket:  2
Socket(s):           1
NUMA node(s):        1
Vendor ID:           GenuineIntel
BIOS Vendor ID:      Alibaba Cloud
CPU family:          6
Model:               106
Model name:          Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
BIOS Model name:     pc-i440fx-2.1
Stepping:            6
CPU MHz:             2699.998
BogoMIPS:            5399.99
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           48K
L1i cache:           32K
L2 cache:            1280K
L3 cache:            49152K
NUMA node0 CPU(s):   0-3
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves wbnoinvd arat avx512vbmi pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid fsrm arch_capabilities

内存信息:
# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       319Mi       8.5Gi       1.0Mi       6.3Gi        14Gi
Swap:            0B          0B          0B


[复现步骤]:
下载当前内核对应的kernel源码包
rpm -ivh xxx.src.rpm  默认安装到/root下
yum-builddep -y rpmbuild/SPECS/kernel.spec   自动安装前置依赖包,需要yum-utils
rpmbuild -bp ./rpmbuild/SPECS/kernel.spec   # 这个步骤会打相关的patch, 解压缩tar包,生成BUILD目录
cd rpmbuild/BUILD/kernel-xxx/linux-xxx/  
cd  /tools/testing/selftests/net
make

执行测试用例
./reuseaddr_ports_exhausted.sh

[期望结果]:
用例pass

[实际结果]:
用例fail

[原因分析]:
测试代码路径:
tools/testing/selftests/net/reuseaddr_ports_exhausted.sh
tools/testing/selftests/net/reuseaddr_ports_exhausted.c

fail点的函数如下:
reuseaddr_ports_exhausted.c

TEST(reuseaddr_ports_exhausted_reusable_different_euid)
{
        struct reuse_opts *opts;
        int i, j, ret, fd[2];
        uid_t euid[2] = {10, 20};

        for (i = 0; i < 4; i++) {
                opts = &reusable_opts[i];

                for (j = 0; j < 2; j++) {
                        ret = seteuid(euid[j]);
                        ASSERT_EQ(0, ret) TH_LOG("failed to seteuid: %d.", euid[j]);

                        fd[j] = bind_port(_metadata, opts->reuseaddr[j], opts->reuseport[j]);

                        ret = seteuid(0);
                        ASSERT_EQ(0, ret) TH_LOG("failed to seteuid: 0.");
                }

                ASSERT_NE(-1, fd[0]) TH_LOG("failed to bind.");
                EXPECT_NE(-1, fd[1]) TH_LOG("should succeed to bind because one socket can be bound in each euid.");

                if (fd[1] != -1) {
                        ret = listen(fd[0], 5);
                        ASSERT_EQ(0, ret) TH_LOG("failed to listen.");

                        ret = listen(fd[1], 5);
                        EXPECT_EQ(-1, ret) TH_LOG("should fail to listen because only one uid reserves the port in TCP_LISTEN.");  ---用例在此fail
                }

1. 之前一直都是pass的,使用昨晚9:38编译的内核测试开始fail
2. 在2台环境上测试都fail,应该不是环境问题
3. 内核昨天合入了3个commit,可能与此相关,请参考
https://gitee.com/anolis/cloud-kernel/pulls/1444
https://gitee.com/anolis/cloud-kernel/pulls/1440
https://gitee.com/anolis/cloud-kernel/pulls/1402/
Comment 1 yunhe123 alibaba_cloud_group 2023-03-14 15:20:08 UTC
*** Bug 4512 has been marked as a duplicate of this bug. ***
Comment 2 wangpingping alibaba_cloud_group 2023-03-14 17:48:01 UTC
alinux3 x86和aarch64 kernel-selftests下net.reuseaddr_ports_exhausted.sh今日nightly首次出现同样的失败;
内核:5.10.134-862.git.b9e0e840126f.al8.x86_64 
# cat /etc/o
cat: /etc/o: No such file or directory
[root@VM20200706-58 tone]# cat /etc/os-release
NAME="Alibaba Cloud Linux"
VERSION="3 (Soaring Falcon)"
ID="alinux"
ID_LIKE="rhel fedora centos"
VERSION_ID="3"
PLATFORM_ID="platform:al8"
PRETTY_NAME="Alibaba Cloud Linux 3 (Soaring Falcon)"
ANSI_COLOR="0;31"
HOME_URL="https://www.aliyun.com/"
Comment 3 宁畅 alibaba_cloud_group 2023-03-15 19:08:26 UTC
PR: https://gitee.com/anolis/cloud-kernel/pulls/1475
Comment 4 shanxifanshi alibaba_cloud_group 2023-03-16 09:50:33 UTC
最新nightly验证,用例pass,问题解决,bug关闭

# uname -r
5.10.134-337.git.8f3d075c5f6a.an8.x86_64

# ./reuseaddr_ports_exhausted.sh
TAP version 13
1..3
# Starting 3 tests from 1 test cases.
#  RUN           global.reuseaddr_ports_exhausted_unreusable ...
#            OK  global.reuseaddr_ports_exhausted_unreusable
ok 1 global.reuseaddr_ports_exhausted_unreusable
#  RUN           global.reuseaddr_ports_exhausted_reusable_same_euid ...
#            OK  global.reuseaddr_ports_exhausted_reusable_same_euid
ok 2 global.reuseaddr_ports_exhausted_reusable_same_euid
#  RUN           global.reuseaddr_ports_exhausted_reusable_different_euid ...
#            OK  global.reuseaddr_ports_exhausted_reusable_different_euid
ok 3 global.reuseaddr_ports_exhausted_reusable_different_euid
# PASSED: 3 / 3 tests passed.
# Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
tests done