跳转至

88.5 ltp 失败测试用例分析

2202 cpuhotplug03

  • https://blog.csdn.net/maxg1206/article/details/125600523
./runltp -f cpuhotplug -s cpuhotplug03
[root@nm08-az2-compute-c8ne-10e8e92e209 secure]# cat /proc/schedstat | grep cpu1 | head -n1
cpu1 0 0 0 0 0 0 629484338520 2428964558 213354 0 0 0 0 0 0 0
[root@nm08-az2-compute-c8ne-10e8e92e209 secure]#
[root@nm08-az2-compute-c8ne-10e8e92e209 secure]#
[root@nm08-az2-compute-c8ne-10e8e92e209 secure]#
[root@nm08-az2-compute-c8ne-10e8e92e209 secure]# echo 0 | tee /sys/devices/system/cpu/cpu1/online && cat /sys/devices/system/cpu/cpu1/online
0
0
[root@nm08-az2-compute-c8ne-10e8e92e209 secure]# echo 1 | tee /sys/devices/system/cpu/cpu1/online && cat /sys/devices/system/cpu/cpu1/online
1
1
[root@nm08-az2-compute-c8ne-10e8e92e209 secure]# cat /proc/schedstat | grep cpu1 | head -n1
cpu1 0 0 0 0 0 0 629495021305 2430847733 213385 0 0 0 0 0 0 0
[root@nm08-az2-compute-c8ne-10e8e92e209 secure]#
[root@nm08-az2-compute-c8ne-10e8e92e209 secure]# cat /proc/schedstat | grep cpu1 | head -n1
cpu1 0 0 0 0 0 0 629495044028 2430847733 213391 0 0 0 0 0 0 0

2248 cve-2017-15537

./runltp -f cve -s cve-2017-15537

ptrace07.c:141: TBROK: PTRACE_SETREGSET failed with unexpected error: EFAULT (14)

126     /*
127      * Old kernels simply masked out all the reserved bits in the xstate
128      * header (causing the PTRACE_SETREGSET command here to succeed), while
129      * new kernels will reject them (causing the PTRACE_SETREGSET command
130      * here to fail with EINVAL).  We accept either behavior, as neither
131      * behavior reliably tells us whether the real bug (which we test for
132      * below in either case) is present.

133      */
134     TEST(ptrace(PTRACE_SETREGSET, pid, NT_X86_XSTATE, &iov));
135     if (TST_RET == 0) {
136         tst_res(TINFO, "PTRACE_SETREGSET with reserved bits succeeded");
137     } else if (TST_ERR == EINVAL) {
138         tst_res(TINFO,
139             "PTRACE_SETREGSET with reserved bits failed with EINVAL");
140     } else {
141         tst_brk(TBROK | TTERRNO,
142             "PTRACE_SETREGSET failed with unexpected error");
143     }

ltp-20240930

wget https://codeload.github.com/linux-test-project/ltp/tar.gz/refs/tags/20240930

tar -zxvf ltp-20240930.tar.gz
cd ltp-20240930
./build.sh -p /opt/ltp-20240930
make install
cd /opt/ltp-20240930
export LTP_TIMEOUT_MUL=3
./runltp -f cve -s cve-2017-15537

2248-cve-2017-15537

2273 cve-2018-1000204

./runltp -f cve -s cve-2018-1000204
tst_test.c:1431: TINFO: Timeout per run is 0h 05m 00s
ioctl_sg01.c:81: TINFO: Found SCSI device /dev/sg0

Feb 25 09:16:12 nm08-az2-compute-c8ne-10e8e92e209 kernel: blk_update_request: operation not supported error, dev loop0, sector 524160 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0
Feb 25 09:16:12 nm08-az2-compute-c8ne-10e8e92e209 kernel: blk_update_request: operation not supported error, dev loop0, sector 522 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0
Feb 25 09:16:12 nm08-az2-compute-c8ne-10e8e92e209 kernel: blk_update_request: operation not supported error, dev loop0, sector 16906 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0
Feb 25 09:16:12 nm08-az2-compute-c8ne-10e8e92e209 kernel: blk_update_request: operation not supported error, dev loop0, sector 32774 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0
Feb 25 09:16:12 nm08-az2-compute-c8ne-10e8e92e209 kernel: blk_update_request: operation not supported error, dev loop0, sector 49674 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0
Feb 25 09:16:12 nm08-az2-compute-c8ne-10e8e92e209 kernel: blk_update_request: operation not supported error, dev loop0, sector 65542 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0
Feb 25 09:16:12 nm08-az2-compute-c8ne-10e8e92e209 kernel: blk_update_request: operation not supported error, dev loop0, sector 82442 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0
Feb 25 09:16:12 nm08-az2-compute-c8ne-10e8e92e209 kernel: blk_update_request: operation not supported error, dev loop0, sector 98310 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0
Feb 25 09:16:12 nm08-az2-compute-c8ne-10e8e92e209 kernel: blk_update_request: operation not supported error, dev loop0, sector 115210 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class 0
Feb 25 09:16:12 nm08-az2-compute-c8ne-10e8e92e209 kernel: blk_update_request: operation not supported error, dev loop0, sector 131078 op 0x9:(WRITE_ZEROES) flags 0x800800 phys_seg 0 prio class
// vim block/blk-core.c +1502

