Bug 2083 - [5.17内核][Anolis 23][ecs] 使用 kexec-tools 包中的 kexec命令使用 --command-line参数 无法修改cmdline
Summary: [5.17内核][Anolis 23][ecs] 使用 kexec-tools 包中的 kexec命令使用 --command-line参数 无法修改cm...
Status: RESOLVED FIXED
Alias: None
Product: Anolis OS 23
Classification: Anolis OS
Component: BaseOS Packages (show other bugs) BaseOS Packages
Version: 23.0
Hardware: All Linux
: P3-Medium S3-normal
Target Milestone: ---
Assignee: xiangzao
QA Contact: bolong_tbl
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-06 18:18 UTC by Janos
Modified: 2022-10-31 15:26 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 Janos alibaba_cloud_group 2022-09-06 18:18:24 UTC
[缺陷描述]:
 使用 kexec-tools 包中的 kexec命令使用 --command-line参数 无法修改cmdline

[重现概率]:
必现

[重现环境]:
环境信息:云上ECS
OS:
#cat /etc/os-release
NAME="Anolis OS"
VERSION="23"
ID="anolis"
VERSION_ID="23"
PLATFORM_ID="platform:an23"
PRETTY_NAME="Anolis OS 23"
ANSI_COLOR="0;31"
HOME_URL="https://openanolis.cn/"
BUG_REPORT_URL="https://bugzilla.openanolis.cn/"

内核版本: 
# uname -r
5.17.0-1.an23.x86_64

内存信息:
# free -h
               total        used        free      shared  buff/cache   available
Mem:           7.4Gi       249Mi       6.9Gi       1.0Mi       264Mi       7.0Gi
Swap:             0B          0B          0B

CPU信息:
#lscpu
               total        used        free      shared  buff/cache   available
Mem:           7.4Gi       249Mi       6.9Gi       1.0Mi       264Mi       7.0Gi
Swap:             0B          0B          0B
[root@iZbp12nj7zzd2hcr70xlijZ ~]# lscpu
Architecture:            x86_64
  CPU op-mode(s):        32-bit, 64-bit
  Address sizes:         46 bits physical, 57 bits virtual
  Byte Order:            Little Endian
CPU(s):                  2
  On-line CPU(s) list:   0,1
Vendor ID:               GenuineIntel
  BIOS Vendor ID:        Alibaba Cloud
  Model name:            Intel(R) Xeon(R) Platinum 8369B CPU @ 2.70GHz
    BIOS Model name:     pc-i440fx-2.1  CPU @ 0.0GHz
    BIOS CPU family:     1
    CPU family:          6
    Model:               106
    Thread(s) per core:  2
    Core(s) per socket:  1
    Socket(s):           1
    Stepping:            6
    BogoMIPS:            5399.99
    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 sysc
                         all nx pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid tsc_known_freq pni pclmulqdq monitor s
                         sse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowp
                         refetch cpuid_fault invpcid_single ibrs_enhanced fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid avx512
                         f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xget
                         bv1 xsaves wbnoinvd arat avx512vbmi pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg av
                         x512_vpopcntdq rdpid fsrm arch_capabilities
Virtualization features:
  Hypervisor vendor:     KVM
  Virtualization type:   full
Caches (sum of all):
  L1d:                   48 KiB (1 instance)
  L1i:                   32 KiB (1 instance)
  L2:                    1.3 MiB (1 instance)
  L3:                    48 MiB (1 instance)
NUMA:
  NUMA node(s):          1
  NUMA node0 CPU(s):     0,1
Vulnerabilities:
  Itlb multihit:         Not affected
  L1tf:                  Not affected
  Mds:                   Not affected
  Meltdown:              Not affected
  Spec store bypass:     Vulnerable
  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:            Mitigation; Enhanced IBRS, RSB filling
  Srbds:                 Not affected
  Tsx async abort:       Not affected

RPM包版本:
# rpm -qa | grep kexec-tools
kexec-tools-2.0.23-1.an23.x86_64

[重现步骤]:
1、查看并记录当前cmdline
cat /proc/cmdline   
2、使用 --reuse-cmdline 参数切换内核
kexec -l /boot/vmlinuz-$(uname -r) --initrd=/boot/initramfs-$(uname -r).img --command-line="$(cat /proc/cmdline) aaaa=xxxx"
kexec -e
3、环境重启后查看cmdline
cat /proc/cmdline

[期望结果]:
使用 kexec 的--command-line 参数,在切换内核后可以以修改后的cmdline内容启动

[实际结果]:
切换前:
# cat /proc/cmdline
BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.17.0-1.an23.x86_64 root=UUID=c7c0360c-930f-458c-bdc0-1e37c66e986a ro rhgb crashkernel=0M-2G:0M,2G-8G:192M,8G-:256M cryptomgr.notests cgroup.memory=nokmem rcupdate.rcu_cpu_stall_timeout=300 quiet biosdevname=0 net.ifnames=0 console=tty0 console=ttyS0,115200n8 noibrs nvme_core.io_timeout=4294967295 nvme_core.admin_timeout=4294967295

切换后:
# cat /proc/cmdline
BOOT_IMAGE=(hd0,msdos1)/boot/vmlinuz-5.17.0-1.an23.x86_64 root=UUID=c7c0360c-930f-458c-bdc0-1e37c66e986a ro rhgb crashkernel=0M-2G:0M,2G-8G:192M,8G-:256M cryptomgr.notests cgroup.memory=nokmem rcupdate.rcu_cpu_stall_timeout=300 quiet biosdevname=0 net.ifnames=0 console=tty0 console=ttyS0,115200n8 noibrs nvme_core.io_timeout=4294967295 nvme_core.admin_timeout=4294967295

切换前后参数无变化,使用 kexec --command-line 修改启动参数失败,使用相同方法测试an8.6环境可以正常修改
Comment 1 Janos alibaba_cloud_group 2022-09-06 18:22:05 UTC
补充一下,在an23环境使用kexec命令中其他可以修改cmdline的参数同样在切换内核后无法正常修改cmdline,如  --reuse-cmdline、--append 等
Comment 2 xiangzao alibaba_cloud_group 2022-10-31 15:26:42 UTC
an23现在kexec版本已升级为2.0.25,在x86和arm上均可通过--command-line修改commandline