liveupdate: add LUO_SESSION_MAGIC magic inode type
Subsystems (3)
PATCH 1/1 liveupdate: add LUO_SESSION_MAGIC magic inode type
From: Luca Boccassi <[email protected]>
In userspace when managing LUO sessions we want to be able to identify a FD as a LUO session, in order to be able to do the special handling that they require in order to function as intended on kexec.
Currently this requires scraping procfs and doing string matching on the prefix of the dname, which is not an ideal interface.
Add a singleton inode type with a magic value, so that we can programmatically identify a fd as a LUO session via fstat().
Signed-off-by Luca Boccassi <[email protected]>
---
This was requested by Lennart and Christian when discussing integration with systemd for LUO management.
include/uapi/linux/magic.h | 1 + kernel/liveupdate/luo_core.c | 6 +++ kernel/liveupdate/luo_internal.h | 1 + kernel/liveupdate/luo_session.c | 67 +++++++++++++++++++++++++++++--- 4 files changed, 70 insertions(+), 5 deletions(-)
include/uapi/linux/magic.h +1 -0
@@ -105,5 +105,6 @@#define PID_FS_MAGIC 0x50494446/* "PIDF" */ #define GUEST_MEMFD_MAGIC 0x474d454d/* "GMEM" */ #define NULL_FS_MAGIC 0x4E554C4C/* "NULL" */ +#define LUO_SESSION_MAGIC 0x4c554f53/* "LUOS" */ #endif /* __LINUX_MAGIC_H__ */
kernel/liveupdate/luo_core.c +6 -0
@@ -197,6 +197,12 @@ static int __init luo_late_startup(void)if (!liveupdate_enabled ())return 0 ; + err =luo_session_fs_init (); +if (err) { + luo_global.enabled = false; +return err; + } + err =luo_fdt_setup ();if (err) luo_global.enabled = false;
kernel/liveupdate/luo_internal.h +1 -0
@@ -79,6 +79,7 @@ struct luo_session {int luo_session_create (const char *name,struct file **filep);int luo_session_retrieve (const char *name,struct file **filep); +int __init luo_session_fs_init (void );int __init luo_session_setup_outgoing (void *fdt);int __init luo_session_setup_incoming (void *fdt);int luo_session_serialize (void );
kernel/liveupdate/luo_session.c +62 -5
97 lines not on this page · raw message
Signature · 1 line
2.47.3