1484 bool blk_update_request(struct request *req, blk_status_t error,
1485         unsigned int nr_bytes)
1486 {
1487     int total_bytes;
1488 
1489     trace_block_rq_complete(req, blk_status_to_errno(error), nr_bytes);
1490 
1491     if (!req->bio)
1492         return false;
1493 
1494 #ifdef CONFIG_BLK_DEV_INTEGRITY
1495     if (blk_integrity_rq(req) && req_op(req) == REQ_OP_READ &&
1496         error == BLK_STS_OK)
1497         req->q->integrity.profile->complete_fn(req, nr_bytes);
1498 #endif
1499 
1500     if (unlikely(error && !blk_rq_is_passthrough(req) &&
1501              !(req->rq_flags & RQF_QUIET)))
1502         print_req_error(req, error, __func__);
1503 
error:
表示请求是否发生了错误。如果 error 为真,表示请求过程中出现了错误。

!blk_rq_is_passthrough(req)检查请求是否不是直通请求(passthrough request)。直通请求通常是直接传递给底层设备的请求,不需要在这里处理。如果 blk_rq_is_passthrough(req) 返回假,表示请求不是直通请求。

!(req->rq_flags & RQF_QUIET)检查请求标志中是否没有设置 RQF_QUIET 标志。RQF_QUIET 标志表示请求应该静默处理,不打印错误信息。如果 !(req->rq_flags & RQF_QUIET) 为真,表示请求没有设置静默标志。

只有当这三个条件都为真时,才会调用 print_req_error 函数打印请求的错误信息。
// vim block/blk-core.c +244
 235 static void print_req_error(struct request *req, blk_status_t status,                                                                                                
 236         const char *caller)
 237 {
 238     int idx = (__force int)status;
 239 
 240     if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
 241         return;
 242 
 243     printk_ratelimited(KERN_ERR
 244         "%s: %s error, dev %s, sector %llu op 0x%x:(%s) flags 0x%x "
 245         "phys_seg %u prio class %u\n",
 246         caller, blk_errors[idx].name,
 247         req->rq_disk ? req->rq_disk->disk_name : "?",
 248         blk_rq_pos(req), req_op(req), blk_op_str(req_op(req)),
 249         req->cmd_flags & ~REQ_OP_MASK,
 250         req->nr_phys_segments,
 251         IOPRIO_PRIO_CLASS(req->ioprio));
 252 }
bpftrace -e 'tracepoint:signal:signal_generate /args->sig == 9/ { printf("Process %d %s send SIGNAL %d to process %d %s\n", pid, comm, args->sig, args->pid, args->comm); }'
Attaching 1 probe...


Process 1710973 ioctl_sg01 send SIGNAL 9 to process 1710974 ioctl_sg01
Process 1718933 ioctl_sg01 send SIGNAL 9 to process 1718934 ioctl_sg01

2273-cve-2018-1000204

vim testcases/kernel/syscalls/ioctl/ioctl_sg01.c +109

将100替换成3
./runltp -f cve -s cve-2018-1000204

Running tests.......
<<<test_start>>>
tag=cve-2018-1000204 stime=1740474853
cmdline="ioctl_sg01"
contacts=""
analysis=exit
<<<test_output>>>
incrementing stop
tst_test.c:1860: TINFO: LTP version: 20240930
tst_test.c:1864: TINFO: Tested kernel: 5.10.0-136.12.0.88.5.ctl3.x86_64 #1 SMP Sat Feb 22 10:42:11 UTC 2025 x86_64
tst_test.c:1703: TINFO: Timeout per run is 1h 00m 30s
ioctl_sg01.c:83: TINFO: Found SCSI device /dev/sg0
ioctl_sg01.c:124: TPASS: Output buffer is empty, no data leaked

Summary:
passed   1
failed   0
broken   0
skipped  0
warnings 0
<<<execution_status>>>
initiation_status="ok"
duration=23 termination_type=exited termination_id=0 corefile=no
cutime=215 cstime=2091
<<<test_end>>>
INFO: ltp-pan reported all tests PASS
LTP Version: 20240930

2309 cpufreq_boost

./testcases/bin/cpufreq_boost

cpufreq_boost    0  TINFO  :  found 'intel_pstate' driver, sysfs knob '/sys/devices/system/cpu/intel_pstate/no_turbo'
cpufreq_boost    0  TWARN  :  cpufreq_boost.c:137: failed to set FIFO sched with max priority: errno=EPERM(1): Operation not permitted
cpufreq_boost    0  TINFO  :  maximum speed is 4000000 KHz
cpufreq_boost    0  TINFO  :  load CPU0 with boost enabled
cpufreq_boost    0  TINFO  :  elapsed time is 1359 ms
cpufreq_boost    0  TINFO  :  load CPU0 with boost disabled
cpufreq_boost    0  TINFO  :  elapsed time is 1573 ms
cpufreq_boost    1  TPASS  :  compare time spent with and without boost (-2%)

💬 评论