Bug 3702 - [Anck 5.10 x86_64][社区nightly]执行kernel-selftests下test-callbacks.sh用例失败,modprobe先后加载test_klp_callbacks_busy和test_klp_callbacks_demo模块,test_klp_callbacks_demo模块会加载失败
Summary: [Anck 5.10 x86_64][社区nightly]执行kernel-selftests下test-callbacks.sh用例失败,modprob...
Status: NEW
Alias: None
Product: Antest
Classification: Infrastructures
Component: 测试用例 (show other bugs) 测试用例
Version: unspecified
Hardware: x86_64 Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: shuancue
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-01-11 15:32 UTC by shanxifanshi
Modified: 2023-02-21 14:49 UTC (History)
7 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-01-11 15:32:27 UTC
[缺陷描述]:
执行kernel-selftests下test-callbacks.sh用例失败,modprobe先后加载test_klp_callbacks_busy和test_klp_callbacks_demo模块,test_klp_callbacks_demo模块会加载失败

测试日志:
# selftests: livepatch: test-callbacks.sh
# TEST: target module before livepatch ... ok
# TEST: module_coming notifier ... ok
# TEST: module_going notifier ... ok
# TEST: module_coming and module_going notifiers ... ok
# TEST: target module not present ... ok
# TEST: pre-patch callback -ENODEV ... ok
# TEST: module_coming + pre-patch callback -ENODEV ... not ok
# 
# --- expected
# +++ result
# @@ -2,7 +2,6 @@
#  livepatch: enabling patch 'test_klp_callbacks_demo'
#  test_klp_callbacks_demo: pre_patch_callback: vmlinux
#  test_klp_callbacks_demo: post_patch_callback: vmlinux
# -livepatch: 'test_klp_callbacks_demo': patching complete
#  % echo -19 > /sys/module/test_klp_callbacks_demo/parameters/pre_patch_ret
#  % modprobe test_klp_callbacks_mod
#  livepatch: applying patch 'test_klp_callbacks_demo' to loading module 'test_klp_callbacks_mod'
# @@ -11,6 +10,7 @@ livepatch: pre-patch callback failed for
#  livepatch: patch 'test_klp_callbacks_demo' failed for module 'test_klp_callbacks_mod', refusing to load module 'test_klp_callbacks_mod'
#  modprobe: ERROR: could not insert 'test_klp_callbacks_mod': No such device
#  % echo 0 > /sys/kernel/livepatch/test_klp_callbacks_demo/enabled
# +livepatch: disabling patch 'test_klp_callbacks_demo'
#  test_klp_callbacks_demo: pre_unpatch_callback: vmlinux
#  test_klp_callbacks_demo: post_unpatch_callback: vmlinux
#  % rmmod test_klp_callbacks_demo
# 
# ERROR: livepatch kselftest(s) failed
not ok 2 selftests: livepatch: test-callbacks.sh # exit=1

复现环境:
anck 5.10 x86物理机

复现概率:
必现

内核信息:
# uname -r
5.10.134-269.git.53f303a6c3fa.an8.x86_64

操作系统信息:
# cat /etc/os-release
NAME="Anolis OS"
VERSION="8.6"
ID="anolis"
ID_LIKE="rhel fedora centos"
VERSION_ID="8.6"
PLATFORM_ID="platform:an8"
PRETTY_NAME="Anolis OS 8.6"
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_capabilitie

内存信息:
# free -h
              total        used        free      shared  buff/cache   available
Mem:           15Gi       355Mi        11Gi       1.0Mi       3.6Gi        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/livepatch
make

执行测试用例
./test-callbacks.sh

[期望结果]:
用例pass

[实际结果]:
用例fail
Comment 1 shanxifanshi alibaba_cloud_group 2023-01-11 15:33:39 UTC
已知问题,属于设计如此,定位结论如下:

我们的config默认开启 CONFIG_LIVEPATCH_STOP_MACHINE_MODEL,在这种情况下,用户态脚本会对 EBUSY这种情况进行重试,能够增加打补丁的成功率,总结起来,这个问题属于设计如此,不做修复处理