From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
Cc: Mike Rapoport <rppt@kernel.org>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Pratyush Yadav <pratyush@kernel.org>,
kexec@lists.infradead.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] liveupdate: check for duplicate session before growing block set
Date: Tue, 3 Nov 2026 14:32:06 -0500 [thread overview]
Message-ID: <auo2qqZIbElECcw0@google.com> (raw)
In-Reply-To: <20261103153928.716753-1-christian.aurichzm@gmail.com>
On 11-03 12:39, Christian Aurich Zanettini Martins wrote:
> luo_session_insert() grows the outgoing block set before checking for a
> duplicate session name. On -EEXIST the new block stays in the set.
>
> If the session count is an exact multiple of the per-block capacity (51
> with 4K pages), that block stays empty. It is serialized with count 0,
> which kho_block_set_restore() rejects in the next kernel:
>
> luo: Block contains invalid entry count: 0
> Kernel panic - not syncing: The incoming tree failed to initialize properly [-EINVAL], disabling live update
>
> Check for the duplicate before growing the block set, as
> luo_preserve_file() does with the token.
>
> Fixes: 2a441a14c2c0 ("liveupdate: Remove limit on the number of sessions")
> Cc: stable@vger.kernel.org
> Signed-off-by: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
> ---
>
> Notes:
> Tested in QEMU: create N sessions, retry "sess-0" to get -EEXIST, then
> kexec and retrieve them. Unpatched, the second kernel panics for N=51
> and N=102; patched, N=1, 51, 52, 102 and 153 all come back.
>
> Based on v7.4-rc1.
>
> kernel/liveupdate/luo_session.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c
> index f48e9a4185f9..74bc66929f4b 100644
> --- a/kernel/liveupdate/luo_session.c
> +++ b/kernel/liveupdate/luo_session.c
> @@ -176,16 +176,6 @@ static int luo_session_insert(struct luo_session_header *sh,
>
> guard(rwsem_write)(&sh->rwsem);
>
> - /*
> - * For outgoing we should make sure there is room in serialization array
> - * for new session.
> - */
> - if (sh == &luo_session_global.outgoing) {
> - err = kho_block_set_grow(&sh->block_set, sh->count + 1);
> - if (err)
> - return err;
> - }
> -
> /*
> * For small number of sessions this loop won't hurt performance
> * but if we ever start using a lot of sessions, this might
> @@ -196,6 +186,17 @@ static int luo_session_insert(struct luo_session_header *sh,
> if (!strncmp(it->name, session->name, sizeof(it->name)))
> return -EEXIST;
> }
> +
> + /*
> + * For outgoing we should make sure there is room in serialization array
> + * for new session.
> + */
> + if (sh == &luo_session_global.outgoing) {
> + err = kho_block_set_grow(&sh->block_set, sh->count + 1);
> + if (err)
> + return err;
> + }
> +
Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
prev parent reply other threads:[~2026-11-03 19:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 15:39 Christian Aurich Zanettini Martins
2026-11-03 16:03 ` Pratyush Yadav
2026-11-03 18:30 ` Mike Rapoport
2026-11-03 19:32 ` Pasha Tatashin [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=auo2qqZIbElECcw0@google.com \
--to=pasha.tatashin@soleen.com \
--cc=christian.aurichzm@gmail.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pratyush@kernel.org \
--cc=rppt@kernel.org \
--cc=stable@vger.kernel.org \
/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®