From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yw1-f171.google.com (mail-yw1-f171.google.com [209.85.128.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFCAB30C16E for ; Fri, 17 Jul 2026 17:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784308039; cv=none; b=XqZ0Q5PFkkdgXKfIqKFgJpwnXahgSiJ7LKKnxuNIpcbPVyddGYs8H3AkFOQB0GdUQHrJomboTumyiT021UdvYVXk09dHQAsekc7kYJWRhBUrPkdgP+1CXe88oS1O1Cxc8cwdd4hw4ztpSmUJsnwQNsaLtZCf4X7ouEbh1DqH+NM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784308039; c=relaxed/simple; bh=hAQuitJW7qQjez5c/NHWPmdXOpei7vCFQ674pCMcye8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bzXovjvDMBfZmbN+i4OwMoxP1CRSzuWvZuoS1QsUxva9ekq0DP5HxC00N1nOm89putNBzJeFaUUeNP8sa4N3FGynVnKadpxNV81TALK/0WMbUCC3Jc1C33Ex/w2w4TStyhJ6a7F164rmmtED4WLTprGXUj2NZDMTCsyM8S69dYY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b=eKvzEB0R; arc=none smtp.client-ip=209.85.128.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="eKvzEB0R" Received: by mail-yw1-f171.google.com with SMTP id 00721157ae682-81ea0b7d137so74366057b3.2 for ; Fri, 17 Jul 2026 10:07:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1784308036; x=1784912836; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=dSNYl8Tp/9qUdH5Q7cjRfYFqP/b1gMhyNsAj6RU4JXA=; b=eKvzEB0RHDM1oDCAJa7thDXZYBxqaLu14FOod30j6MfCUHJ82kqI8ZlwB8MZ9a0Sv9 MVxFiJwqgk7rgrBVyjJMQ5ZCw843MfB1GY3Lu+RtyMO3nHiPv6oN5swhN+UNJfhWy7PZ 5k5X5Fu46kc66vRhGDB5HCI3sO7+JRmaRgjckZUOcC7GqibGRc9iGUnVJ38IvZ6H8N2d iUnHYUdDFJASawFMYjEuo8DA0a8rmq4MONAxBWnkq2mILuHGCj6fAiZcTf8Zqx5soNDb RlNGDtXK6ci5q3PTERaYCD/Vj66GE04FumGxQDErn9Ey0/uu3fYem/H1Zyk90nVYNhlb UtNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784308036; x=1784912836; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=dSNYl8Tp/9qUdH5Q7cjRfYFqP/b1gMhyNsAj6RU4JXA=; b=gVENU7xyvOW8bAC/vrotC/4iKdrQ219JDLo8KCTxC/SWUlvZIXtwp/lIqL66pG4m3Y JIeR8eDvL8m5hSx1PxlnSFt+S9noc0+DghuOuwQ5XDWumJGxea5cJOnsf6ENeNHbWVad KyGdhLtLjC3q+tfU+XM1T9ijXPY/ff9+HdnNU5KPkNrQewsfBKAhral7zQ9KQWehqP02 v1xpAl4G5Trgw7zLZtkJ67etiALuE4DGWiifzfg/ND9H3OQSE2OkWDTepBk2uX8Y1VSH wdUqbiNdIIW2BKKKuj1N5DsiI/DqM9ccBDQ5fXac3rNL6HbR9uX8Gt+rTfHX5FqHKaGE ijKw== X-Forwarded-Encrypted: i=1; AHgh+RqG1zDjUs0xAS/I6hTuQ7vZgdy+N1EDwGp3VuFhzql5vjkxlFavFizphp5y2i7PNSGeQJIezTPz3rEAcuQ=@vger.kernel.org X-Gm-Message-State: AOJu0YytrdK/gBvwpk1bIQlxU1TRIDhLJICfy26jjN0ZSEDzX0NPxKfq XpQpywfOVjCTtwE3A7bDIxiU9WLaYka2WJLXBRJgMQeVyftKN0Qz/WPNJp3UxXQuJYw= X-Gm-Gg: AfdE7clV2KDRH9a3SOqTJWmaI7YAhJ4GPo8aUocfNmMu2Xsyl/Zk+yGCsikMvP+H0oH YO2UiND1J/T69ABRA3LfK+QlUi4XF6Kb4Z3kb5YQS6JwGQmQMSJIuVFKjERxU9kj/2HajYjfofk w/WJH0qUvGmPwCgA7t2kEQlg106RCquGFeppMUUgH4QMXV43yIAbhXLTUM+PeJez6K3cGP7RT52 t1UpTmoRi+2pUcufOcbw9fq8iw1AFCwSaHw/aWBngq9vV7R0mm4Rowuve5SD3dVhea++qXxEROG xnX92UnuCg0rz8VADYf3feqNttupQzw8uYVfPf2rCnlpjYSAWNj1JwrlsrtrPL35nWZlwE+Vbgk hW5Oz0/lc7zTL2xr7AfxlOTTII7yZnnQhYhYHMUwctNZJy1LWki3Utf7qfiV6zs8geptJF/ik+/ c6wVrJ6d5LnSQ9KmbT5J7ZvIRds79Vm++kdVwrNoqb4ZtGLATNu/5cTAz377UbOrgZJhUkKRTmf pLy0LFo3mJ7 X-Received: by 2002:a05:690c:600a:b0:81e:a471:e8b2 with SMTP id 00721157ae682-81ef2735e55mr13299087b3.2.1784308027486; Fri, 17 Jul 2026 10:07:07 -0700 (PDT) Received: from google.com (138.200.150.34.bc.googleusercontent.com. [34.150.200.138]) by smtp.gmail.com with ESMTPSA id 00721157ae682-81ef42eb72asm14759947b3.47.2026.07.17.10.07.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2026 10:07:07 -0700 (PDT) Date: Fri, 17 Jul 2026 13:07:06 -0400 From: Pasha Tatashin To: Pratyush Yadav Cc: Pasha Tatashin , Jason Gunthorpe , David Matlack , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Mike Rapoport , Samiullah Khawaja , Shuah Khan , uca.boccassi@gmail.com Subject: Re: [RFC PATCH] liveupdate: Allow multiple openers for /dev/liveupdate Message-ID: References: <20260714190356.190328-1-dmatlack@google.com> <2vxzy0fcicpi.fsf@kernel.org> <20260715172336.GC3775915@nvidia.com> <2vxzh5lzhrgk.fsf@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2vxzh5lzhrgk.fsf@kernel.org> On 07-16 17:41, Pratyush Yadav wrote: > On Thu, Jul 16 2026, Pasha Tatashin wrote: > > > On 07-15 14:23, Jason Gunthorpe wrote: > >> On Wed, Jul 15, 2026 at 03:50:33PM +0200, Pratyush Yadav wrote: > >> > Hi David, > >> > > >> > On Tue, Jul 14 2026, David Matlack wrote: > >> > > >> > > Remove the single-opener restriction for /dev/liveupdate by removing the > >> > > atomic in_use tracking and the exclusive open check in luo_open() that > >> > > returned -EBUSY. Protect luo_session_deserialize() with a mutex guard so > >> > > that concurrent open attempts by multiple processes safely executes > >> > > deserialization only once. Update liveupdate selftest to verify that > >> > > multiple concurrent openers succeed. > >> > > > >> > > LUO does not inherently require a single opener. There is some > >> > > documentation about it simplifying state management, but the only thing > >> > > it actually protects is the session deserialization during first open, > >> > > which can be easily handled with a mutex. > >> > > > >> > > Relaxing the single-opener requirement avoids the kernel forcing a > >> > > design pattern on userspace that it itself does not require, e.g. > >> > > allowing multiple userspace processes to create and manage sessions. > >> > > >> > Agreed. When the kernel had a global state machine in the early versions > >> > of LUO, this might have been more relevant. With sessions, even if we > >> > later add a state machine, it likely will be per-session instead of > >> > being global. So I think letting userspace open /dev/liveupdate multiple > >> > times makes a lot of sense. > >> > > >> > Also, today's systemd only supports preserving individual files, and > >> > does not hand out sessions. To get sessions, userspace must open > > > > It should in the future, because of permissions issue, see below. > > > >> > /dev/liveupdate and create a session. This opens up room for one bad > >> > process to block every other process from creating sessions. It also > >> > imposes a need for userspace to add a polling/retry logic for getting > >> > sessions and serializes their execution around this point. > >> > >> Shouldn't systemd open and own /dev/liveupdate? That was at least what > >> I originally expected here, you'd talk to it and get a session FD > >> through dbus. > >> > >> Moving to multi-opening /dev/liveupdate and removing visibility of > >> what sessions are open from systemd is a different model > >> > >> Not saying this patch is wrong or anything, but that I don't really > >> understand what kind of model you are going for now. > > > > CC ca for systemd's take. > > > > /dev/liveupdate should only be accessed by a privileged process, and > > sessions should be accessed by whoever originally created them. While > > this patch does not change the permissions, it paves the road for us to > > move in the wrong direction: instead of having a privileged userspace > > manager that distributes the sessions to their rightful owners, it > > encourages userspace to work around the permissions so that VMMs access > > /dev/liveupdate to retrieve or store their sessions directly. This would > > also allow them to access sessions belonging to any other participant of > > the live update. > > But you can still do all this. In fact, systemd's release notes suggest > doing so [0]: > > Units can also create their own LUO Sessions by talking to the > kernel directly, and store them in their FD Stores, and those will > also be preserved and passed down to the unit after kexec They should not. Ideally, systemd should be the sole entity communicating directly with /dev/liveupdate. > > Having a single opener does not in practice prevent userspace from > creating sessions directly. All it does is to force them to turn the > open into a polling loop. So I don't think single open achieves the goal That is a fragile design, and they should avoid it. To be clear, I do not see any functional bugs in this patch, but I still do not understand the underlying use case. LUO should rely on a single manager agent that interacts with clients to create, preserve across reboots, and restore session IDs on their behalf. In fact, systemd is the only userspace process that AFAIK survives across the reboot() boundary; all other processes are terminated before reboot() is invoked. Relying on multiple independent LUO managers is therefore architecturally, wrong as they will close sessionfds. While the kernel can technically allow multiple openers for /dev/liveupdate, I do not see what problem this actually solves. Instead, it seems to encourage bad architectural decisions in userspace. > you think it should. Userspace already works around this restriction. > > So as long as we keep access to /dev/liveupdate restricted to privileged > processes, I don't see why single open is any better. What is the concrete use case for this patch, once we live in the world where systemd is fully capable of creating, storing, and retrieving sessions? > > [0] https://github.com/systemd/systemd/releases#release-v261 > > > > > Instead, sessions should be created and retrieved by a privileged > > process that knows to send them back to their rightful owner after > > retrieval. > > > > Also, as a minor concern, each userspace LUO manager needs its own > > session to maintain state. This means that by allowing multiple > > managers, they may run into naming conflicts for those state sessions. > > -- > Regards, > Pratyush Yadav