[PATCH v2 4/5] liveupdate: validate restored LUO file set metadata
Cris Jacob Maamor
crisjacobmaamor at gmail.com
Fri May 1 10:30:52 PDT 2026
The restored session metadata provides the LUO file set address and count.
LUO maps that address with phys_to_virt() and uses the restored count to
walk the serialized file array.
Reject invalid empty file set metadata, reject counts above LUO_FILE_MAX,
and check that the physical range is KHO-preserved before mapping it.
Signed-off-by: Cris Jacob Maamor <crisjacobmaamor at gmail.com>
---
kernel/liveupdate/luo_file.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/kernel/liveupdate/luo_file.c b/kernel/liveupdate/luo_file.c
index a0a419085e28..cde43d822f8f 100644
--- a/kernel/liveupdate/luo_file.c
+++ b/kernel/liveupdate/luo_file.c
@@ -783,11 +783,21 @@ int luo_file_deserialize(struct luo_file_set *file_set,
struct luo_file_ser *file_ser;
u64 i;
- if (!file_set_ser->files) {
- WARN_ON(file_set_ser->count);
+ if (!file_set_ser->count) {
+ if (file_set_ser->files)
+ return -EINVAL;
return 0;
}
+ if (file_set_ser->count > LUO_FILE_MAX)
+ return -EINVAL;
+
+ if (!file_set_ser->files)
+ return -EINVAL;
+
+ if (!kho_is_preserved(file_set_ser->files, LUO_FILE_PGCNT))
+ return -EINVAL;
+
file_set->count = file_set_ser->count;
file_set->files = phys_to_virt(file_set_ser->files);
--
2.53.0
More information about the kexec
mailing list