Bug 129 - [Anolis OS 8.4 龙芯版][4.19.190-3.an8.loongarch64]ltp测试时clone301用例fail,fail原因为TFAIL: clone3() failed (4): EINVAL (22)
Summary: [Anolis OS 8.4 龙芯版][4.19.190-3.an8.loongarch64]ltp测试时clone301用例fail,fail原因为TF...
Status: CLOSED BYDESIGN
Alias: None
Product: ANCK 4.19 Dev
Classification: ANCK
Component: general/others (show other bugs) general/others
Version: unspecified
Hardware: loongarch Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: shanxifanshi
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-17 14:33 UTC by shanxifanshi
Modified: 2023-07-25 16:32 UTC (History)
5 users (show)

See Also:


Attachments
用例部分代码实现已fail点见图中标记 (83.30 KB, image/jpeg)
2021-12-17 14:33 UTC, shanxifanshi
Details
报错图片 (56.69 KB, image/png)
2021-12-20 10:19 UTC, wulifuture
Details

Note You need to log in before you can comment on or make changes to this bug.
Description shanxifanshi alibaba_cloud_group 2021-12-17 14:33:25 UTC
Created attachment 29 [details]
用例部分代码实现已fail点见图中标记

[缺陷描述]:
ltp测试时syscalls目录下的clone301用例fail,fail原因为通过clone3创建父子进程时,疑似不支持将flag设置为CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_PIDFD

测试日志:
<<<test_start>>>
tag=clone301 stime=1639712578
cmdline="clone301"
contacts=""
analysis=exit
<<<test_output>>>
incrementing stop
tst_buffers.c:55: TINFO: Test is using guarded buffers
tst_test.c:1411: TINFO: Timeout per run is 0h 05m 00s
clone301.c:164: TPASS: Parent got correct signal SIGCHLD
clone301.c:164: TPASS: Parent got correct signal SIGUSR2
clone301.c:164: TPASS: Parent got correct signal SIGCHLD
clone301.c:164: TPASS: Parent got correct signal SIGCHLD
clone301.c:130: TFAIL: clone3() failed (4): EINVAL (22)

Summary:
passed   4
failed   1
broken   0
skipped  0
warnings 0
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=1 corefile=no
cutime=0 cstime=0
<<<test_end>>>

系统镜像:
http://8.131.87.1/kojifiles/output/an-8-loongarch64-RC1/compose/BaseOS/loongarch64/iso/

复现环境:
龙芯物理机

复现概率:
必现

内核信息:
# uname -r
4.19.190-3.an8.loongarch64

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

cpu信息:
# lscpu
Architecture:        loongarch64
Byte Order:          Little Endian
CPU(s):              4
On-line CPU(s) list: 0-3
Thread(s) per core:  1
Core(s) per socket:  4
Socket(s):           1
NUMA node(s):        1
CPU family:          Loongson-64bit
Model name:          Loongson-3A5000LL
BogoMIPS:            4600.00
L1d cache:           64K
L1i cache:           64K
L2 cache:            256K
L3 cache:            16384K
NUMA node0 CPU(s):   0-3
Flags:               cpucfg lam ual fpu lsx lasx complex crypto lvz lbt_x86 lbt_arm lbt_mips

内存信息:
# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       1.3Gi       2.7Gi        18Mi        11Gi        12Gi
Swap:         7.9Gi       1.0Mi       7.9Gi

[期望结果]:
clone301用例pass

[实际结果]:
clone301用例fail

[初步分析]:
测试代码路径:ltp/testcases/kernel/syscalls/clone3/clone301.c

该用例总共创建了5次进程,前4次是成功的,最后1次失败,差别在于使用的flag值不同

