summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-10-23 12:20:54 -1000
committerLinus Torvalds <torvalds@linux-foundation.org>2026-10-23 12:20:54 -1000
commit90b754d40117b2889bbe847ce7bb4dcf968e7cb8 (patch)
tree95c8c91b5a5b33cc7ed7837768fe54dbccd58339 /include/linux
parent3f942403bbad36a120432be69445154891b65398 (diff)
parent677f83795fdfc25ddc51b665a9111f5ff199f7ca (diff)
Merge tag 'bootconfig-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull bootconfig updates from Masami Hiramatsu: "Parser robustness and validation improvements: - Skip printing early params to cmdline from bootconfig Suppress early_param keys from /proc/cmdline and warn the user, since bootconfig does not invoke early_param handlers and silently ignoring them is misleading - Reject unexpected data after null character Detect and reject non-null data following an intermediate null character in the bootconfig buffer, preventing silently ignored configuration after an early termination Code cleanups: - Merge _xbc_exit() into xbc_exit() Since memblock_free() now handles late freeing and NULL addresses, the separate _xbc_exit() helper and its early argument are unnecessary. Inline it into xbc_exit() - Remove redundant assignment in xbc_parse_array() The node->child = 0 assignment after the loop duplicates what xbc_init_node() already did - Skip internal tree sanity checks in kernel Move the node index bounds loop from xbc_verify_tree() into a userspace-only xbc_sanity_check_tree() to reduce boot-time overhead, since out-of-bounds indices cannot be produced by malformed input - Move BOOTCONFIG_FOOTER_SIZE to include/linux/bootconfig.h Share the footer size constant between kernel and user-space tools, replacing the hardcoded (BOOTCONFIG_MAGIC_LEN + 8) expression in init/main.c Tooling improvements: - Remove unused PAGE_SIZE macro from the bootconfig tool - Consolidate xbc_init() to error message wrapper Use init_xbc_with_error() for all bootconfig initialization paths in the tool for simpler and more consistent error handling" * tag 'bootconfig-v7.4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: bootconfig: Move BOOTCONFIG_FOOTER_SIZE to include/linux/bootconfig.h bootconfig: Skip internal tree sanity checks in kernel tools/bootconfig: Consolidate xbc_init() to error message wrapper bootconfig: Reject unexpected data after null character bootconfig: Skip printing early params to cmdline from bootconfig tools/bootconfig: remove unused PAGE_SIZE macro bootconfig: remove redundant assignment in xbc_parse_array() bootconfig: merge _xbc_exit() into xbc_exit()
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bootconfig.h21
1 files changed, 14 insertions, 7 deletions
diff --git a/include/linux/bootconfig.h b/include/linux/bootconfig.h
index deda507500da..260a6f46042e 100644
--- a/include/linux/bootconfig.h
+++ b/include/linux/bootconfig.h
@@ -27,6 +27,10 @@ bool __init cmdline_has_extra_options(void);
#define BOOTCONFIG_ALIGN (1 << BOOTCONFIG_ALIGN_SHIFT)
#define BOOTCONFIG_ALIGN_MASK (BOOTCONFIG_ALIGN - 1)
+/* Bootconfig footer is [size][csum][BOOTCONFIG_MAGIC]. */
+#define BOOTCONFIG_FOOTER_SIZE \
+ (sizeof(uint32_t) * 2 + BOOTCONFIG_MAGIC_LEN)
+
/**
* xbc_calc_checksum() - Calculate checksum of bootconfig
* @data: Bootconfig data.
@@ -266,7 +270,15 @@ int __init xbc_node_compose_key_after(struct xbc_node *root,
struct xbc_node *node, char *buf, size_t size);
/* Render key/value pairs under @root as a flat cmdline string */
-int __init xbc_snprint_cmdline(char *buf, size_t size, struct xbc_node *root);
+typedef bool (*xbc_cmdline_filter_fn)(struct xbc_node *node, const char *key, void *data);
+
+int __init xbc_snprint_cmdline_filter(char *buf, size_t size, struct xbc_node *root,
+ xbc_cmdline_filter_fn filter, void *data);
+
+static inline int __init xbc_snprint_cmdline(char *buf, size_t size, struct xbc_node *root)
+{
+ return xbc_snprint_cmdline_filter(buf, size, root, NULL, NULL);
+}
/**
* xbc_node_compose_key() - Compose full key string of the XBC node
@@ -291,12 +303,7 @@ int __init xbc_init(const char *buf, size_t size, const char **emsg, int *epos);
int __init xbc_get_info(int *node_size, size_t *data_size);
/* XBC cleanup data structures */
-void __init _xbc_exit(bool early);
-
-static __always_inline void xbc_exit(void)
-{
- _xbc_exit(false);
-}
+void __init xbc_exit(void);
/* XBC embedded bootconfig data in kernel */
#ifdef CONFIG_BOOT_CONFIG_EMBED