diff options
| author | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-11-18 08:47:40 +0900 |
|---|---|---|
| committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2026-11-22 11:04:30 +0900 |
| commit | 9ae84f30d74763bcee0dd8c2155c7dfeb135f5fa (patch) | |
| tree | 227400942db743123bbe95b6e8e4841d56e07660 /tools/perf/scripts/python | |
| parent | a89ca0d6e5c03f1b9fcd076fa0cef2c2505b6aab (diff) | |
bootconfig: Free the initrd memory used by bootconfig
get_boot_config_from_initrd() removes the bootconfig from the initrd by
decrementing initrd_end in place. However, the whole initrd including
the bootconfig is reserved, e.g. reserve_initrd_mem() reserves
[initrd_start, PAGE_ALIGN(original initrd_end)), and do_populate_rootfs()
frees it with free_initrd_mem(initrd_start, initrd_end). Thus the full
pages in [PAGE_ALIGN(new initrd_end), PAGE_ALIGN(original initrd_end))
are never freed. This leaks up to 8 pages for a 32KB bootconfig.
Save the original initrd_end in initrd_mem_end when trimming the
bootconfig, and restore initrd_end before freeing the initrd memory.
The bootconfig data has already been copied by xbc_init() at that point.
The trimmed initrd_end is kept when the initrd is retained, so that
/sys/firmware/initrd does not expose the bootconfig.
Link: https://lore.kernel.org/all/179495926058.237695.12800083196053168375.stgit@devnote2/
Fixes: de462e5f1071 ("bootconfig: Fix to remove bootconfig data from initrd while boot")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Breno Leitao <leitao@debian.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
