Centos-kernel-stream-9/kernel
Rado Vrbovsky ebb3c477d5 Merge: add bootconfig to kernel-tools package
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5642

Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

JIRA: https://issues.redhat.com/browse/RHEL-65546

Omitted-fix: 0a13b6c3c546 ("docs/zh_CN: Add new translation of admin-guide/bootconfig.rst")

Add the bootconfig binary to the kernel-tools package. CONFIG_BOOT_CONFIG is already enabled in RHEL and this allows having a separate file with the kernel parameters and is described at https://docs.kernel.org/admin-guide/bootconfig.html. We intend to use this for automotive for testing purposes since some embedded platforms limit the kernel command line paramters to 511 bytes.

This also required bringing the bootconfig support up to the latest upstream at the time of this writing since the tools/bootconfig/ binary would not compile.

This series was tested in qemu with the following procedure. Create a `/etc/kernel/bootconfig` file with the following contents that contain a kernel command line parameter that's longer than 511 bytes:

```
kernel {
        systemd.random-seed=EYDERk+qnhjx+WOS5zTfsSIbKGDeeZhaAXG5AaxkYr6lDgjIEZHmjjejC1INyArPQ7eNUWqzO9f/RtRaSXeLE7nac3kmVkOBlRmvMplPZS64O/vvMmQq/DZPx3pRKkuB6hGTL9LjK0eQtBFbSHI6YNhMnxSuZa/GWYpiw2rJZDU7EclaJT3xNcn3HFCL3EzPdh+fKm1s6SXF5YEqzGzSgdxj9CFGtrHuyNEoGU/bRCGRTQk11YvSrJJUPfR6zYSfBG26+oNyMwC7YJaguw/rKmXrGmCnrLMJRFuL8ytD6kHBhQJjxT2i2OIc+iSgHAYwZjCfsk3M/vbOTGxDoNiIEjljhGXPhCZofmLM8CgB0R5u/0vKNrwdxpmvKaVQzbFcVMpbGZAyt842yhXCbPDpBzfwQzqtD6bCYIxTzmz0JFE/H0McTNnMOur4u2kKbLcxoO0x8VxR6xYtGDPPJQmlxom9Zx7fIinUDcwA4Id1LCWXJuxrBtJKMK6ig7thwGtNN6qui7hUTMyjsLxgodg8eLaKIJJX393Hqid7wTZ90XQPG5ndO1M0FHfK1zBFF/R3BWlonwpKeh2avFCUcJidg+TzXsDmF+ru+//MVNA3MXRNw14qh+MYX4Xy/pWYuc4GngidF5AOzL0hIbC+PmGCHD+ae6yhj/o/5HPjqmHYNUjpvjsIhGTZaSJj9+1/9y1gCiQfypJP4zFUNPRAHBFoALMgTbQVI+Y1ZnuuIBNnRWQz/wpeRFl5YZjXwJNqxQCNMgPhKABaLd3GXi85yELrLnV5sOlPbuMvf7gR9YzDO5qeUtN23xDp+zDGLmxgCgrDdnLy4Gqbc8Pxos7RqEovBSUb+vtEpjLjub8nMGOzKsdM7ZzYzrLC2ydeh5SFHo6t3T23Kwoo5m+4VYVOsX7exbGFL8429PSnXXvUIosq0WtyBP4xVY7a274sOTnypJ4THia+dEBPaQ7mxO4qqI2+dGMpbCMOOMm4UqflvCrbypUFDrtfsCuolB8ddyV5kiwmzGjJri425QGxpoJQvvlgSAgOgZBVbP/YmPl3MQGDUtkGMxLyll1jFRGwsJQTYb35bP8oYLIpylD+9bdAM4Ev+sIDbISc0ao409aN8IOt61tpq1nzuCA9TPmDwzmP/PUDBFivVTFIuHjMJxXtu+rSp77sbSSwIJa/sXOic+m6ID6itX6lAO2cQ3gaBY+KGoF18QR50S3hU5wr5soooJv7KVmArNYMXtVOHpAWd1s0XxaQBYBF1SEhU4XgT/wZKdUeMkJQVvPk0Lzz2zF2WPkZnAdxPzfUieUo5vFWe1s7BVOMOb3CNrIKN5XfjS4JWUflEYxfDHkhhgQUJ2b+4tQUOQ==
}
```
Edit `/etc/kernel/cmdline` and add `bootconfig` to the list of kernel command line arguments. You may also need to edit `/boot/loader/entries/*` as well.

