Bug 133 - [Anolis OS 8.4 龙芯版][4.19.190-3.an8.loongarch64]ltp测试时bpf_prog05用例fail,fail原因为TFAIL: src(r6) = 0, but should be 4294967296
Summary: [Anolis OS 8.4 龙芯版][4.19.190-3.an8.loongarch64]ltp测试时bpf_prog05用例fail,fail原因为...
Status: RESOLVED FIXED
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: wenlong
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-12-17 16:01 UTC by shanxifanshi
Modified: 2023-01-30 21:26 UTC (History)
4 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 2021-12-17 16:01:32 UTC
[缺陷描述]:
ltp测试时syscalls目录下的clone302用例fail,fail原因为TFAIL: src(r6) = 0, but should be 4294967296;疑似缺失了上游bugfix的一些补丁
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f6b1b3bf0d5f
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=468f6eafa6c4
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e88b2c6e5a4d
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9b00f1b78809

测试日志:
<<<test_start>>>
tag=bpf_prog05 stime=1639726956
cmdline="bpf_prog05"
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
bpf_common.c:17: TINFO: Raising RLIMIT_MEMLOCK to 2162688
tst_capability.c:29: TINFO: Dropping CAP_SYS_ADMIN(21)
bpf_prog05.c:91: TINFO: Have pointer arithmetic
bpf_common.c:114: TPASS: Loaded program
bpf_prog05.c:183: TINFO: Check w7(-1) /= w6(0) [r7 = -1, r6 = 1 << 32]
bpf_prog05.c:158: TFAIL: src(r6) = 0, but should be 4294967296
bpf_prog05.c:160: TPASS: dst(r7) = 0
bpf_prog05.c:187: TINFO: Check w7(-1) %= w6(0) [r7 = -1, r6 = 1 << 32]
bpf_prog05.c:158: TFAIL: src(r6) = 0, but should be 4294967296
bpf_prog05.c:158: TFAIL: dst(r7) = 18446744073709551615, but should be 4294967295

HINT: You _MAY_ be missing kernel fixes, see:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f6b1b3bf0d5f
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=468f6eafa6c4
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e88b2c6e5a4d
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9b00f1b78809

HINT: You _MAY_ be vulnerable to CVE(s), see:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-CVE-2021-3444

Summary:
passed   2
failed   3
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/

复现环境:
龙芯物理机

复现概率:
必现

[复现步骤]:
git clone https://github.com/linux-test-project/ltp.git
cd ltp
make autotools
./configure
make
make install
/opt/ltp/runltp -f syscalls -s bpf_prog05

内核信息:
# 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

[期望结果]:
bpf_prog05用例pass

[实际结果]:
bpf_prog05用例fail

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

疑似缺失上游关于bpf的一些bug fix补丁,请开发同学确认是否需要合入,这些补丁同样会导致CVE-2021-3444问题的发生

CVE-2021-3444问题:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-CVE-2021-3444

bpf bug fix:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f6b1b3bf0d5f
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=468f6eafa6c4
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e88b2c6e5a4d
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9b00f1b78809
Comment 1 wenlong loongson_group 2021-12-20 15:32:59 UTC
已跟踪,内部id:2028,
Comment 2 liqianwen loongson_group 2021-12-24 16:30:12 UTC
[测试描述]
测试过程中终端报/proc/sys/kernel/unprivileged_bpf_disabled的错误
[测试日志]
<<<test_start>>>
tag=bpf_prog05 stime=1640334385
cmdline="bpf_prog05"
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
bpf_common.c:17: TINFO: Raising RLIMIT_MEMLOCK to 2162688
tst_capability.c:29: TINFO: Dropping CAP_SYS_ADMIN(21)
tst_capability.c:29: TINFO: Dropping CAP_BPF(39)
bpf_common.c:39: TCONF: Hint: check also /proc/sys/kernel/unprivileged_bpf_disabled
bpf_common.c:41: TCONF: bpf() requires CAP_SYS_ADMIN or CAP_BPF on this system: EPERM (1)
Summary:
passed   0
failed   0
broken   0
skipped  2
warnings 0
<<<execution_status>>>
initiation_status="ok"
duration=1 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 bpf_prog05
[内核信息]
# 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
[期望结果]:
bpf_prog05用例pass

[实际结果]:
bpf_prog05用例fail
Comment 3 wenlong loongson_group 2022-01-11 15:19:57 UTC
内部结论同步:

[Bug 2028] ltp测试时bpf_prog05用例fail,fail原因为TFAIL: src(r6) = 0, but should be 4294967296

 Comment # 1 on bug 2028 from 杨瀛陆

代码已提交,等待评审
Comment 4 yangyinglu loongson_group 2022-01-11 19:38:56 UTC
代码已合入龙芯内核
Comment 5 wenlong loongson_group 2023-01-30 21:26:33 UTC
已提供最新内核给openanolis