From: Breno Leitao <leitao@debian.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Christian Brauner <brauner@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Jan Kara <jack@suse.cz>, Ryan Roberts <ryan.roberts@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] bootconfig: Free the initrd memory used by bootconfig
Date: Fri, 20 Nov 2026 10:46:58 -0800 [thread overview]
Message-ID: <awCVkOPTQaQUHANF@gmail.com> (raw)
In-Reply-To: <179495926058.237695.12800083196053168375.stgit@devnote2>
On Wed, Nov 18, 2026 at 08:47:40AM +0900, Masami Hiramatsu (Google) wrote:
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> 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.
>
> 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>
prev parent reply other threads:[~2026-11-20 18:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 23:47 [PATCH 0/2] bootconfig: Fix max size padding and initrd memory leak Masami Hiramatsu (Google)
2026-11-17 23:47 ` [PATCH 1/2] bootconfig: Exclude alignment padding from bootconfig max size Masami Hiramatsu (Google)
2026-11-20 18:48 ` Breno Leitao
2026-11-17 23:47 ` [PATCH 2/2] bootconfig: Free the initrd memory used by bootconfig Masami Hiramatsu (Google)
2026-11-20 18:46 ` Breno Leitao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=awCVkOPTQaQUHANF@gmail.com \
--to=leitao@debian.org \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=ryan.roberts@arm.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®