static struct tcase {
        uint64_t flags;
        int exit_signal;
} tcases[] = {
        {0, SIGCHLD},
        {0, SIGUSR2},
        {CLONE_FS, SIGCHLD},
        {CLONE_NEWPID, SIGCHLD},
        {CLONE_PARENT_SETTID | CLONE_CHILD_SETTID | CLONE_PIDFD, SIGCHLD}, ----第5次使用clone3创建进程时使用的flag值
};
static void run(unsigned int n)
{
        struct tcase *tc = &tcases[n];
        int status, clone_pidfd = tc->flags & CLONE_PIDFD;
        pid_t pid;

        args->flags = tc->flags;
        args->pidfd = (uint64_t)(&pidfd);
        args->child_tid = (uint64_t)(&child_tid);
        args->parent_tid = (uint64_t)(&parent_tid);
        args->exit_signal = tc->exit_signal;
        args->stack = 0;
        args->stack_size = 0;
        args->tls = 0;

        parent_received_signal = 0;
        SAFE_SIGACTION(tc->exit_signal, &psig_action, NULL);

        TEST(pid = clone3(args, sizeof(*args)));   ---该步骤pid返回值小于0,进程创建失败
        if (pid < 0) {
                tst_res(TFAIL | TTERRNO, "clone3() failed (%d)", n);
                return;
        }
Comment 1 wulifuture 2021-12-20 10:19:48 UTC
Created attachment 37 [details]
报错图片
Comment 2 wulifuture 2021-12-20 10:20:20 UTC
龙芯3A5000台式机LTP稳定性压力测试fail,为同样问题
报错信息已上传到附件

[root@localhost ltp]# lscpu
架构:           loongarch64
字节序:         Little Endian
CPU:             4
在线 CPU 列表:  0-3
每个核的线程数: 1
每个座的核数:   4
座:             1
NUMA 节点:      1
CPU 系列:       Loongson-64bit
型号名称:       Loongson-3A5000
BogoMIPS:       5000.00
L1d 缓存:       64K
L1i 缓存:       64K
L2 缓存:        256K
L3 缓存:        16384K
NUMA 节点0 CPU: 0-3
标记:           cpucfg lam ual fpu lsx lasx complex crypto lvz lbt_x86 lbt_arm lbt_mips

系统镜像:
http://8.131.87.1/kojifiles/output/an-8-loongarch64-RC1/compose/BaseOS/loongarch64/iso/

内核:
[root@localhost ~]# uname -r
4.19.190-3.an8.loongarch64

硬件设备:
Loongson-3A5000台式机
Comment 3 liqianwen loongson_group 2021-12-24 16:53:14 UTC
[测试描述]
X86 ltp测试syscalls目录下的clone301用例时,终端显示内核版本因低于5.3而无法继续测试
[测试日志]
<<<test_start>>>
tag=clone301 stime=1640329853
cmdline="clone301"
contacts=""
analysis=exit
<<<test_output>>>
incrementing stop
tst_buffers.c:55: TINFO: Test is using guarded buffers
tst_test.c:1428: TINFO: Timeout per run is 0h 05m 00s
../../../../include/lapi/clone.h:52: TCONF: Test not supported on kernel version < v5.3
Summary:
passed   0
failed   0
broken   0
skipped  1
warnings 0
<<<execution_status>>>
initiation_status="ok"
duration=0 termination_type=exited termination_id=32 corefile=no
cutime=0 cstime=0
<<<test_end>>>
[复现步骤]:
git clone https://github.com/linux-test-project/ltp.git
cd ltp
make autotools
./configure
make
make install
/opt/ltp/runltp -f syscalls -s clone301
[内核信息]
# uname -r
4.18.0-305.25.1.el8_4.x86_64
[操作系统信息]
# cat /etc/os-release
NAME="CentOS Linux"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
[cpu信息 ]
# lscpu
Architecture:        x86_64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Little Endian
CPU(s):              8
On-line CPU(s) list: 0-7
Thread(s) per core:  1
Core(s) per socket:  1
Socket(s):           8
NUMA node(s):        1
Vendor ID:           GenuineIntel
BIOS Vendor ID:      Red Hat
CPU family:          6
Model:               85
Model name:          Intel Xeon Processor (Skylake, IBRS)
BIOS Model name:     RHEL-8.2.0 PC (Q35 + ICH9, 2009)
Stepping:            4
CPU MHz:             2194.838
BogoMIPS:            4389.67
Virtualization:      VT-x
Hypervisor vendor:   KVM
Virtualization type: full
L1d cache:           32K
L1i cache:           32K
L2 cache:            4096K
L3 cache:            16384K
NUMA node0 CPU(s):   0-7
Flags:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves arat umip pku ospke md_clear arch_capabilities
[内存信息]
# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       672Mi        14Gi        20Mi       711Mi        14Gi
Swap:            0B          0B          0B
[期望结果]:
clone301用例pass

[实际结果]:
clone301用例fail
Comment 4 yangyinglu loongson_group 2021-12-27 11:52:24 UTC
Test not supported on kernel version < v5.3,因此,此问题不用关注
Comment 5 Caspar admin 2022-03-24 04:24:29 UTC
resolved as bydesign
Comment 6 shanxifanshi alibaba_cloud_group 2023-07-25 16:32:53 UTC
如上面评论,开发评论是预期行为,无影响,关闭该bug