| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/06/25 06:07 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": [
"LIVEUPDATE",
"LIVEUPDATE_EVENTFD",
"EVENTFD"
],
"FocusSymbols": [
"eventfd_luo_preserve",
"eventfd_luo_freeze",
"eventfd_luo_unpreserve",
"eventfd_luo_retrieve",
"eventfd_luo_finish",
"eventfd_luo_can_preserve",
"eventfd_luo_get_state",
"eventfd_create"
],
"Reasoning": "The patch adds Live Update Orchestrator (LUO) support for eventfd, allowing eventfd state to be preserved across kexec. This introduces new reachable kernel logic for preserving and restoring eventfd state, which should be fuzzed.",
"WorthFuzzing": true
} |
| 1/1 | 2026/06/25 06:07 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 221afd3398875eb14d9b7d7d2a019c41be94c90b\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Thu Jun 25 06:07:56 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/fs/Makefile b/fs/Makefile\nindex 89a8a9d207d1c5..36d568e6cfc73e 100644\n--- a/fs/Makefile\n+++ b/fs/Makefile\n@@ -27,6 +27,7 @@ obj-y\t\t\t\t+= anon_inodes.o\n obj-$(CONFIG_SIGNALFD)\t\t+= signalfd.o\n obj-$(CONFIG_TIMERFD)\t\t+= timerfd.o\n obj-$(CONFIG_EVENTFD)\t\t+= eventfd.o\n+obj-$(CONFIG_LIVEUPDATE_EVENTFD)+= eventfd_luo.o\n obj-$(CONFIG_AIO) += aio.o\n obj-$(CONFIG_FS_DAX)\t\t+= dax.o\n obj-$(CONFIG_FS_ENCRYPTION)\t+= crypto/\ndiff --git a/fs/eventfd.c b/fs/eventfd.c\nindex 9d33a02757d52b..9b76cf06135a86 100644\n--- a/fs/eventfd.c\n+++ b/fs/eventfd.c\n@@ -376,6 +376,40 @@ struct eventfd_ctx *eventfd_ctx_fileget(struct file *file)\n }\n EXPORT_SYMBOL_GPL(eventfd_ctx_fileget);\n \n+/**\n+ * eventfd_luo_get_state - Get eventfd state (count and flags) for LUO\n+ * @file: Eventfd file\n+ * @count: Output parameter for count value\n+ * @flags: Output parameter for flags value\n+ *\n+ * This function is exported for use by LUO to safely read eventfd state.\n+ * Since struct eventfd_ctx is defined in this file, we can access its\n+ * members directly here. The function uses the wait queue lock to ensure\n+ * atomic access to count.\n+ *\n+ * Returns 0 on success, negative error code on failure.\n+ */\n+int eventfd_luo_get_state(struct file *file, __u64 *count, unsigned int *flags)\n+{\n+\tstruct eventfd_ctx *ctx;\n+\tunsigned long irq_flags;\n+\n+\tctx = eventfd_ctx_fileget(file);\n+\tif (IS_ERR(ctx))\n+\t\treturn PTR_ERR(ctx);\n+\n+\t/* Read count with lock (flags don't need lock) */\n+\tspin_lock_irqsave(\u0026ctx-\u003ewqh.lock, irq_flags);\n+\t*count = ctx-\u003ecount;\n+\tspin_unlock_irqrestore(\u0026ctx-\u003ewqh.lock, irq_flags);\n+\n+\t*flags = ctx-\u003eflags;\n+\n+\teventfd_ctx_put(ctx);\n+\treturn 0;\n+}\n+EXPORT_SYMBOL_GPL(eventfd_luo_get_state);\n+\n static int do_eventfd(unsigned int count, int flags)\n {\n \tstruct eventfd_ctx *ctx __free(kfree) = NULL;\n@@ -411,6 +445,12 @@ static int do_eventfd(unsigned int count, int flags)\n \treturn fd_publish(fdf);\n }\n \n+int eventfd_create(__u64 count, unsigned int flags)\n+{\n+\treturn do_eventfd(count, flags);\n+}\n+EXPORT_SYMBOL_GPL(eventfd_create);\n+\n SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags)\n {\n \treturn do_eventfd(count, flags);\ndiff --git a/fs/eventfd_luo.c b/fs/eventfd_luo.c\nnew file mode 100644\nindex 00000000000000..781d90635c52ae\n--- /dev/null\n+++ b/fs/eventfd_luo.c\n@@ -0,0 +1,250 @@\n+// SPDX-License-Identifier: GPL-2.0\n+/*\n+ * Copyright (C) 2026 KylinSoft Corporation.\n+ * Author: Chenghao Duan \u003cduanchenghao@kylinos.cn\u003e\n+ */\n+\n+/**\n+ * DOC: Eventfd Preservation via LUO\n+ *\n+ * Overview\n+ * ========\n+ *\n+ * Event file descriptors (eventfd) can be preserved over a kexec using the Live\n+ * Update Orchestrator (LUO) file preservation. This allows userspace applications\n+ * that use eventfd for event notification to maintain their state across kernel\n+ * updates.\n+ *\n+ * Eventfd is a simple notification mechanism that uses a 64-bit counter for\n+ * signaling events between userspace processes or between userspace and kernel.\n+ * The preservation ensures that pending events and configuration are not lost\n+ * during kexec.\n+ *\n+ * The preservation is not intended to be transparent. Only select properties of\n+ * the eventfd are preserved. All others are reset to default. The preserved\n+ * properties are described below.\n+ *\n+ * Preserved Properties\n+ * ====================\n+ *\n+ * The following properties of the eventfd are preserved across kexec:\n+ *\n+ * Counter Value\n+ * The current 64-bit counter value is preserved. This includes any pending\n+ * events that have been signaled but not yet consumed by readers.\n+ *\n+ * File Flags\n+ * The creation flags (EFD_SEMAPHORE, EFD_CLOEXEC, EFD_NONBLOCK) are preserved.\n+ * These control the behavior of read/write operations and file descriptor\n+ * inheritance.\n+ *\n+ * Non-Preserved Properties\n+ * ========================\n+ *\n+ * All properties which are not preserved must be assumed to be reset to\n+ * default. This section describes some of those properties which may be more of\n+ * note.\n+ *\n+ * File Descriptor Number\n+ * The file descriptor number itself is not preserved. After restore, the\n+ * eventfd will be assigned a new file descriptor number in the target process.\n+ *\n+ * Wait Queue State\n+ * Any processes currently blocked on read() operations will be woken up and\n+ * need to re-establish their blocking state if desired.\n+ *\n+ * File Position\n+ * Eventfd files don't have a traditional file position, but any internal\n+ * state related to the file descriptor is reset.\n+ */\n+\n+#include \u003clinux/err.h\u003e\n+#include \u003clinux/file.h\u003e\n+#include \u003clinux/io.h\u003e\n+#include \u003clinux/kexec_handover.h\u003e\n+#include \u003clinux/kho/abi/eventfd.h\u003e\n+#include \u003clinux/liveupdate.h\u003e\n+#include \u003clinux/module.h\u003e\n+#include \u003clinux/eventfd.h\u003e\n+#include \u003clinux/anon_inodes.h\u003e\n+#include \u003clinux/idr.h\u003e\n+#include \u003clinux/slab.h\u003e\n+#include \u003clinux/wait.h\u003e\n+#include \u003clinux/kref.h\u003e\n+#include \u003clinux/fdtable.h\u003e\n+\n+static int eventfd_luo_preserve(struct liveupdate_file_op_args *args)\n+{\n+\tstruct eventfd_luo_ser *ser;\n+\tu64 count;\n+\tunsigned int flags;\n+\tint err = 0;\n+\n+\t/* Get eventfd state safely */\n+\terr = eventfd_luo_get_state(args-\u003efile, \u0026count, \u0026flags);\n+\tif (err) {\n+\t\tpr_err(\"Failed to get eventfd state: %d\\n\", err);\n+\t\treturn err;\n+\t}\n+\n+\tser = kho_alloc_preserve(sizeof(*ser));\n+\tif (IS_ERR(ser)) {\n+\t\terr = PTR_ERR(ser);\n+\t\tpr_err(\"Failed to allocate preserve memory: %d\\n\", err);\n+\t\treturn err;\n+\t}\n+\n+\t/* Save eventfd state */\n+\tser-\u003ecount = count;\n+\tser-\u003eflags = flags;\n+\n+\tpr_debug(\"Preserved eventfd: count=%llu, flags=0x%x\\n\",\n+\t\tser-\u003ecount, ser-\u003eflags);\n+\n+\t/* Return physical address of serialization structure */\n+\targs-\u003eserialized_data = virt_to_phys(ser);\n+\n+\treturn 0;\n+}\n+\n+static int eventfd_luo_freeze(struct liveupdate_file_op_args *args)\n+{\n+\tstruct eventfd_luo_ser *ser;\n+\tu64 count;\n+\tunsigned int flags;\n+\tint err;\n+\n+\tif (WARN_ON_ONCE(!args-\u003eserialized_data))\n+\t\treturn -EINVAL;\n+\n+\tser = phys_to_virt(args-\u003eserialized_data);\n+\n+\t/* Get current state and update if changed */\n+\terr = eventfd_luo_get_state(args-\u003efile, \u0026count, \u0026flags);\n+\tif (err)\n+\t\treturn err;\n+\n+\tif (ser-\u003ecount != count) {\n+\t\tpr_debug(\"WARNING: Count changed during preserve-\u003efreeze! old=%llu, new=%llu\\n\",\n+\t\t\t ser-\u003ecount, count);\n+\t}\n+\n+\tser-\u003ecount = count;\n+\n+\treturn 0;\n+}\n+\n+static void eventfd_luo_unpreserve(struct liveupdate_file_op_args *args)\n+{\n+\tstruct eventfd_luo_ser *ser;\n+\n+\tif (WARN_ON_ONCE(!args-\u003eserialized_data))\n+\t\treturn;\n+\n+\tser = phys_to_virt(args-\u003eserialized_data);\n+\tkho_unpreserve_free(ser);\n+}\n+\n+static int eventfd_luo_retrieve(struct liveupdate_file_op_args *args)\n+{\n+\tstruct eventfd_luo_ser *ser;\n+\tstruct eventfd_ctx *ctx;\n+\tstruct file *file = NULL;\n+\tint eventfd;\n+\n+\tser = phys_to_virt(args-\u003eserialized_data);\n+\tif (!ser)\n+\t\treturn -EINVAL;\n+\n+\t/* Create a new eventfd with the preserved count and flags */\n+\teventfd = eventfd_create(ser-\u003ecount, ser-\u003eflags);\n+\tif (eventfd \u003c 0) {\n+\t\tpr_err(\"Failed to create eventfd: %d\\n\", eventfd);\n+\t\treturn eventfd;\n+\t}\n+\n+\tfile = fget(eventfd);\n+\tif (!file) {\n+\t\tpr_err(\"Failed to get file from fd\\n\");\n+\t\tclose_fd(eventfd);\n+\t\treturn -EBADF;\n+\t}\n+\n+\tclose_fd(eventfd);\n+\n+\t/* Verify the created file has correct internal state */\n+\tctx = eventfd_ctx_fileget(file);\n+\tif (IS_ERR(ctx)) {\n+\t\tpr_err(\"Failed to get context from file\\n\");\n+\t\tfput(file);\n+\t\treturn PTR_ERR(ctx);\n+\t}\n+\n+\teventfd_ctx_put(ctx);\n+\n+\targs-\u003efile = file;\n+\treturn 0;\n+}\n+\n+static void eventfd_luo_finish(struct liveupdate_file_op_args *args)\n+{\n+\tstruct eventfd_luo_ser *ser;\n+\n+\tif (args-\u003eretrieve_status)\n+\t\treturn;\n+\n+\tif (!args-\u003eserialized_data)\n+\t\treturn;\n+\n+\tser = phys_to_virt(args-\u003eserialized_data);\n+\tif (!ser)\n+\t\treturn;\n+\n+\tkho_restore_free(ser);\n+}\n+\n+static bool eventfd_luo_can_preserve(struct liveupdate_file_handler *handler,\n+\t\t\t\t struct file *file)\n+{\n+\tstruct eventfd_ctx *ctx;\n+\n+\tif (!file-\u003ef_op)\n+\t\treturn false;\n+\n+\t/* Try to get eventfd context - this will fail if not an eventfd */\n+\tctx = eventfd_ctx_fileget(file);\n+\tif (IS_ERR(ctx))\n+\t\treturn false;\n+\n+\teventfd_ctx_put(ctx);\n+\treturn true;\n+}\n+\n+static const struct liveupdate_file_ops eventfd_luo_file_ops = {\n+\t.preserve = eventfd_luo_preserve,\n+\t.unpreserve = eventfd_luo_unpreserve,\n+\t.freeze = eventfd_luo_freeze,\n+\t.retrieve = eventfd_luo_retrieve,\n+\t.finish = eventfd_luo_finish,\n+\t.can_preserve = eventfd_luo_can_preserve,\n+\t.owner = THIS_MODULE,\n+};\n+\n+static struct liveupdate_file_handler eventfd_luo_handler = {\n+\t.ops = \u0026eventfd_luo_file_ops,\n+\t.compatible = EVENTFD_LUO_FH_COMPATIBLE,\n+};\n+\n+static int __init eventfd_luo_init(void)\n+{\n+\tint err = liveupdate_register_file_handler(\u0026eventfd_luo_handler);\n+\n+\tif (err \u0026\u0026 err != -EOPNOTSUPP) {\n+\t\tpr_err(\"Could not register eventfd LUO handler: %pe\\n\",\n+\t\t ERR_PTR(err));\n+\t\treturn err;\n+\t}\n+\n+\treturn 0;\n+}\n+late_initcall(eventfd_luo_init);\ndiff --git a/include/linux/eventfd.h b/include/linux/eventfd.h\nindex e32bee4345fb9f..703e1a126c4d40 100644\n--- a/include/linux/eventfd.h\n+++ b/include/linux/eventfd.h\n@@ -35,6 +35,8 @@ void eventfd_ctx_put(struct eventfd_ctx *ctx);\n struct file *eventfd_fget(int fd);\n struct eventfd_ctx *eventfd_ctx_fdget(int fd);\n struct eventfd_ctx *eventfd_ctx_fileget(struct file *file);\n+int eventfd_luo_get_state(struct file *file, __u64 *count, unsigned int *flags);\n+int eventfd_create(__u64 count, unsigned int flags);\n void eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask);\n int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait,\n \t\t\t\t __u64 *cnt);\ndiff --git a/include/linux/kho/abi/eventfd.h b/include/linux/kho/abi/eventfd.h\nnew file mode 100644\nindex 00000000000000..148beac6bcc760\n--- /dev/null\n+++ b/include/linux/kho/abi/eventfd.h\n@@ -0,0 +1,39 @@\n+/* SPDX-License-Identifier: GPL-2.0 */\n+/*\n+ * Copyright (C) 2026 KylinSoft Corporation.\n+ * Author: Chenghao Duan \u003cduanchenghao@kylinos.cn\u003e\n+ */\n+\n+#ifndef _LINUX_KHO_ABI_EVENTFD_H\n+#define _LINUX_KHO_ABI_EVENTFD_H\n+\n+#include \u003clinux/types.h\u003e\n+\n+/*\n+ * Eventfd Live Update ABI\n+ *\n+ * This header defines the ABI for preserving eventfd state across kexec.\n+ *\n+ * The state is serialized into a packed structure `struct eventfd_luo_ser`\n+ * which is handed over to the next kernel via the KHO mechanism.\n+ *\n+ */\n+\n+/**\n+ * struct eventfd_luo_ser - Serialized state of an eventfd\n+ * @count: The current counter value\n+ * @flags: File flags (EFD_SEMAPHORE, EFD_CLOEXEC, EFD_NONBLOCK)\n+ *\n+ * This structure contains the minimal state needed to restore an eventfd\n+ * after kexec. The count represents the current value of the event counter,\n+ * and flags represent the file creation flags.\n+ */\n+struct eventfd_luo_ser {\n+\t__u64 count;\n+\tunsigned int flags;\n+} __packed;\n+\n+/* The compatibility string for eventfd file handler */\n+#define EVENTFD_LUO_FH_COMPATIBLE\t\"eventfd-v1\"\n+\n+#endif /* _LINUX_KHO_ABI_EVENTFD_H */\ndiff --git a/kernel/liveupdate/Kconfig b/kernel/liveupdate/Kconfig\nindex c13af38ba23ab8..1361b5733f412b 100644\n--- a/kernel/liveupdate/Kconfig\n+++ b/kernel/liveupdate/Kconfig\n@@ -86,4 +86,20 @@ config LIVEUPDATE_MEMFD\n \n \t If unsure, say N.\n \n+config LIVEUPDATE_EVENTFD\n+\tbool \"Eventfd Live Update Orchestrator support\"\n+\tdepends on EVENTFD\n+\tdepends on LIVEUPDATE\n+\thelp\n+\t Enable Live Update Orchestrator support for eventfd file descriptors.\n+\t This allows eventfd files to be preserved and restored across kexec\n+\t operations, maintaining their counter values and flags.\n+\n+\t Eventfd files are commonly used for event notification between\n+\t userspace processes or between userspace and kernel. With this\n+\t option enabled, eventfd state can be handed over to a new kernel\n+\t during live update operations.\n+\n+\t If unsure, say N.\n+\n endmenu\ndiff --git a/tools/testing/selftests/liveupdate/Makefile b/tools/testing/selftests/liveupdate/Makefile\nindex 30689d22cb0216..e092e38fa6f6c4 100644\n--- a/tools/testing/selftests/liveupdate/Makefile\n+++ b/tools/testing/selftests/liveupdate/Makefile\n@@ -8,6 +8,7 @@ TEST_GEN_PROGS_EXTENDED += luo_kexec_simple\n TEST_GEN_PROGS_EXTENDED += luo_multi_session\n TEST_GEN_PROGS_EXTENDED += luo_stress_sessions\n TEST_GEN_PROGS_EXTENDED += luo_stress_files\n+TEST_GEN_PROGS_EXTENDED += luo_test_eventfd\n \n TEST_FILES += do_kexec.sh\n \ndiff --git a/tools/testing/selftests/liveupdate/config b/tools/testing/selftests/liveupdate/config\nindex 91d03f9a6a3952..d388bd75524578 100644\n--- a/tools/testing/selftests/liveupdate/config\n+++ b/tools/testing/selftests/liveupdate/config\n@@ -9,3 +9,5 @@ CONFIG_LIVEUPDATE_TEST=y\n CONFIG_MEMFD_CREATE=y\n CONFIG_TMPFS=y\n CONFIG_SHMEM=y\n+CONFIG_EVENTFD=y\n+CONFIG_LIVEUPDATE_EVENTFD=y\ndiff --git a/tools/testing/selftests/liveupdate/luo_test_eventfd.c b/tools/testing/selftests/liveupdate/luo_test_eventfd.c\nnew file mode 100644\nindex 00000000000000..94ef3bc66ad971\n--- /dev/null\n+++ b/tools/testing/selftests/liveupdate/luo_test_eventfd.c\n@@ -0,0 +1,376 @@\n+// SPDX-License-Identifier: GPL-2.0-only\n+/*\n+ * Copyright (C) 2026 KylinSoft Corporation.\n+ * Author: Chenghao Duan \u003cduanchenghao@kylinos.cn\u003e\n+ */\n+\n+/*\n+ * Multi-session kexec selftest for eventfd LUO support.\n+ *\n+ * Modeled after luo_multi_session.c.\n+ * It creates multiple LUO sessions, each preserving different eventfd types,\n+ * and verifies them after kexec.\n+ */\n+\n+#include \u003cerrno.h\u003e\n+#include \u003cfcntl.h\u003e\n+#include \u003climits.h\u003e\n+#include \u003cstdint.h\u003e\n+#include \u003cstdio.h\u003e\n+#include \u003cstdlib.h\u003e\n+#include \u003cstring.h\u003e\n+#include \u003csys/eventfd.h\u003e\n+#include \u003csys/ioctl.h\u003e\n+#include \u003cunistd.h\u003e\n+\n+#include \"luo_test_utils.h\"\n+\n+/* Session names */\n+#define SESSION_EMPTY \"eventfd-empty\"\n+#define SESSION_DEFAULT \"eventfd-default\"\n+#define SESSION_SEM \"eventfd-sem\"\n+#define SESSION_NONBLOCK \"eventfd-nonblock\"\n+#define SESSION_LARGE \"eventfd-large\"\n+#define SESSION_MODIFIED \"eventfd-modified-after-preserve\"\n+\n+/* Tokens */\n+#define TOKEN_DEFAULT 0xCAFEBABE\n+#define TOKEN_SEM 0xDEADBEEF\n+#define TOKEN_NONBLOCK 0xFEEDBEEF\n+#define TOKEN_LARGE 0xBEEFCAFE\n+#define TOKEN_MODIFIED 0xABCD1234\n+\n+/* Counts */\n+#define COUNT_INITIAL 42\n+#define COUNT_WRITE 10\n+#define COUNT_EXPECTED (COUNT_INITIAL + COUNT_WRITE) /* 52 */\n+#define COUNT_SEM 5\n+#define COUNT_NONBLOCK 100\n+#define COUNT_LARGE ((unsigned int)-1) /* UINT_MAX */\n+#define COUNT_MODIFIED 25\n+#define COUNT_MODIFY_DELTA 99\n+\n+/* State tracking */\n+#define STATE_SESSION_NAME \"eventfd_multi_state\"\n+#define STATE_TOKEN 997\n+\n+/* Eventfd verification modes */\n+enum verify_mode {\n+\tVERIFY_FLAGS, /* Only verify flags, no behavior testing */\n+\tVERIFY_ONCE, /* Read once and verify count */\n+\tVERIFY_SEMAPHORE, /* Read multiple times, verify returns 1 each time */\n+\tVERIFY_NONBLOCK, /* Read once in nonblock mode */\n+\tVERIFY_LARGE /* Read once, verify large count */\n+};\n+\n+/* Test session configuration */\n+struct test_session_config {\n+\tconst char *session_name;\n+\tunsigned long token;\n+\tunsigned int count;\n+\tunsigned int flags;\n+\tenum verify_mode verify_mode;\n+\tconst char *desc;\n+};\n+\n+/* Test session configurations */\n+static const struct test_session_config test_configs[] = {\n+\t{SESSION_EMPTY, 0, 0, 0, VERIFY_FLAGS, \"Empty\"},\n+\t{SESSION_DEFAULT, TOKEN_DEFAULT, COUNT_EXPECTED, 0, VERIFY_ONCE, \"Default\"},\n+\t{SESSION_SEM, TOKEN_SEM, COUNT_SEM, EFD_SEMAPHORE, VERIFY_SEMAPHORE, \"Semaphore\"},\n+\t{SESSION_NONBLOCK, TOKEN_NONBLOCK, COUNT_NONBLOCK, EFD_NONBLOCK, VERIFY_NONBLOCK, \"Nonblock\"},\n+\t{SESSION_LARGE, TOKEN_LARGE, COUNT_LARGE, 0, VERIFY_LARGE, \"Large-count\"},\n+\t{SESSION_MODIFIED, TOKEN_MODIFIED, COUNT_MODIFIED + COUNT_MODIFY_DELTA, 0, VERIFY_ONCE, \"Modified after preserve (kexec handover)\"},\n+};\n+#define NUM_TEST_SESSIONS ARRAY_SIZE(test_configs)\n+\n+static int verify_eventfd_flags(int efd, unsigned int expected_flags, const char *desc)\n+{\n+\tint actual_flags = fcntl(efd, F_GETFL);\n+\n+\tif (actual_flags \u003c 0)\n+\t\treturn -errno;\n+\n+\tint expected_fd_flags = expected_flags \u0026 (EFD_NONBLOCK | EFD_CLOEXEC);\n+\tint actual_fd_flags = actual_flags \u0026 (O_NONBLOCK | O_CLOEXEC);\n+\n+\tif (actual_fd_flags != expected_fd_flags) {\n+\t\tksft_print_msg(\"%s: flag mismatch - expected 0x%x, got 0x%x\\n\",\n+\t\t\t desc, expected_fd_flags, actual_fd_flags);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tksft_print_msg(\" %s eventfd flags OK (0x%x)\\n\", desc, expected_fd_flags);\n+\treturn actual_flags; /* Return actual flags for further use */\n+}\n+\n+static int ensure_nonblock(int efd, int current_flags)\n+{\n+\treturn fcntl(efd, F_SETFL, current_flags | O_NONBLOCK);\n+}\n+\n+static int verify_count_once(int efd, unsigned int expected_count, const char *desc)\n+{\n+\tuint64_t val;\n+\n+\tif (read(efd, \u0026val, sizeof(val)) != sizeof(val))\n+\t\treturn -errno;\n+\n+\tif (val != (uint64_t)expected_count) {\n+\t\tksft_print_msg(\"%s: expected %u got %llu\\n\",\n+\t\t\t desc, expected_count, (unsigned long long)val);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tksft_print_msg(\" %s eventfd OK: %u\\n\", desc, expected_count);\n+\treturn 0;\n+}\n+\n+static int verify_semaphore_behavior(int efd, unsigned int expected_count, const char *desc)\n+{\n+\tuint64_t val;\n+\n+\t/* Read expected_count times, each should return 1 */\n+\tfor (unsigned int i = 0; i \u003c expected_count; i++) {\n+\t\tif (read(efd, \u0026val, sizeof(val)) != sizeof(val))\n+\t\t\treturn -errno;\n+\n+\t\tif (val != 1) {\n+\t\t\tksft_print_msg(\"%s: expected 1, got %llu at read %u\\n\",\n+\t\t\t\t desc, (unsigned long long)val, i + 1);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tksft_print_msg(\" %s eventfd OK: %u at read %u\\n\", desc, (unsigned int)val, i + 1);\n+\t}\n+\n+\t/* Next read should return EAGAIN (no more events) */\n+\tif (read(efd, \u0026val, sizeof(val)) \u003e= 0 || errno != EAGAIN) {\n+\t\tksft_print_msg(\"%s: expected EAGAIN after %u reads\\n\",\n+\t\t\t desc, expected_count);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tksft_print_msg(\" %s eventfd OK (%u reads)\\n\", desc, expected_count);\n+\treturn 0;\n+}\n+\n+static int restore_and_verify_eventfd_generic(int session_fd,\n+\t\t\t\t\t unsigned long token,\n+\t\t\t\t\t unsigned int expected_count,\n+\t\t\t\t\t unsigned int expected_flags,\n+\t\t\t\t\t enum verify_mode mode,\n+\t\t\t\t\t const char *desc)\n+{\n+\tstruct liveupdate_session_retrieve_fd arg = { .size = sizeof(arg) };\n+\tint efd, ret = 0, actual_flags;\n+\n+\targ.token = token;\n+\tif (ioctl(session_fd, LIVEUPDATE_SESSION_RETRIEVE_FD, \u0026arg) \u003c 0)\n+\t\treturn -errno;\n+\tefd = arg.fd;\n+\n+\tswitch (mode) {\n+\tcase VERIFY_FLAGS:\n+\t\t/* Only verify flags, no behavior testing */\n+\t\tret = verify_eventfd_flags(efd, expected_flags, desc);\n+\t\tif (ret \u003c 0)\n+\t\t\tclose(efd);\n+\t\treturn ret \u003c 0 ? ret : 0;\n+\n+\tcase VERIFY_SEMAPHORE:\n+\t\t/* Verify flags + semaphore behavior */\n+\t\tactual_flags = verify_eventfd_flags(efd, expected_flags, desc);\n+\t\tif (actual_flags \u003c 0) {\n+\t\t\tret = actual_flags;\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\tif (ensure_nonblock(efd, actual_flags) \u003c 0) {\n+\t\t\tret = -errno;\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\tret = verify_semaphore_behavior(efd, expected_count, desc);\n+\t\tbreak;\n+\n+\tcase VERIFY_ONCE:\n+\tcase VERIFY_NONBLOCK:\n+\tcase VERIFY_LARGE:\n+\t\t/* Verify flags + count behavior */\n+\t\tactual_flags = verify_eventfd_flags(efd, expected_flags, desc);\n+\t\tif (actual_flags \u003c 0) {\n+\t\t\tret = actual_flags;\n+\t\t\tgoto out;\n+\t\t}\n+\n+\t\tret = verify_count_once(efd, expected_count, desc);\n+\t\tbreak;\n+\n+\tdefault:\n+\t\tret = -EINVAL;\n+\t\tbreak;\n+\t}\n+\n+out:\n+\tclose(efd);\n+\treturn ret;\n+}\n+\n+static int create_and_preserve_eventfd_keep_fd(int session_fd,\n+\t\t\t\t\t unsigned long token,\n+\t\t\t\t\t unsigned int count,\n+\t\t\t\t\t unsigned int flags,\n+\t\t\t\t\t const char *desc,\n+\t\t\t\t\t int *efd_out)\n+{\n+\tstruct liveupdate_session_preserve_fd arg = { .size = sizeof(arg) };\n+\tint efd = eventfd(count, flags);\n+\n+\tif (efd \u003c 0)\n+\t\treturn -errno;\n+\n+\targ.fd = efd;\n+\targ.token = token;\n+\tif (ioctl(session_fd, LIVEUPDATE_SESSION_PRESERVE_FD, \u0026arg) \u003c 0) {\n+\t\tint ret = -errno;\n+\n+\t\tclose(efd);\n+\t\treturn ret;\n+\t}\n+\n+\tif (efd_out)\n+\t\t*efd_out = efd;\n+\telse\n+\t\tclose(efd);\n+\treturn 0;\n+}\n+\n+static int create_and_preserve_eventfd(int session_fd,\n+\t\t\t\t unsigned long token,\n+\t\t\t\t unsigned int count,\n+\t\t\t\t unsigned int flags,\n+\t\t\t\t const char *desc)\n+{\n+\treturn create_and_preserve_eventfd_keep_fd(session_fd, token, count,\n+\t\t\t\t\t\t flags, desc, NULL);\n+}\n+\n+static int create_session_checked(int luo_fd, const char *session_name)\n+{\n+\tint session_fd = luo_create_session(luo_fd, session_name);\n+\n+\tif (session_fd \u003c 0)\n+\t\tfail_exit(\"luo_create_session for '%s'\", session_name);\n+\treturn session_fd;\n+}\n+\n+static int retrieve_session_checked(int luo_fd, const char *session_name)\n+{\n+\tint session_fd = luo_retrieve_session(luo_fd, session_name);\n+\n+\tif (session_fd \u003c 0)\n+\t\tfail_exit(\"luo_retrieve_session for '%s'\", session_name);\n+\treturn session_fd;\n+}\n+\n+static void finish_session_checked(int session_fd, const char *session_name)\n+{\n+\tif (luo_session_finish(session_fd) \u003c 0)\n+\t\tfail_exit(\"luo_session_finish for '%s'\", session_name);\n+\tclose(session_fd);\n+}\n+\n+static int verify_eventfd_config(int session_fd, const struct test_session_config *config)\n+{\n+\treturn restore_and_verify_eventfd_generic(session_fd, config-\u003etoken,\n+\t\t\t\t\t\t config-\u003ecount, config-\u003eflags,\n+\t\t\t\t\t\t config-\u003everify_mode, config-\u003edesc);\n+}\n+\n+\n+static void run_stage_1(int luo_fd)\n+{\n+\tksft_print_msg(\"[STAGE 1] Starting pre-kexec setup for multi-eventfd test...\\n\");\n+\tksft_print_msg(\"[STAGE 1] Creating state file for next stage (2)...\\n\");\n+\tcreate_state_file(luo_fd, STATE_SESSION_NAME, STATE_TOKEN, 2);\n+\n+\t/* Create all test sessions */\n+\tfor (size_t i = 0; i \u003c NUM_TEST_SESSIONS; i++) {\n+\t\tconst struct test_session_config *config = \u0026test_configs[i];\n+\n+\t\tksft_print_msg(\"[STAGE 1] Creating session '%s'...\\n\", config-\u003esession_name);\n+\t\tint session_fd = create_session_checked(luo_fd, config-\u003esession_name);\n+\n+\t\t/* Special handling for modified session (preserve then modify) */\n+\t\tif (config-\u003etoken == TOKEN_MODIFIED) {\n+\t\t\tint preserved_efd;\n+\n+\t\t\tif (create_and_preserve_eventfd_keep_fd(session_fd,\n+\t\t\t\t\t\t\t\tconfig-\u003etoken,\n+\t\t\t\t\t\t\t\tCOUNT_MODIFIED,\n+\t\t\t\t\t\t\t\tconfig-\u003eflags,\n+\t\t\t\t\t\t\t\t\"modified-after-preserve\",\n+\t\t\t\t\t\t\t\t\u0026preserved_efd) \u003c 0)\n+\t\t\t\tfail_exit(\"create_and_preserve_eventfd_keep_fd modified\");\n+\n+\t\t\t/* Now modify the preserved eventfd's count */\n+\t\t\tuint64_t modify_value = COUNT_MODIFY_DELTA;\n+\n+\t\t\tif (write(preserved_efd, \u0026modify_value,\n+\t\t\t sizeof(modify_value)) != sizeof(modify_value))\n+\t\t\t\tfail_exit(\"write to preserved eventfd after preserve\");\n+\n+\t\t\tclose(preserved_efd);\n+\t\t} else {\n+\t\t\t/* Standard session creation */\n+\t\t\tif (create_and_preserve_eventfd(session_fd, config-\u003etoken,\n+\t\t\t\t\t\t\tconfig-\u003ecount, config-\u003eflags,\n+\t\t\t\t\t\t\tconfig-\u003edesc) \u003c 0)\n+\t\t\t\tfail_exit(\"create_and_preserve_eventfd %s\", config-\u003edesc);\n+\t\t}\n+\t}\n+\n+\tclose(luo_fd);\n+\tdaemonize_and_wait();\n+}\n+\n+static void run_stage_2(int luo_fd, int state_session_fd)\n+{\n+\tint session_fds[NUM_TEST_SESSIONS];\n+\tint stage;\n+\n+\tksft_print_msg(\"[STAGE 2] Starting post-kexec verification...\\n\");\n+\n+\trestore_and_read_stage(state_session_fd, STATE_TOKEN, \u0026stage);\n+\tif (stage != 2)\n+\t\tfail_exit(\"Expected stage 2, but state file contains %d\", stage);\n+\n+\tksft_print_msg(\"[STAGE 2] Retrieving all sessions...\\n\");\n+\tfor (size_t i = 0; i \u003c NUM_TEST_SESSIONS; i++)\n+\t\tsession_fds[i] = retrieve_session_checked(luo_fd, test_configs[i].session_name);\n+\n+\tksft_print_msg(\"[STAGE 2] Verifying eventfds...\\n\");\n+\tfor (size_t i = 0; i \u003c NUM_TEST_SESSIONS; i++) {\n+\t\tif (verify_eventfd_config(session_fds[i], \u0026test_configs[i]) \u003c 0)\n+\t\t\tfail_exit(\"verify %s eventfd\", test_configs[i].desc);\n+\t}\n+\n+\tksft_print_msg(\"[STAGE 2] All eventfd sessions verified successfully.\\n\");\n+\n+\tksft_print_msg(\"[STAGE 2] Finalizing all sessions...\\n\");\n+\tfor (size_t i = 0; i \u003c NUM_TEST_SESSIONS; i++)\n+\t\tfinish_session_checked(session_fds[i], test_configs[i].session_name);\n+\n+\tksft_print_msg(\"[STAGE 2] Finalizing state session...\\n\");\n+\tif (luo_session_finish(state_session_fd) \u003c 0)\n+\t\tfail_exit(\"luo_session_finish for state session\");\n+\tclose(state_session_fd);\n+\n+\tksft_print_msg(\"\\n--- EVENTFD_LUO TEST PASSED ---\\n\");\n+}\n+\n+int main(int argc, char *argv[])\n+{\n+\treturn luo_test(argc, argv, STATE_SESSION_NAME,\n+\t\t\trun_stage_1, run_stage_2);\n+}\n"
} |
| 2/1 | 2026/06/25 06:07 | agent | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: {
"EnableConfigs": [
"LIVEUPDATE",
"LIVEUPDATE_EVENTFD",
"EVENTFD"
],
"FocusSymbols": [
"eventfd_luo_preserve",
"eventfd_luo_freeze",
"eventfd_luo_unpreserve",
"eventfd_luo_retrieve",
"eventfd_luo_finish",
"eventfd_luo_can_preserve",
"eventfd_luo_get_state",
"eventfd_create"
],
"Reasoning": "The patch adds Live Update Orchestrator (LUO) support for eventfd, allowing eventfd state to be preserved across kexec. This introduces new reachable kernel logic for preserving and restoring eventfd state, which should be fuzzed.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer. Your job is to review a provided patch series and determine if it makes functional changes to the kernel that should be fuzzed. IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively use your code access tools to examine the actual source code and confirm any assumptions. Return WorthFuzzing=false if the patch only contains: - Modifications to Documentation/, Kconfig files, or code comments. - Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints. - Changes to numeric constants or macros that do not functionally alter execution flow. - Code paths that are impossible to reach in virtualized environments like GCE or QEMU, even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim). If it modifies reachable core kernel logic, drivers, or architectures, use your code search tools to verify the code can be executed, then return WorthFuzzing=true. When returning WorthFuzzing=true, you MUST ALSO: 1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols. Avoid listing generic hot-path functions to prevent skewed test distributions. 2. Identify any specific CONFIG_ options required to properly test this new/modified feature. Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions. Do not list too generic configs (we already have them enabled). Only list those that specifically cover the modified code. List them in the EnableConfigs output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4"). Prefer calling several tools at the same time to save round-trips. Use set-results tool to provide results of the analysis. It must be called exactly once before the final reply. Ignore results of this tool. Prompt: For your convenience, here is the diff of the changes:
commit 221afd3398875eb14d9b7d7d2a019c41be94c90b
Author: syz-cluster <triage@syzkaller.com>
Date: Thu Jun 25 06:07:56 2026 +0000
syz-cluster: applied patch under review
diff --git a/fs/Makefile b/fs/Makefile
index 89a8a9d207d1c5..36d568e6cfc73e 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -27,6 +27,7 @@ obj-y += anon_inodes.o
obj-$(CONFIG_SIGNALFD) += signalfd.o
obj-$(CONFIG_TIMERFD) += timerfd.o
obj-$(CONFIG_EVENTFD) += eventfd.o
+obj-$(CONFIG_LIVEUPDATE_EVENTFD)+= eventfd_luo.o
obj-$(CONFIG_AIO) += aio.o
obj-$(CONFIG_FS_DAX) += dax.o
obj-$(CONFIG_FS_ENCRYPTION) += crypto/
diff --git a/fs/eventfd.c b/fs/eventfd.c
index 9d33a02757d52b..9b76cf06135a86 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -376,6 +376,40 @@ struct eventfd_ctx *eventfd_ctx_fileget(struct file *file)
}
EXPORT_SYMBOL_GPL(eventfd_ctx_fileget);
+/**
+ * eventfd_luo_get_state - Get eventfd state (count and flags) for LUO
+ * @file: Eventfd file
+ * @count: Output parameter for count value
+ * @flags: Output parameter for flags value
+ *
+ * This function is exported for use by LUO to safely read eventfd state.
+ * Since struct eventfd_ctx is defined in this file, we can access its
+ * members directly here. The function uses the wait queue lock to ensure
+ * atomic access to count.
+ *
+ * Returns 0 on success, negative error code on failure.
+ */
+int eventfd_luo_get_state(struct file *file, __u64 *count, unsigned int *flags)
+{
+ struct eventfd_ctx *ctx;
+ unsigned long irq_flags;
+
+ ctx = eventfd_ctx_fileget(file);
+ if (IS_ERR(ctx))
+ return PTR_ERR(ctx);
+
+ /* Read count with lock (flags don't need lock) */
+ spin_lock_irqsave(&ctx->wqh.lock, irq_flags);
+ *count = ctx->count;
+ spin_unlock_irqrestore(&ctx->wqh.lock, irq_flags);
+
+ *flags = ctx->flags;
+
+ eventfd_ctx_put(ctx);
+ return 0;
+}
+EXPORT_SYMBOL_GPL(eventfd_luo_get_state);
+
static int do_eventfd(unsigned int count, int flags)
{
struct eventfd_ctx *ctx __free(kfree) = NULL;
@@ -411,6 +445,12 @@ static int do_eventfd(unsigned int count, int flags)
return fd_publish(fdf);
}
+int eventfd_create(__u64 count, unsigned int flags)
+{
+ return do_eventfd(count, flags);
+}
+EXPORT_SYMBOL_GPL(eventfd_create);
+
SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags)
{
return do_eventfd(count, flags);
diff --git a/fs/eventfd_luo.c b/fs/eventfd_luo.c
new file mode 100644
index 00000000000000..781d90635c52ae
--- /dev/null
+++ b/fs/eventfd_luo.c
@@ -0,0 +1,250 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2026 KylinSoft Corporation.
+ * Author: Chenghao Duan <duanchenghao@kylinos.cn>
+ */
+
+/**
+ * DOC: Eventfd Preservation via LUO
+ *
+ * Overview
+ * ========
+ *
+ * Event file descriptors (eventfd) can be preserved over a kexec using the Live
+ * Update Orchestrator (LUO) file preservation. This allows userspace applications
+ * that use eventfd for event notification to maintain their state across kernel
+ * updates.
+ *
+ * Eventfd is a simple notification mechanism that uses a 64-bit counter for
+ * signaling events between userspace processes or between userspace and kernel.
+ * The preservation ensures that pending events and configuration are not lost
+ * during kexec.
+ *
+ * The preservation is not intended to be transparent. Only select properties of
+ * the eventfd are preserved. All others are reset to default. The preserved
+ * properties are described below.
+ *
+ * Preserved Properties
+ * ====================
+ *
+ * The following properties of the eventfd are preserved across kexec:
+ *
+ * Counter Value
+ * The current 64-bit counter value is preserved. This includes any pending
+ * events that have been signaled but not yet consumed by readers.
+ *
+ * File Flags
+ * The creation flags (EFD_SEMAPHORE, EFD_CLOEXEC, EFD_NONBLOCK) are preserved.
+ * These control the behavior of read/write operations and file descriptor
+ * inheritance.
+ *
+ * Non-Preserved Properties
+ * ========================
+ *
+ * All properties which are not preserved must be assumed to be reset to
+ * default. This section describes some of those properties which may be more of
+ * note.
+ *
+ * File Descriptor Number
+ * The file descriptor number itself is not preserved. After restore, the
+ * eventfd will be assigned a new file descriptor number in the target process.
+ *
+ * Wait Queue State
+ * Any processes currently blocked on read() operations will be woken up and
+ * need to re-establish their blocking state if desired.
+ *
+ * File Position
+ * Eventfd files don't have a traditional file position, but any internal
+ * state related to the file descriptor is reset.
+ */
+
+#include <linux/err.h>
+#include <linux/file.h>
+#include <linux/io.h>
+#include <linux/kexec_handover.h>
+#include <linux/kho/abi/eventfd.h>
+#include <linux/liveupdate.h>
+#include <linux/module.h>
+#include <linux/eventfd.h>
+#include <linux/anon_inodes.h>
+#include <linux/idr.h>
+#include <linux/slab.h>
+#include <linux/wait.h>
+#include <linux/kref.h>
+#include <linux/fdtable.h>
+
+static int eventfd_luo_preserve(struct liveupdate_file_op_args *args)
+{
+ struct eventfd_luo_ser *ser;
+ u64 count;
+ unsigned int flags;
+ int err = 0;
+
+ /* Get eventfd state safely */
+ err = eventfd_luo_get_state(args->file, &count, &flags);
+ if (err) {
+ pr_err("Failed to get eventfd state: %d\n", err);
+ return err;
+ }
+
+ ser = kho_alloc_preserve(sizeof(*ser));
+ if (IS_ERR(ser)) {
+ err = PTR_ERR(ser);
+ pr_err("Failed to allocate preserve memory: %d\n", err);
+ return err;
+ }
+
+ /* Save eventfd state */
+ ser->count = count;
+ ser->flags = flags;
+
+ pr_debug("Preserved eventfd: count=%llu, flags=0x%x\n",
+ ser->count, ser->flags);
+
+ /* Return physical address of serialization structure */
+ args->serialized_data = virt_to_phys(ser);
+
+ return 0;
+}
+
+static int eventfd_luo_freeze(struct liveupdate_file_op_args *args)
+{
+ struct eventfd_luo_ser *ser;
+ u64 count;
+ unsigned int flags;
+ int err;
+
+ if (WARN_ON_ONCE(!args->serialized_data))
+ return -EINVAL;
+
+ ser = phys_to_virt(args->serialized_data);
+
+ /* Get current state and update if changed */
+ err = eventfd_luo_get_state(args->file, &count, &flags);
+ if (err)
+ return err;
+
+ if (ser->count != count) {
+ pr_debug("WARNING: Count changed during preserve->freeze! old=%llu, new=%llu\n",
+ ser->count, count);
+ }
+
+ ser->count = count;
+
+ return 0;
+}
+
+static void eventfd_luo_unpreserve(struct liveupdate_file_op_args *args)
+{
+ struct eventfd_luo_ser *ser;
+
+ if (WARN_ON_ONCE(!args->serialized_data))
+ return;
+
+ ser = phys_to_virt(args->serialized_data);
+ kho_unpreserve_free(ser);
+}
+
+static int eventfd_luo_retrieve(struct liveupdate_file_op_args *args)
+{
+ struct eventfd_luo_ser *ser;
+ struct eventfd_ctx *ctx;
+ struct file *file = NULL;
+ int eventfd;
+
+ ser = phys_to_virt(args->serialized_data);
+ if (!ser)
+ return -EINVAL;
+
+ /* Create a new eventfd with the preserved count and flags */
+ eventfd = eventfd_create(ser->count, ser->flags);
+ if (eventfd < 0) {
+ pr_err("Failed to create eventfd: %d\n", eventfd);
+ return eventfd;
+ }
+
+ file = fget(eventfd);
+ if (!file) {
+ pr_err("Failed to get file from fd\n");
+ close_fd(eventfd);
+ return -EBADF;
+ }
+
+ close_fd(eventfd);
+
+ /* Verify the created file has correct internal state */
+ ctx = eventfd_ctx_fileget(file);
+ if (IS_ERR(ctx)) {
+ pr_err("Failed to get context from file\n");
+ fput(file);
+ return PTR_ERR(ctx);
+ }
+
+ eventfd_ctx_put(ctx);
+
+ args->file = file;
+ return 0;
+}
+
+static void eventfd_luo_finish(struct liveupdate_file_op_args *args)
+{
+ struct eventfd_luo_ser *ser;
+
+ if (args->retrieve_status)
+ return;
+
+ if (!args->serialized_data)
+ return;
+
+ ser = phys_to_virt(args->serialized_data);
+ if (!ser)
+ return;
+
+ kho_restore_free(ser);
+}
+
+static bool eventfd_luo_can_preserve(struct liveupdate_file_handler *handler,
+ struct file *file)
+{
+ struct eventfd_ctx *ctx;
+
+ if (!file->f_op)
+ return false;
+
+ /* Try to get eventfd context - this will fail if not an eventfd */
+ ctx = eventfd_ctx_fileget(file);
+ if (IS_ERR(ctx))
+ return false;
+
+ eventfd_ctx_put(ctx);
+ return true;
+}
+
+static const struct liveupdate_file_ops eventfd_luo_file_ops = {
+ .preserve = eventfd_luo_preserve,
+ .unpreserve = eventfd_luo_unpreserve,
+ .freeze = eventfd_luo_freeze,
+ .retrieve = eventfd_luo_retrieve,
+ .finish = eventfd_luo_finish,
+ .can_preserve = eventfd_luo_can_preserve,
+ .owner = THIS_MODULE,
+};
+
+static struct liveupdate_file_handler eventfd_luo_handler = {
+ .ops = &eventfd_luo_file_ops,
+ .compatible = EVENTFD_LUO_FH_COMPATIBLE,
+};
+
+static int __init eventfd_luo_init(void)
+{
+ int err = liveupdate_register_file_handler(&eventfd_luo_handler);
+
+ if (err && err != -EOPNOTSUPP) {
+ pr_err("Could not register eventfd LUO handler: %pe\n",
+ ERR_PTR(err));
+ return err;
+ }
+
+ return 0;
+}
+late_initcall(eventfd_luo_init);
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index e32bee4345fb9f..703e1a126c4d40 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -35,6 +35,8 @@ void eventfd_ctx_put(struct eventfd_ctx *ctx);
struct file *eventfd_fget(int fd);
struct eventfd_ctx *eventfd_ctx_fdget(int fd);
struct eventfd_ctx *eventfd_ctx_fileget(struct file *file);
+int eventfd_luo_get_state(struct file *file, __u64 *count, unsigned int *flags);
+int eventfd_create(__u64 count, unsigned int flags);
void eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask);
int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait,
__u64 *cnt);
diff --git a/include/linux/kho/abi/eventfd.h b/include/linux/kho/abi/eventfd.h
new file mode 100644
index 00000000000000..148beac6bcc760
--- /dev/null
+++ b/include/linux/kho/abi/eventfd.h
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2026 KylinSoft Corporation.
+ * Author: Chenghao Duan <duanchenghao@kylinos.cn>
+ */
+
+#ifndef _LINUX_KHO_ABI_EVENTFD_H
+#define _LINUX_KHO_ABI_EVENTFD_H
+
+#include <linux/types.h>
+
+/*
+ * Eventfd Live Update ABI
+ *
+ * This header defines the ABI for preserving eventfd state across kexec.
+ *
+ * The state is serialized into a packed structure `struct eventfd_luo_ser`
+ * which is handed over to the next kernel via the KHO mechanism.
+ *
+ */
+
+/**
+ * struct eventfd_luo_ser - Serialized state of an eventfd
+ * @count: The current counter value
+ * @flags: File flags (EFD_SEMAPHORE, EFD_CLOEXEC, EFD_NONBLOCK)
+ *
+ * This structure contains the minimal state needed to restore an eventfd
+ * after kexec. The count represents the current value of the event counter,
+ * and flags represent the file creation flags.
+ */
+struct eventfd_luo_ser {
+ __u64 count;
+ unsigned int flags;
+} __packed;
+
+/* The compatibility string for eventfd file handler */
+#define EVENTFD_LUO_FH_COMPATIBLE "eventfd-v1"
+
+#endif /* _LINUX_KHO_ABI_EVENTFD_H */
diff --git a/kernel/liveupdate/Kconfig b/kernel/liveupdate/Kconfig
index c13af38ba23ab8..1361b5733f412b 100644
--- a/kernel/liveupdate/Kconfig
+++ b/kernel/liveupdate/Kconfig
@@ -86,4 +86,20 @@ config LIVEUPDATE_MEMFD
If unsure, say N.
+config LIVEUPDATE_EVENTFD
+ bool "Eventfd Live Update Orchestrator support"
+ depends on EVENTFD
+ depends on LIVEUPDATE
+ help
+ Enable Live Update Orchestrator support for eventfd file descriptors.
+ This allows eventfd files to be preserved and restored across kexec
+ operations, maintaining their counter values and flags.
+
+ Eventfd files are commonly used for event notification between
+ userspace processes or between userspace and kernel. With this
+ option enabled, eventfd state can be handed over to a new kernel
+ during live update operations.
+
+ If unsure, say N.
+
endmenu
diff --git a/tools/testing/selftests/liveupdate/Makefile b/tools/testing/selftests/liveupdate/Makefile
index 30689d22cb0216..e092e38fa6f6c4 100644
--- a/tools/testing/selftests/liveupdate/Makefile
+++ b/tools/testing/selftests/liveupdate/Makefile
@@ -8,6 +8,7 @@ TEST_GEN_PROGS_EXTENDED += luo_kexec_simple
TEST_GEN_PROGS_EXTENDED += luo_multi_session
TEST_GEN_PROGS_EXTENDED += luo_stress_sessions
TEST_GEN_PROGS_EXTENDED += luo_stress_files
+TEST_GEN_PROGS_EXTENDED += luo_test_eventfd
TEST_FILES += do_kexec.sh
diff --git a/tools/testing/selftests/liveupdate/config b/tools/testing/selftests/liveupdate/config
index 91d03f9a6a3952..d388bd75524578 100644
--- a/tools/testing/selftests/liveupdate/config
+++ b/tools/testing/selftests/liveupdate/config
@@ -9,3 +9,5 @@ CONFIG_LIVEUPDATE_TEST=y
CONFIG_MEMFD_CREATE=y
CONFIG_TMPFS=y
CONFIG_SHMEM=y
+CONFIG_EVENTFD=y
+CONFIG_LIVEUPDATE_EVENTFD=y
diff --git a/tools/testing/selftests/liveupdate/luo_test_eventfd.c b/tools/testing/selftests/liveupdate/luo_test_eventfd.c
new file mode 100644
index 00000000000000..94ef3bc66ad971
--- /dev/null
+++ b/tools/testing/selftests/liveupdate/luo_test_eventfd.c
@@ -0,0 +1,376 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (C) 2026 KylinSoft Corporation.
+ * Author: Chenghao Duan <duanchenghao@kylinos.cn>
+ */
+
+/*
+ * Multi-session kexec selftest for eventfd LUO support.
+ *
+ * Modeled after luo_multi_session.c.
+ * It creates multiple LUO sessions, each preserving different eventfd types,
+ * and verifies them after kexec.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/eventfd.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+#include "luo_test_utils.h"
+
+/* Session names */
+#define SESSION_EMPTY "eventfd-empty"
+#define SESSION_DEFAULT "eventfd-default"
+#define SESSION_SEM "eventfd-sem"
+#define SESSION_NONBLOCK "eventfd-nonblock"
+#define SESSION_LARGE "eventfd-large"
+#define SESSION_MODIFIED "eventfd-modified-after-preserve"
+
+/* Tokens */
+#define TOKEN_DEFAULT 0xCAFEBABE
+#define TOKEN_SEM 0xDEADBEEF
+#define TOKEN_NONBLOCK 0xFEEDBEEF
+#define TOKEN_LARGE 0xBEEFCAFE
+#define TOKEN_MODIFIED 0xABCD1234
+
+/* Counts */
+#define COUNT_INITIAL 42
+#define COUNT_WRITE 10
+#define COUNT_EXPECTED (COUNT_INITIAL + COUNT_WRITE) /* 52 */
+#define COUNT_SEM 5
+#define COUNT_NONBLOCK 100
+#define COUNT_LARGE ((unsigned int)-1) /* UINT_MAX */
+#define COUNT_MODIFIED 25
+#define COUNT_MODIFY_DELTA 99
+
+/* State tracking */
+#define STATE_SESSION_NAME "eventfd_multi_state"
+#define STATE_TOKEN 997
+
+/* Eventfd verification modes */
+enum verify_mode {
+ VERIFY_FLAGS, /* Only verify flags, no behavior testing */
+ VERIFY_ONCE, /* Read once and verify count */
+ VERIFY_SEMAPHORE, /* Read multiple times, verify returns 1 each time */
+ VERIFY_NONBLOCK, /* Read once in nonblock mode */
+ VERIFY_LARGE /* Read once, verify large count */
+};
+
+/* Test session configuration */
+struct test_session_config {
+ const char *session_name;
+ unsigned long token;
+ unsigned int count;
+ unsigned int flags;
+ enum verify_mode verify_mode;
+ const char *desc;
+};
+
+/* Test session configurations */
+static const struct test_session_config test_configs[] = {
+ {SESSION_EMPTY, 0, 0, 0, VERIFY_FLAGS, "Empty"},
+ {SESSION_DEFAULT, TOKEN_DEFAULT, COUNT_EXPECTED, 0, VERIFY_ONCE, "Default"},
+ {SESSION_SEM, TOKEN_SEM, COUNT_SEM, EFD_SEMAPHORE, VERIFY_SEMAPHORE, "Semaphore"},
+ {SESSION_NONBLOCK, TOKEN_NONBLOCK, COUNT_NONBLOCK, EFD_NONBLOCK, VERIFY_NONBLOCK, "Nonblock"},
+ {SESSION_LARGE, TOKEN_LARGE, COUNT_LARGE, 0, VERIFY_LARGE, "Large-count"},
+ {SESSION_MODIFIED, TOKEN_MODIFIED, COUNT_MODIFIED + COUNT_MODIFY_DELTA, 0, VERIFY_ONCE, "Modified after preserve (kexec handover)"},
+};
+#define NUM_TEST_SESSIONS ARRAY_SIZE(test_configs)
+
+static int verify_eventfd_flags(int efd, unsigned int expected_flags, const char *desc)
+{
+ int actual_flags = fcntl(efd, F_GETFL);
+
+ if (actual_flags < 0)
+ return -errno;
+
+ int expected_fd_flags = expected_flags & (EFD_NONBLOCK | EFD_CLOEXEC);
+ int actual_fd_flags = actual_flags & (O_NONBLOCK | O_CLOEXEC);
+
+ if (actual_fd_flags != expected_fd_flags) {
+ ksft_print_msg("%s: flag mismatch - expected 0x%x, got 0x%x\n",
+ desc, expected_fd_flags, actual_fd_flags);
+ return -EINVAL;
+ }
+
+ ksft_print_msg(" %s eventfd flags OK (0x%x)\n", desc, expected_fd_flags);
+ return actual_flags; /* Return actual flags for further use */
+}
+
+static int ensure_nonblock(int efd, int current_flags)
+{
+ return fcntl(efd, F_SETFL, current_flags | O_NONBLOCK);
+}
+
+static int verify_count_once(int efd, unsigned int expected_count, const char *desc)
+{
+ uint64_t val;
+
+ if (read(efd, &val, sizeof(val)) != sizeof(val))
+ return -errno;
+
+ if (val != (uint64_t)expected_count) {
+ ksft_print_msg("%s: expected %u got %llu\n",
+ desc, expected_count, (unsigned long long)val);
+ return -EINVAL;
+ }
+
+ ksft_print_msg(" %s eventfd OK: %u\n", desc, expected_count);
+ return 0;
+}
+
+static int verify_semaphore_behavior(int efd, unsigned int expected_count, const char *desc)
+{
+ uint64_t val;
+
+ /* Read expected_count times, each should return 1 */
+ for (unsigned int i = 0; i < expected_count; i++) {
+ if (read(efd, &val, sizeof(val)) != sizeof(val))
+ return -errno;
+
+ if (val != 1) {
+ ksft_print_msg("%s: expected 1, got %llu at read %u\n",
+ desc, (unsigned long long)val, i + 1);
+ return -EINVAL;
+ }
+ ksft_print_msg(" %s eventfd OK: %u at read %u\n", desc, (unsigned int)val, i + 1);
+ }
+
+ /* Next read should return EAGAIN (no more events) */
+ if (read(efd, &val, sizeof(val)) >= 0 || errno != EAGAIN) {
+ ksft_print_msg("%s: expected EAGAIN after %u reads\n",
+ desc, expected_count);
+ return -EINVAL;
+ }
+
+ ksft_print_msg(" %s eventfd OK (%u reads)\n", desc, expected_count);
+ return 0;
+}
+
+static int restore_and_verify_eventfd_generic(int session_fd,
+ unsigned long token,
+ unsigned int expected_count,
+ unsigned int expected_flags,
+ enum verify_mode mode,
+ const char *desc)
+{
+ struct liveupdate_session_retrieve_fd arg = { .size = sizeof(arg) };
+ int efd, ret = 0, actual_flags;
+
+ arg.token = token;
+ if (ioctl(session_fd, LIVEUPDATE_SESSION_RETRIEVE_FD, &arg) < 0)
+ return -errno;
+ efd = arg.fd;
+
+ switch (mode) {
+ case VERIFY_FLAGS:
+ /* Only verify flags, no behavior testing */
+ ret = verify_eventfd_flags(efd, expected_flags, desc);
+ if (ret < 0)
+ close(efd);
+ return ret < 0 ? ret : 0;
+
+ case VERIFY_SEMAPHORE:
+ /* Verify flags + semaphore behavior */
+ actual_flags = verify_eventfd_flags(efd, expected_flags, desc);
+ if (actual_flags < 0) {
+ ret = actual_flags;
+ goto out;
+ }
+
+ if (ensure_nonblock(efd, actual_flags) < 0) {
+ ret = -errno;
+ goto out;
+ }
+
+ ret = verify_semaphore_behavior(efd, expected_count, desc);
+ break;
+
+ case VERIFY_ONCE:
+ case VERIFY_NONBLOCK:
+ case VERIFY_LARGE:
+ /* Verify flags + count behavior */
+ actual_flags = verify_eventfd_flags(efd, expected_flags, desc);
+ if (actual_flags < 0) {
+ ret = actual_flags;
+ goto out;
+ }
+
+ ret = verify_count_once(efd, expected_count, desc);
+ break;
+
+ default:
+ ret = -EINVAL;
+ break;
+ }
+
+out:
+ close(efd);
+ return ret;
+}
+
+static int create_and_preserve_eventfd_keep_fd(int session_fd,
+ unsigned long token,
+ unsigned int count,
+ unsigned int flags,
+ const char *desc,
+ int *efd_out)
+{
+ struct liveupdate_session_preserve_fd arg = { .size = sizeof(arg) };
+ int efd = eventfd(count, flags);
+
+ if (efd < 0)
+ return -errno;
+
+ arg.fd = efd;
+ arg.token = token;
+ if (ioctl(session_fd, LIVEUPDATE_SESSION_PRESERVE_FD, &arg) < 0) {
+ int ret = -errno;
+
+ close(efd);
+ return ret;
+ }
+
+ if (efd_out)
+ *efd_out = efd;
+ else
+ close(efd);
+ return 0;
+}
+
+static int create_and_preserve_eventfd(int session_fd,
+ unsigned long token,
+ unsigned int count,
+ unsigned int flags,
+ const char *desc)
+{
+ return create_and_preserve_eventfd_keep_fd(session_fd, token, count,
+ flags, desc, NULL);
+}
+
+static int create_session_checked(int luo_fd, const char *session_name)
+{
+ int session_fd = luo_create_session(luo_fd, session_name);
+
+ if (session_fd < 0)
+ fail_exit("luo_create_session for '%s'", session_name);
+ return session_fd;
+}
+
+static int retrieve_session_checked(int luo_fd, const char *session_name)
+{
+ int session_fd = luo_retrieve_session(luo_fd, session_name);
+
+ if (session_fd < 0)
+ fail_exit("luo_retrieve_session for '%s'", session_name);
+ return session_fd;
+}
+
+static void finish_session_checked(int session_fd, const char *session_name)
+{
+ if (luo_session_finish(session_fd) < 0)
+ fail_exit("luo_session_finish for '%s'", session_name);
+ close(session_fd);
+}
+
+static int verify_eventfd_config(int session_fd, const struct test_session_config *config)
+{
+ return restore_and_verify_eventfd_generic(session_fd, config->token,
+ config->count, config->flags,
+ config->verify_mode, config->desc);
+}
+
+
+static void run_stage_1(int luo_fd)
+{
+ ksft_print_msg("[STAGE 1] Starting pre-kexec setup for multi-eventfd test...\n");
+ ksft_print_msg("[STAGE 1] Creating state file for next stage (2)...\n");
+ create_state_file(luo_fd, STATE_SESSION_NAME, STATE_TOKEN, 2);
+
+ /* Create all test sessions */
+ for (size_t i = 0; i < NUM_TEST_SESSIONS; i++) {
+ const struct test_session_config *config = &test_configs[i];
+
+ ksft_print_msg("[STAGE 1] Creating session '%s'...\n", config->session_name);
+ int session_fd = create_session_checked(luo_fd, config->session_name);
+
+ /* Special handling for modified session (preserve then modify) */
+ if (config->token == TOKEN_MODIFIED) {
+ int preserved_efd;
+
+ if (create_and_preserve_eventfd_keep_fd(session_fd,
+ config->token,
+ COUNT_MODIFIED,
+ config->flags,
+ "modified-after-preserve",
+ &preserved_efd) < 0)
+ fail_exit("create_and_preserve_eventfd_keep_fd modified");
+
+ /* Now modify the preserved eventfd's count */
+ uint64_t modify_value = COUNT_MODIFY_DELTA;
+
+ if (write(preserved_efd, &modify_value,
+ sizeof(modify_value)) != sizeof(modify_value))
+ fail_exit("write to preserved eventfd after preserve");
+
+ close(preserved_efd);
+ } else {
+ /* Standard session creation */
+ if (create_and_preserve_eventfd(session_fd, config->token,
+ config->count, config->flags,
+ config->desc) < 0)
+ fail_exit("create_and_preserve_eventfd %s", config->desc);
+ }
+ }
+
+ close(luo_fd);
+ daemonize_and_wait();
+}
+
+static void run_stage_2(int luo_fd, int state_session_fd)
+{
+ int session_fds[NUM_TEST_SESSIONS];
+ int stage;
+
+ ksft_print_msg("[STAGE 2] Starting post-kexec verification...\n");
+
+ restore_and_read_stage(state_session_fd, STATE_TOKEN, &stage);
+ if (stage != 2)
+ fail_exit("Expected stage 2, but state file contains %d", stage);
+
+ ksft_print_msg("[STAGE 2] Retrieving all sessions...\n");
+ for (size_t i = 0; i < NUM_TEST_SESSIONS; i++)
+ session_fds[i] = retrieve_session_checked(luo_fd, test_configs[i].session_name);
+
+ ksft_print_msg("[STAGE 2] Verifying eventfds...\n");
+ for (size_t i = 0; i < NUM_TEST_SESSIONS; i++) {
+ if (verify_eventfd_config(session_fds[i], &test_configs[i]) < 0)
+ fail_exit("verify %s eventfd", test_configs[i].desc);
+ }
+
+ ksft_print_msg("[STAGE 2] All eventfd sessions verified successfully.\n");
+
+ ksft_print_msg("[STAGE 2] Finalizing all sessions...\n");
+ for (size_t i = 0; i < NUM_TEST_SESSIONS; i++)
+ finish_session_checked(session_fds[i], test_configs[i].session_name);
+
+ ksft_print_msg("[STAGE 2] Finalizing state session...\n");
+ if (luo_session_finish(state_session_fd) < 0)
+ fail_exit("luo_session_finish for state session");
+ close(state_session_fd);
+
+ ksft_print_msg("\n--- EVENTFD_LUO TEST PASSED ---\n");
+}
+
+int main(int argc, char *argv[])
+{
+ return luo_test(argc, argv, STATE_SESSION_NAME,
+ run_stage_1, run_stage_2);
+}
|
| 3/2 | 2026/06/25 06:07 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 10674 output: 22 thoughts: 353 Thoughts: **Analyzing the Eventfd Live Update Orchestrator Patch** Okay, so I'm looking at this patch that introduces Live Update Orchestrator (LUO) support for `eventfd`. It looks like it adds `fs/eventfd_luo.c` and modifies `fs/eventfd.c` to export a few functions and introduces a `CONFIG_LIVEUPDATE_EVENTFD` config option. My immediate thought is, "Is this code even *reachable* and functional?" I need to verify. Since the prompt tells me to use my tools and not rely on prior knowledge, let's dive in. The patch introduces `fs/eventfd_luo.c`, and that's where the heart of this LUO integration likely resides. It looks like this file registers a live update file handler specifically for eventfds. Now, this `liveupdate` concept is still a bit hazy, I don't readily recall it from mainline, so it must be something specific to this patch or this kernel tree. But the instructions tell me to *look* at the code. Alright, let's get into the code. The `fs/eventfd_luo.c` file defines a `struct liveupdate_file_ops` called `eventfd_luo_file_ops` with functions: `eventfd_luo_preserve`, `eventfd_luo_freeze`, `eventfd_luo_unpreserve`, `eventfd_luo_retrieve`, `eventfd_luo_finish`, and `eventfd_luo_can_preserve`. This points to the core operations for live updating an eventfd. It's using `eventfd_luo_get_state` and `eventfd_create`, which are explicitly exported from `fs/eventfd.c`. This suggests that the LUO functionality depends on these existing `eventfd` functions. Time to look for `liveupdate_register_file_handler`. |
| 4/2 | 2026/06/25 06:08 | tool | grepper |
0mArgs:{
"Expression": "liveupdate_register_file_handler"
}Results: {
"Output": "fs/eventfd_luo.c=238=static int __init eventfd_luo_init(void)\nfs/eventfd_luo.c-239-{\nfs/eventfd_luo.c:240:\tint err = liveupdate_register_file_handler(\u0026eventfd_luo_handler);\nfs/eventfd_luo.c-241-\n--\ninclude/linux/liveupdate.h=232=int liveupdate_reboot(void);\ninclude/linux/liveupdate.h-233-\ninclude/linux/liveupdate.h:234:int liveupdate_register_file_handler(struct liveupdate_file_handler *fh);\ninclude/linux/liveupdate.h-235-void liveupdate_unregister_file_handler(struct liveupdate_file_handler *fh);\n--\ninclude/linux/liveupdate.h=254=static inline int liveupdate_reboot(void)\n--\ninclude/linux/liveupdate.h-258-\ninclude/linux/liveupdate.h:259:static inline int liveupdate_register_file_handler(struct liveupdate_file_handler *fh)\ninclude/linux/liveupdate.h-260-{\n--\nkernel/liveupdate/luo_file.c=855=void luo_file_set_destroy(struct luo_file_set *file_set)\n--\nkernel/liveupdate/luo_file.c-862-/**\nkernel/liveupdate/luo_file.c:863: * liveupdate_register_file_handler - Register a file handler with LUO.\nkernel/liveupdate/luo_file.c-864- * @fh: Pointer to a caller-allocated \u0026struct liveupdate_file_handler.\n--\nkernel/liveupdate/luo_file.c-873- */\nkernel/liveupdate/luo_file.c:874:int liveupdate_register_file_handler(struct liveupdate_file_handler *fh)\nkernel/liveupdate/luo_file.c-875-{\n--\nkernel/liveupdate/luo_file.c-917- * Unregisters the file handler from the liveupdate core. This function\nkernel/liveupdate/luo_file.c:918: * reverses the operations of liveupdate_register_file_handler().\nkernel/liveupdate/luo_file.c-919- */\n--\nmm/memfd_luo.c=609=static int __init memfd_luo_init(void)\nmm/memfd_luo.c-610-{\nmm/memfd_luo.c:611:\tint err = liveupdate_register_file_handler(\u0026memfd_luo_handler);\nmm/memfd_luo.c-612-\n"
} |
| 5/2 | 2026/06/25 06:08 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 12157 output: 37 thoughts: 166 Thoughts: **Analyzing the Eventfd LUO Implementation** Okay, so this code successfully implements a new feature in the kernel, specifically designed for persisting eventfd functionality across a kexec reboot using the Live Update Object (LUO) framework. My focus is immediately drawn to the integration points. The config, `LIVEUPDATE_EVENTFD`, seems straightforward enough, enabling this specific LUO-based preservation. Now I need to dive into the core functions responsible for making this work. My initial mental checklist includes: `eventfd_luo_preserve`, `eventfd_luo_freeze`, `eventfd_luo_unpreserve`, `eventfd_luo_retrieve`, `eventfd_luo_finish`, `eventfd_luo_can_preserve`, `eventfd_luo_get_state`, and of course `eventfd_create`. These are the key entry points and handlers that will define the lifecycle of the eventfd state during the kexec process. To get the full picture, I'll need to go directly to `fs/eventfd_luo.c`. I have a feeling there might be some helper functions or internal data structures in there that are just as crucial as those listed. Let's see if there are any other surprises or edge cases. |
| 6/2 | 2026/06/25 06:08 | tool | grepper |
0mArgs:{
"Expression": "^static.*eventfd_luo",
"PathPrefix": "fs/eventfd_luo.c"
}Results: {
"Output": "fs/eventfd_luo.c-75-\nfs/eventfd_luo.c:76:static int eventfd_luo_preserve(struct liveupdate_file_op_args *args)\nfs/eventfd_luo.c-77-{\n--\nfs/eventfd_luo.c-109-\nfs/eventfd_luo.c:110:static int eventfd_luo_freeze(struct liveupdate_file_op_args *args)\nfs/eventfd_luo.c-111-{\n--\nfs/eventfd_luo.c-136-\nfs/eventfd_luo.c:137:static void eventfd_luo_unpreserve(struct liveupdate_file_op_args *args)\nfs/eventfd_luo.c-138-{\n--\nfs/eventfd_luo.c-147-\nfs/eventfd_luo.c:148:static int eventfd_luo_retrieve(struct liveupdate_file_op_args *args)\nfs/eventfd_luo.c-149-{\n--\nfs/eventfd_luo.c-188-\nfs/eventfd_luo.c:189:static void eventfd_luo_finish(struct liveupdate_file_op_args *args)\nfs/eventfd_luo.c-190-{\n--\nfs/eventfd_luo.c-205-\nfs/eventfd_luo.c:206:static bool eventfd_luo_can_preserve(struct liveupdate_file_handler *handler,\nfs/eventfd_luo.c-207-\t\t\t\t struct file *file)\n--\nfs/eventfd_luo.c-222-\nfs/eventfd_luo.c:223:static const struct liveupdate_file_ops eventfd_luo_file_ops = {\nfs/eventfd_luo.c-224-\t.preserve = eventfd_luo_preserve,\n--\nfs/eventfd_luo.c-232-\nfs/eventfd_luo.c:233:static struct liveupdate_file_handler eventfd_luo_handler = {\nfs/eventfd_luo.c-234-\t.ops = \u0026eventfd_luo_file_ops,\n--\nfs/eventfd_luo.c-237-\nfs/eventfd_luo.c:238:static int __init eventfd_luo_init(void)\nfs/eventfd_luo.c-239-{\n"
} |
| 7/2 | 2026/06/25 06:08 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 13277 output: 35 thoughts: 121 Thoughts: **Focusing on Eventfd's Preservation State** Okay, so I'm diving into the `eventfd` mechanism, specifically the part dealing with "LUO" – Likely Un-modified Object preservation, I'm assuming. My primary focus is pinpointing and understanding the functions that manage this state. Right now, I need to get a clear picture of how this preservation works within the eventfd context. So, I'm thinking I need to investigate these functions closely: `eventfd_luo_preserve`, `eventfd_luo_freeze`, `eventfd_luo_unpreserve`, `eventfd_luo_retrieve`, `eventfd_luo_finish`, `eventfd_luo_can_preserve`, and of course `eventfd_luo_get_state`. This last one is key to determining the *current* state of preservation. It'll show me if it's preserved, frozen, or whatever else is going on. And, let's not forget the core creation function `eventfd_create`. I'll need to know how the initial state and preservation flags are handled during creation. My immediate next step is to head over to `fs/eventfd.c`. The source for `eventfd_luo_get_state` and `eventfd_create` should provide the best insights. I’ll start there and then trace the flow from there. That's the best way to get a solid grasp of this design. |
| 8/2 | 2026/06/25 06:08 | tool | grepper |
0mArgs:{
"Expression": "eventfd_luo_get_state",
"PathPrefix": "fs/eventfd.c"
}Results: {
"Output": "fs/eventfd.c=377=EXPORT_SYMBOL_GPL(eventfd_ctx_fileget);\n--\nfs/eventfd.c-379-/**\nfs/eventfd.c:380: * eventfd_luo_get_state - Get eventfd state (count and flags) for LUO\nfs/eventfd.c-381- * @file: Eventfd file\n--\nfs/eventfd.c-391- */\nfs/eventfd.c:392:int eventfd_luo_get_state(struct file *file, __u64 *count, unsigned int *flags)\nfs/eventfd.c-393-{\n--\nfs/eventfd.c-410-}\nfs/eventfd.c:411:EXPORT_SYMBOL_GPL(eventfd_luo_get_state);\nfs/eventfd.c-412-\n"
} |
| 9/2 | 2026/06/25 06:08 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 13978 output: 30 thoughts: 7 Thoughts: Okay, here's my interpretation of that prompt, and my response: **Thinking About `eventfd_create`** Right, so we're talking about `eventfd_create` here. Immediately, my mind jumps to the core of this system call: creating an event file descriptor, a *signalling* mechanism. It's essentially a lightweight, kernel-managed counter that can be used to signal events between processes or threads. No need to mess around with pipes or shared memory segments in simple scenarios, this is much cleaner. I appreciate its simplicity for IPC. Thinking deeper, I'm considering the potential applications. Thread synchronization is the most obvious. You've got one thread waiting on an event, another signaling it. Easy. But it's also useful for notification mechanisms within a single process, say, when an asynchronous operation completes. The whole counter-based nature makes it flexible. Now, what about the flags? `EFD_SEMAPHORE` vs. the default. That little bit flip changes things. Using `EFD_SEMAPHORE` means that the read operation on the file descriptor decrements the counter by one, only signaling an event when it goes from zero to a positive value. Without that, it's just a raw counter, and read returns the current value and resets the counter to zero. The possibilities with different values are interesting. I'm imagining how I'd integrate this in, say, a custom-built event loop, or even in a lock implementation. I can immediately see the use in a parallel processing context, and how it can be paired with other synchronization primitives like mutexes and condition variables to optimize certain operations. This is a very handy tool for building robust, efficient concurrent applications. |
| 10/2 | 2026/06/25 06:08 | tool | grepper |
0mArgs:{
"Expression": "eventfd_create",
"PathPrefix": "fs/eventfd.c"
}Results: {
"Output": "fs/eventfd.c=413=static int do_eventfd(unsigned int count, int flags)\n--\nfs/eventfd.c-447-\nfs/eventfd.c:448:int eventfd_create(__u64 count, unsigned int flags)\nfs/eventfd.c-449-{\n--\nfs/eventfd.c-451-}\nfs/eventfd.c:452:EXPORT_SYMBOL_GPL(eventfd_create);\nfs/eventfd.c-453-\n"
} |
| 11/2 | 2026/06/25 06:08 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 14521 output: 30 thoughts: 47 Thoughts: Okay, here's my take on those thoughts, framed as my own mental processing: **Examining Kernel Live Update Configuration** Right, let's get down to brass tacks. I've got a situation where I need to verify a configuration, and my immediate concern is with live update functionality. I see three potential configs flagged: `LIVEUPDATE_EVENTFD`, `EVENTFD`, and the more general `LIVEUPDATE`. My gut feeling is that `LIVEUPDATE` might be the overarching one, but let's not make assumptions. The logical next step is to drill down into the Kconfig file for the live update subsystem. I need to open up `kernel/liveupdate/Kconfig` to confirm if `LIVEUPDATE` *is* the top-level option, or if it's dependent on one or both of the `EVENTFD` configs. This is a pretty standard debugging process; understand the dependencies before trying to use them. Let's get to it. |
| 12/2 | 2026/06/25 06:08 | tool | grepper |
0mArgs:{
"Expression": "config LIVEUPDATE",
"PathPrefix": "kernel/liveupdate/Kconfig"
}Results: {
"Output": "kernel/liveupdate/Kconfig=38=config KEXEC_HANDOVER_ENABLE_DEFAULT\n--\nkernel/liveupdate/Kconfig-51-\nkernel/liveupdate/Kconfig:52:config LIVEUPDATE\nkernel/liveupdate/Kconfig-53-\tbool \"Live Update Orchestrator\"\n--\nkernel/liveupdate/Kconfig-72-\nkernel/liveupdate/Kconfig:73:config LIVEUPDATE_MEMFD\nkernel/liveupdate/Kconfig-74-\tbool \"Live update support for memfd\"\n--\nkernel/liveupdate/Kconfig-88-\nkernel/liveupdate/Kconfig:89:config LIVEUPDATE_EVENTFD\nkernel/liveupdate/Kconfig-90-\tbool \"Eventfd Live Update Orchestrator support\"\n"
} |
| 13/2 | 2026/06/25 06:08 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 14998 output: 178 thoughts: 149 Thoughts: **My Configuration Focus** Okay, so I've confirmed that `LIVEUPDATE` and `LIVEUPDATE_EVENTFD` are definitely the right flags to be looking at, and of course, `EVENTFD` itself is a necessary component. That clarifies the core set of configurations I need to address: `LIVEUPDATE`, `LIVEUPDATE_EVENTFD`, and `EVENTFD`. Now, I need to drill down on the key functions associated with this live update process. My attention needs to be squarely on: `eventfd_luo_preserve`, `eventfd_luo_freeze`, `eventfd_luo_unpreserve`, `eventfd_luo_retrieve`, `eventfd_luo_finish`, `eventfd_luo_can_preserve`, `eventfd_luo_get_state`, and of course `eventfd_create`. I need to understand exactly how these are interacting within the overall framework. Let's call set-results and keep this moving. |
| 14/2 | 2026/06/25 06:08 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"LIVEUPDATE",
"LIVEUPDATE_EVENTFD",
"EVENTFD"
],
"FocusSymbols": [
"eventfd_luo_preserve",
"eventfd_luo_freeze",
"eventfd_luo_unpreserve",
"eventfd_luo_retrieve",
"eventfd_luo_finish",
"eventfd_luo_can_preserve",
"eventfd_luo_get_state",
"eventfd_create"
],
"Reasoning": "The patch adds Live Update Orchestrator (LUO) support for eventfd, allowing eventfd state to be preserved across kexec. This introduces new reachable kernel logic for preserving and restoring eventfd state, which should be fuzzed.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"LIVEUPDATE",
"LIVEUPDATE_EVENTFD",
"EVENTFD"
],
"FocusSymbols": [
"eventfd_luo_preserve",
"eventfd_luo_freeze",
"eventfd_luo_unpreserve",
"eventfd_luo_retrieve",
"eventfd_luo_finish",
"eventfd_luo_can_preserve",
"eventfd_luo_get_state",
"eventfd_create"
],
"Reasoning": "The patch adds Live Update Orchestrator (LUO) support for eventfd, allowing eventfd state to be preserved across kexec. This introduces new reachable kernel logic for preserving and restoring eventfd state, which should be fuzzed.",
"WorthFuzzing": true
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|