From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F4ADC83F05 for ; Sun, 6 Jul 2025 14:24:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 402646B0351; Sun, 6 Jul 2025 10:24:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B3376B0352; Sun, 6 Jul 2025 10:24:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A1BA6B0353; Sun, 6 Jul 2025 10:24:48 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0D7E26B0351 for ; Sun, 6 Jul 2025 10:24:48 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 4A4E51601EF for ; Sun, 6 Jul 2025 14:24:47 +0000 (UTC) X-FDA: 83634061014.03.190E5F0 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf20.hostedemail.com (Postfix) with ESMTP id A98381C000C for ; Sun, 6 Jul 2025 14:24:45 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="VB9VGt/8"; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf20.hostedemail.com: domain of rppt@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1751811885; a=rsa-sha256; cv=none; b=nublkFJSHKJvowUMFrpQRnvrluG9cI2VQFko5TQCmmmYkErjTIioukrmmvh7OqKek/+R5U 3TWQxN+eY3RlLGUkUn0chsnmfgegpMADoqYbUA+jzhVOr88T/Yj5cvRCE+VFaedkJz0OR9 DlE3XYScYQXm0KEVjI4soJmK7g1xZbo= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="VB9VGt/8"; dmarc=pass (policy=quarantine) header.from=kernel.org; spf=pass (imf20.hostedemail.com: domain of rppt@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1751811885; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VABgc374FgTxa+mEYJ1zbkfEDUICqXTmdLadjsH3ivM=; b=m3hdgTvyfJUolfkt9+DAngZtu7rAhWCNc21QP+0rYZVG4aSpwjjFT1YwkQSMIOG7ZmL+/5 18ggGMCG6dLnLhxaotq2LQNjVJqNrb219UHsO7SmlML6lv3L3dNF1NTfrHT4wdD6cgcHk1 bbP+raA6sd76fWDXY/EzziYQsg/1SQI= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id B3A69A402BA; Sun, 6 Jul 2025 14:24:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20F90C4CEED; Sun, 6 Jul 2025 14:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751811884; bh=8EiPuAexIkAYxOcKfap4/XV/a6nUkUFc1HdHwQaBiTc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VB9VGt/8+MSogNJP5j7QmiGc/jfaGRHsqlzpLpQpLJO6KnxsKLmVp2127TbXYTXRp GhHRXvpLpJnCJqEvqoKZ4vm/EJK8Ug7MrwmDLyrK7XbglSPXNTGARAs/wjyzwYy9P4 kMPvU2wXRd//0XBcqHCYDnESxmUbNiIG8sWEkks0pnfKcqj54LDLXLYzvMiDxGw226 lwsoWu/QaOi0PD0nnlbtbh1TP6Nh3T/h2NVveuw/4zSblE5o0HgbqVvxyE4y4PLuWE Qz6vzsqVg1LLJv2zRjel/GAxQ4MvGedbnAp+yZCk9VQbTdIYG7YoyPlAKzRkLQeayP sWxO9iXbSi+lg== Date: Sun, 6 Jul 2025 17:24:22 +0300 From: Mike Rapoport To: Christian Brauner Cc: Pasha Tatashin , pratyush@kernel.org, jasonmiu@google.com, graf@amazon.com, changyuanl@google.com, dmatlack@google.com, rientjes@google.com, corbet@lwn.net, rdunlap@infradead.org, ilpo.jarvinen@linux.intel.com, kanie@linux.alibaba.com, ojeda@kernel.org, aliceryhl@google.com, masahiroy@kernel.org, akpm@linux-foundation.org, tj@kernel.org, yoann.congal@smile.fr, mmaurer@google.com, roman.gushchin@linux.dev, chenridong@huawei.com, axboe@kernel.dk, mark.rutland@arm.com, jannh@google.com, vincent.guittot@linaro.org, hannes@cmpxchg.org, dan.j.williams@intel.com, david@redhat.com, joel.granados@kernel.org, rostedt@goodmis.org, anna.schumaker@oracle.com, song@kernel.org, zhangguopeng@kylinos.cn, linux@weissschuh.net, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, gregkh@linuxfoundation.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, rafael@kernel.org, dakr@kernel.org, bartosz.golaszewski@linaro.org, cw00.choi@samsung.com, myungjoo.ham@samsung.com, yesanishhere@gmail.com, Jonathan.Cameron@huawei.com, quic_zijuhu@quicinc.com, aleksander.lobakin@intel.com, ira.weiny@intel.com, andriy.shevchenko@linux.intel.com, leon@kernel.org, lukas@wunner.de, bhelgaas@google.com, wagi@kernel.org, djeffery@redhat.com, stuart.w.hayes@gmail.com, ptyadav@amazon.de Subject: Re: [RFC v2 10/16] luo: luo_ioctl: add ioctl interface Message-ID: References: <20250515182322.117840-1-pasha.tatashin@soleen.com> <20250515182322.117840-11-pasha.tatashin@soleen.com> <20250624-akzeptabel-angreifbar-9095f4717ca4@brauner> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250624-akzeptabel-angreifbar-9095f4717ca4@brauner> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A98381C000C X-Stat-Signature: fakgkh4obejb6ysx1rj7p7duuo85so5k X-Rspam-User: X-HE-Tag: 1751811885-37035 X-HE-Meta: U2FsdGVkX18Wz74y4Wu+HKW+OBDZhvIKJ8w+p3IkzK7PF6s93ylTc2tmOeVyJE6y8lkj2ZGyVWxnDDbPu1Q4HRUHVovu/es3lfulybGneSivaaDdjBeSWy2SDvl2jeRnXPGEmN6AYIO0XtO/FpqJImqZ4XAKDqQsCslSGcfnXswEc+pTIflMk9tMgn7DztPvC6q/U52G9zOnep+sZir58zMEcEJqo9v6xcPhsikah1j6EIpzWq5ZNTXR5HjHqe7JC6oHs/0B9S7w6sEEXOvz88L1lqzJ1Oj4rCuIHVpdQRuSGOptp0KyDseYX/BhcH6FvNKYtgngtaDfdn9M3JNiEvsHdXegBNfL54NwfNfVYzGZ4YzmssOhWqzBZG2ZNZ3H6pF/NDXIyygIa2pln9HQhCptLeFZBBqjsrfZm6y1oaBUqNlXq6Qka3RNNWUrs2lx0gQoRC6z2WXaqRXDs2lUc315ya1largJrDBQFckfiiCW78p5FrpL74z+3oXVEDGfRSlCAjjapSlDW5uajmormO8qmx1JY4aCzRZLLfOePJbZK6LP3pY0Ph/4c3rR8nt/6VcA0NRgG7iQYr3ro6Gs1yto0jiGcDIRM5pRcP+unsefrZqLSDxuVACMQ1gtSRnVgU2F7oYUVtNL9w36FqUi2srhQhByouP6mMAowYs+4mA/bU8C1LXorfAMloacakO0pr1s7PVJ0+TzfB67Ypqk9jIpmzFjisjF3bJ2q+Uow8XRm+mpBLSsompj/bPyJRET26I9bC3JHhH6ba5QPWtEAzjGuDeyryB5w8IYqXoz/0fMe6UOAGQrOApf/WdMVqaqGoYMv9mocNFjMtZfJ0o8lmBl56TmOupZ+wrNlRzychzkjXbhIw2GV6uZWeR9oNRkTTkfFcSY8uZm1qqx+/pwx0BPq2kAZ6t+7TCjMGir06VanpMGt4WaUP4ToC/SmYdhdtDM/ZsIE1WC/N+J14H DoOyCG2A dUJg5qJSZylx/MbBkvQ01sgEEo4m6GtDUssgO54V1pIXBCmAjJeCa5GBVgOXEbTCi5m2l5v3W8816hCWt3RgMfJsOIO+2HQR+GYBKKxI41Hl2HDAbrwA9VHU/jIsTi8r1FbHPFAXw7xx8ZcsU3zCcZ6E0Mdxj4R6svBa159+WvuqGByRl5Nc1Zoie7B6nldJ91ZjpoSG6CX2erq6UVo8M83himEapqcgcPJxUwnySl7G6WUI2AAj7eearXOQpsVjzhfgiP5Ernn7QikLydA/VhuH71IgupovsbQ7H31yoK0j5KMs/wlIcutT8qTJyy0w3sHpeoUYV6oI4gzzr/4+6WiuZqvd+mL6i9iWlt/s/2rnbfEdgYW5pyHrHk2sw/Wb2pnapaOQxZ6HQcg0OY+tcDlNx/mbmM/7Hh1icanYugvibLug= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, Jun 24, 2025 at 11:50:49AM +0200, Christian Brauner wrote: > On Thu, May 15, 2025 at 06:23:14PM +0000, Pasha Tatashin wrote: > > Introduce the user-space interface for the Live Update Orchestrator > > via ioctl commands, enabling external control over the live update > > process and management of preserved resources. > > > > Create a misc character device at /dev/liveupdate. Access > > to this device requires the CAP_SYS_ADMIN capability. > > > > A new UAPI header, , defines the necessary > > structures. The magic number is registered in > > Documentation/userspace-api/ioctl/ioctl-number.rst. > > > > Signed-off-by: Pasha Tatashin > > --- > > .../userspace-api/ioctl/ioctl-number.rst | 1 + > > drivers/misc/liveupdate/Makefile | 1 + > > drivers/misc/liveupdate/luo_ioctl.c | 199 ++++++++++++ > > include/linux/liveupdate.h | 34 +- > > include/uapi/linux/liveupdate.h | 300 ++++++++++++++++++ > > 5 files changed, 502 insertions(+), 33 deletions(-) > > create mode 100644 drivers/misc/liveupdate/luo_ioctl.c > > create mode 100644 include/uapi/linux/liveupdate.h ... > > +static const struct file_operations fops = { > > + .owner = THIS_MODULE, > > + .open = luo_open, > > + .unlocked_ioctl = luo_ioctl, > > +}; > > + > > +static struct miscdevice liveupdate_miscdev = { > > + .minor = MISC_DYNAMIC_MINOR, > > + .name = "liveupdate", > > + .fops = &fops, > > +}; > > I'm not sure why people are so in love with character device based apis. > It's terrible. It glues everything to devtmpfs which isn't namespacable > in any way. It's terrible to delegate and extremely restrictive in terms > of extensiblity if you need additional device entries (aka the loop > driver folly). > > One stupid question: I probably have asked this before and just swapped > out that I a) asked this already and b) received an explanation. But why > isn't this a singleton simple in-memory filesystem with a flat > hierarchy? > > mount -t kexecfs kexecfs /kexecfs > > So userspace mounts kexecfs (or the kernel does it automagically) and > then to add fds into that thing you do the following: > > linkat(fd_my_anon_inode_memfd, "", -EBADF, "kexecfs/my_serialized_memfd", AT_EMPTY_PATH) Having an ability to link a file descriptor to kexecfs would have been nice. We could even create a dependency hierarchy there, e.g. mkdir -p kexecfs/vm1/kvm/{iommu,memfd} linkat(kvmfd, "", -EBADF, "kexecfs/vm1/kvm/kvmfd", AT_EMPTY_PATH) linkat(iommufd, "", -EBADF, "kexecfs/vm1/kvm/iommu/iommufd", AT_EMPTY_PATH) linkat(memfd, "", -EBADF, "kexecfs/vm1/kvm/memfd/memfd", AT_EMPTY_PATH) But unfortunately this won't work because VFS checks that new and old paths are on the same mount. And even if cross-mount links were allowed, VFS does not pass the file objects to link* APIs, so preserving a file backed by anon_inode is another issue. > which will serialize the fd_my_anon_inode_memfd. You can also do this > with ioctls on the kexecfs filesystem of course. ioctls seem to be the only option, but I agree they don't have to be bound to a miscdev. -- Sincerely yours, Mike.