Run `sudo bootconfig -a /etc/kernel/bootconfig /boot/initramfs-5.14.0-*`

When the system boots you will see messages like the following in the log:

```
Nov 07 01:07:38 localhost kernel: Load bootconfig: 1409 bytes 4 nodes
...
Nov 07 01:07:38 localhost systemd[1]: Successfully credited entropy passed on kernel command line.
Nov 07 01:07:38 localhost systemd[1]: Note that the seed provided this way is accessible to unprivileged programs. This functionality should not be used outside of testing environments.
```

`/proc/cmdline` will contain the `systemd.random-seed` variable.

Signed-off-by: Brian Masney <bmasney@redhat.com>

Approved-by: Eric Chanudet <echanude@redhat.com>
Approved-by: Chris von Recklinghausen <crecklin@redhat.com>
Approved-by: Jan Stancek <jstancek@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2024-11-19 13:58:21 +00:00
..
bpf Merge: bpf: backports from upstream [9.6 phase 1] 2024-11-15 21:02:44 +00:00
cgroup Merge: fs: backport mnt_idmap type 2024-11-11 08:26:30 +00:00
configs mm/slab: rename CONFIG_SLAB to CONFIG_SLAB_DEPRECATED 2024-09-05 20:35:59 -04:00
debug module: Move kdb module related code out of main kdb code 2024-06-17 14:17:13 -04:00
dma dma-mapping: report unlimited DMA addressing in IOMMU DMA path 2024-11-04 08:57:41 -07:00
entry
events Merge: perf: Sync with upstream v6.11 2024-11-01 08:28:02 +00:00
futex mm/mm_init.c: remove obsolete macro HASH_SMALL 2024-10-01 11:18:14 -04:00
gcov
irq kthread: add kthread_stop_put 2024-09-20 12:26:34 -07:00
kcsan printk: export console trace point for kcsan/kasan/kfence/kmsan 2024-05-09 11:26:20 -04:00
livepatch livepatch: Add "replace" sysfs attribute 2024-10-15 09:54:10 -04:00
locking locktorture: Increase Hamming distance between call_rcu_chain and rcu_call_chains 2024-05-22 19:52:16 -04:00
module kunit: add KUNIT_INIT_TABLE to init linker section 2024-07-31 20:32:28 -06:00
power Merge: cgroup/cpuset: Relax restrictions on usage of cpuset.cpus.exclusive 2024-06-27 13:57:22 +00:00
printk prinkt/nbcon: Add a scheduling point to nbcon_kthread_func(). 2024-07-02 08:40:22 -04:00
rcu Merge: rcu: Use system_unbound_wq to avoid disturbing isolated CPUs 2024-10-25 16:29:24 +00:00
sched lazy tlb: introduce lazy tlb mm refcount helper functions 2024-11-04 09:14:17 -05:00
time Merge: CNB96: timekeeping: add clocksource ID and infrastructure for converting to/from a base clock 2024-11-05 11:41:13 +00:00
trace Merge: add bootconfig to kernel-tools package 2024-11-19 13:58:21 +00:00
.gitignore
Kconfig.freezer
Kconfig.hz
Kconfig.locks
Kconfig.preempt
Makefile kallsyms: move kallsyms_show_value() out of kallsyms.c 2024-06-17 14:17:27 -04:00
acct.c acct: use VMA iterator instead of linked list 2024-04-01 11:19:51 -04:00
async.c async: Introduce async_schedule_dev_nocall() 2024-06-17 12:03:48 -04:00
audit.c Merge: audit: Send netlink ACK before setting connection in auditd_set 2024-08-16 14:22:20 +00:00
audit.h
audit_fsnotify.c
audit_tree.c audit: Annotate struct audit_chunk with __counted_by 2024-07-04 14:52:57 -03:00
audit_watch.c
auditfilter.c audit: remove unnecessary assignment in audit_dupe_lsm_field() 2024-07-04 14:53:06 -03:00
auditsc.c fs: port xattr to mnt_idmap 2024-10-16 10:45:21 +08:00
backtracetest.c backtracetest: Convert from tasklet to BH workqueue 2024-06-18 17:26:55 -03:00
bounds.c bounds: Use the right number of bits for power-of-two CONFIG_NR_CPUS 2024-05-20 16:15:24 -04:00
capability.c fs: port i_{g,u}id_into_vfs{g,u}id() to mnt_idmap 2024-10-16 11:02:01 +08:00
cfi.c cfi: Remove CONFIG_CFI_CLANG_SHADOW 2024-06-17 14:17:20 -04:00
compat.c
configs.c
context_tracking.c context_tracking: Fix noinstr vs KASAN 2024-04-29 14:32:59 -04:00
cpu.c Merge: Update arch/{x86,powerpc,arm64}/mm to v6.6 2024-11-12 08:02:20 +00:00
cpu_pm.c
crash_core.c mm: free up a word in the first tail page 2024-10-01 11:21:53 -04:00
crash_dump.c
cred.c
delayacct.c delayacct: track delays from IRQ/SOFTIRQ 2024-07-15 11:12:08 -04:00
dma.c
exec_domain.c
exit.c lazy tlb: introduce lazy tlb mm refcount helper functions 2024-11-04 09:14:17 -05:00
exit.h exit: add internal include file with helpers 2024-07-02 09:45:34 -04:00
extable.c sections: move and rename core_kernel_data() to is_kernel_core_data() 2024-03-20 09:43:21 -04:00
fail_function.c
fork.c lazy tlb: shoot lazies, non-refcounting lazy tlb mm reference handling scheme 2024-11-04 09:14:17 -05:00
freezer.c Revert "Revert "Merge: cgroup: Backport upstream cgroup commits up to v6.8"" 2024-05-18 21:38:20 -04:00
gen_kheaders.sh
groups.c
hung_task.c Revert "Revert "Merge: cgroup: Backport upstream cgroup commits up to v6.8"" 2024-05-18 21:38:20 -04:00
iomem.c mm: move is_ioremap_addr() into new header file 2024-10-01 11:17:52 -04:00
irq_work.c
jump_label.c jump_label: make initial NOP patching the special case 2024-03-20 09:43:04 -04:00
kallsyms.c kallsyms: Fix kallsyms_selftest failure 2024-06-17 14:17:28 -04:00
kallsyms_internal.h kallsyms: Reduce the memory occupied by kallsyms_seqs_of_names[] 2024-06-17 14:17:21 -04:00
kallsyms_selftest.c kallsyms: Fix kallsyms_selftest failure 2024-06-17 14:17:28 -04:00
kallsyms_selftest.h kallsyms: Add self-test facility 2024-06-17 14:17:22 -04:00
kcmp.c
kcov.c mm: replace vma->vm_flags direct modifications with modifier calls 2024-04-29 14:33:17 -04:00
kexec.c kexec: introduce sysctl parameters kexec_load_limit_* 2024-05-15 10:32:32 +08:00
kexec_core.c kexec: enable kexec_crash_size to support two crash kernel regions 2024-05-15 10:32:32 +08:00
kexec_elf.c
kexec_file.c kexec: support purgatories with .text.hot sections 2024-05-15 10:32:32 +08:00
kexec_internal.h
kheaders.c
kprobes.c fprobe: Pass return address to the handlers 2024-10-25 09:07:32 +02:00
ksyms_common.c kallsyms: make kallsyms_show_value() as generic function 2024-06-17 14:17:28 -04:00
ksysfs.c
kthread.c lazy tlb: introduce lazy tlb mm refcount helper functions 2024-11-04 09:14:17 -05:00
latencytop.c
module_signature.c
notifier.c notifier: Add atomic_notifier_call_chain_is_empty() 2024-03-20 09:42:36 -04:00
nsproxy.c
padata.c padata: Honor the caller's alignment in case of chunk_size 0 2024-10-17 15:56:47 -04:00
panic.c mm: remove arguments of show_mem() 2024-10-01 11:17:31 -04:00
params.c params: Introduce the param_unknown_fn type 2024-06-17 14:17:29 -04:00
pid.c memfd: replace ratcheting feature from vm.memfd_noexec with hierarchy 2024-06-10 12:10:40 -04:00
pid_namespace.c Revert "rcu-tasks: Fix synchronize_rcu_tasks() VS zap_pid_ns_processes()" 2024-08-26 10:57:50 -04:00
pid_sysctl.h memfd: replace ratcheting feature from vm.memfd_noexec with hierarchy 2024-06-10 12:10:40 -04:00
platform-feature.c kernel: add platform_has() infrastructure 2024-03-20 09:42:37 -04:00
profile.c profile: setup_profiling_timer() is moslty not implemented 2024-03-20 09:42:39 -04:00
ptrace.c ptrace: Convert ptrace_attach() to use lock guards 2024-07-08 20:54:16 +02:00
range.c
reboot.c kernel/reboot: Add SYS_OFF_MODE_RESTART_PREPARE mode 2024-08-22 11:21:33 -04:00
regset.c
relay.c mm: replace vma->vm_flags direct modifications with modifier calls 2024-04-29 14:33:17 -04:00
resource.c resource: fix region_intersects() vs add_memory_driver_managed() 2024-10-29 10:10:23 -06:00
resource_kunit.c
rh_messages.c
rh_messages.h redhat: deprecate bnx2xx drivers in rhel-9.5 2024-06-21 11:38:19 -04:00
rh_shadowman.c
rseq.c
scftorture.c
scs.c
seccomp.c
signal.c mm: suppress mm fault logging if fatal signal already pending 2024-09-05 20:37:05 -04:00
smp.c trace,smp: Add tracepoints for scheduling remotelly called functions 2024-06-17 12:58:33 -03:00
smpboot.c kthread: add kthread_stop_put 2024-09-20 12:26:34 -07:00
smpboot.h
softirq.c softirq: Fix suspicious RCU usage in __do_softirq() 2024-08-26 10:57:51 -04:00
stackleak.c
stacktrace.c
static_call.c
static_call_inline.c Merge: static_call: Replace pointless WARN_ON() in static_call_module_notify() 2024-11-15 21:09:46 +00:00
stop_machine.c
sys.c powerpc/dexcr: Add DEXCR prctl interface 2024-10-04 01:55:31 -04:00
sys_ni.c x86/shstk: Introduce map_shadow_stack syscall 2024-10-01 11:17:15 -04:00
sysctl-test.c
sysctl.c mm: hugetlb: move hugeltb sysctls to its own file 2024-07-16 09:29:59 -04:00
task_work.c task_work: Add TWA_NMI_CURRENT as an additional notify mode. 2024-10-14 13:02:40 +02:00
taskstats.c
test_kprobes.c
torture.c torture: Print out torture module parameters 2024-05-22 19:52:15 -04:00
tracepoint.c
tsacct.c
ucount.c
uid16.c
uid16.h
umh.c Revert "Revert "Merge: cgroup: Backport upstream cgroup commits up to v6.8"" 2024-05-18 21:38:20 -04:00
up.c
user-return-notifier.c
user.c
user_namespace.c
usermode_driver.c
utsname.c
utsname_sysctl.c
watch_queue.c kernel: watch_queue: copy user-array safely 2024-05-23 05:14:57 -04:00
watchdog.c Revert "printk: Bring back the RT bits." 2024-05-09 11:24:08 -04:00
watchdog_hld.c Revert "printk: Bring back the RT bits." 2024-05-09 11:24:08 -04:00
workqueue.c sched/balancing: Rename scheduler_tick() => sched_tick() 2024-09-20 04:38:48 -04:00
workqueue_internal.h workqueue: Drop the special locking rule for worker->flags and worker_pool->flags 2024-05-03 13:39:25 -04:00