From: Pasha Tatashin <pasha.tatashin@soleen.com>
To: Mike Rapoport <rppt@kernel.org>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>,
sourabhjain@linux.ibm.com, jbouron@amazon.com,
akpm@linux-foundation.org, bhe@redhat.com,
linux-kernel@vger.kernel.org, dan.carpenter@linaro.org,
liaoyuanhong@vivo.com, rafael.j.wysocki@intel.com,
piliu@redhat.com, kexec@lists.infradead.org, pratyush@kernel.org,
skhawaja@google.com, graf@amazon.com, mario.limonciello@amd.com
Subject: Re: [PATCH v4 3/5] liveupdate: block session mutations during reboot
Date: Mon, 18 May 2026 12:40:33 +0000 [thread overview]
Message-ID: <agsIsQLQR8i1sF_A@plex> (raw)
In-Reply-To: <agrQaP22pgxOkR_j@kernel.org>
On 05-18 11:40, Mike Rapoport wrote:
> On Sun, May 17, 2026 at 07:26:48PM +0000, Pasha Tatashin wrote:
> > During the reboot() syscall, user processes may still be running
> > concurrently and attempting to mutate sessions (e.g., creating,
> > retrieving, or releasing sessions). To prevent this, introduce
> > luo_session_serialize_rwsem to synchronize mutations with the
> > serialization process.
> >
> > All session mutation operations (create, retrieve, release, ioctl) take
> > the read lock. The serialization process (luo_session_serialize) takes
> > the write lock and holds it indefinitely on success. This effectively
> > freezes the LUO session subsystem during the transition to the new
> > kernel. If serialization fails, the lock is released to allow recovery.
> >
> > Fixes: 0153094d03df ("liveupdate: luo_session: add sessions support")
> > Reported-by: Oskar Gerlicz Kowalczuk <oskar@gerlicz.space>
> > Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> > ---
> > kernel/liveupdate/luo_session.c | 27 ++++++++++++++++++++++++---
> > 1 file changed, 24 insertions(+), 3 deletions(-)
> >
> > diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c
> > index 59b37d17db6b..6099213275d8 100644
> > --- a/kernel/liveupdate/luo_session.c
> > +++ b/kernel/liveupdate/luo_session.c
> > @@ -385,9 +394,12 @@ int luo_session_create(const char *name, struct file **filep)
> > struct luo_session *session;
> > int err;
> >
> > + down_read(&luo_session_serialize_rwsem);
> > session = luo_session_alloc(name);
>
> We can alloc outside the lock, will make error handling simpler.
>
> sashiko complains about mixing down_read() with scoped_guard(), for this
> function it would make sense to use plain mutex_{lock,unlock} around
> luo_session_getfile()
Done. Thank you for review.
Pasha
>
> > - if (IS_ERR(session))
> > - return PTR_ERR(session);
> > + if (IS_ERR(session)) {
> > + err = PTR_ERR(session);
> > + goto err_unlock;
> > + }
> >
> > err = luo_session_insert(&luo_session_global.outgoing, session);
> > if (err)
> > @@ -398,12 +410,16 @@ int luo_session_create(const char *name, struct file **filep)
> > if (err)
> > goto err_remove;
> >
> > + up_read(&luo_session_serialize_rwsem);
> > +
> > return 0;
> >
> > err_remove:
> > luo_session_remove(&luo_session_global.outgoing, session);
> > err_free:
> > luo_session_free(session);
> > +err_unlock:
> > + up_read(&luo_session_serialize_rwsem);
> >
> > return err;
> > }
>
> --
> Sincerely yours,
> Mike.
next prev parent reply other threads:[~2026-05-18 12:40 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-17 19:26 [PATCH v4 0/5] liveupdate: serialization safety and race fixes Pasha Tatashin
2026-05-17 19:26 ` [PATCH v4 1/5] liveupdate: skip serialization for context-preserving kexec Pasha Tatashin
2026-05-17 19:26 ` [PATCH v4 2/5] liveupdate: fix TOCTOU race in luo_session_retrieve() Pasha Tatashin
2026-05-17 19:26 ` [PATCH v4 3/5] liveupdate: block session mutations during reboot Pasha Tatashin
2026-05-18 8:40 ` Mike Rapoport
2026-05-18 12:40 ` Pasha Tatashin [this message]
2026-05-17 19:26 ` [PATCH v4 4/5] liveupdate: fix u-a-f in luo_file_unpreserve_files() and luo_file_finish() Pasha Tatashin
2026-05-17 19:26 ` [PATCH v4 5/5] liveupdate: Remove unused ser field from struct luo_session Pasha Tatashin
2026-05-18 8:42 ` [PATCH v4 0/5] liveupdate: serialization safety and race fixes Mike Rapoport
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=agsIsQLQR8i1sF_A@plex \
--to=pasha.tatashin@soleen.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=dan.carpenter@linaro.org \
--cc=graf@amazon.com \
--cc=jbouron@amazon.com \
--cc=kexec@lists.infradead.org \
--cc=liaoyuanhong@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=piliu@redhat.com \
--cc=pratyush@kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=rppt@kernel.org \
--cc=skhawaja@google.com \
--cc=sourabhjain@linux.ibm.com \
/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