From b794bbd856c85ad5c81de09165a795165be9afa8 Mon Sep 17 00:00:00 2001 From: Clement Dieperink Date: Thu, 22 Jan 2026 09:20:58 +0100 Subject: [PATCH 1/6] fix syscall script calls from outside so3 folder --- so3/Kbuild | 4 ++-- so3/arch/arm64/exception.S | 2 ++ so3/kernel/main.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/so3/Kbuild b/so3/Kbuild index fcea8718a..ada451f71 100644 --- a/so3/Kbuild +++ b/so3/Kbuild @@ -6,8 +6,8 @@ syscall-files = include/generated/syscall_table.h.in syscall-files += include/generated/syscall_number.h -syscall-script = scripts/syscall_gen.sh -syscall-src = syscall.tbl arch/$(SRCARCH)/syscall.h.in +syscall-script = $(srctree)/scripts/syscall_gen.sh +syscall-src = $(srctree)/syscall.tbl $(srctree)/arch/$(SRCARCH)/syscall.h.in quiet_cmd_syscall_gen = GEN $@ cmd_syscall_gen = $(syscall-script) $(syscall-src) $(syscall-files) diff --git a/so3/arch/arm64/exception.S b/so3/arch/arm64/exception.S index 0e4a30133..114010d43 100644 --- a/so3/arch/arm64/exception.S +++ b/so3/arch/arm64/exception.S @@ -564,6 +564,7 @@ el01_sync_handler: mov x0, sp bl trap_handle +#ifdef CONFIG_IPC_SIGNAL // Check if sigreturn has been called. In this case, we // clean the stack frame which has been used to manage the user handler. cmp x8, #SYSCALL_rt_sigreturn @@ -571,6 +572,7 @@ el01_sync_handler: // Reset the stack frame by removing the one issued from sigreturn add sp, sp, #S_FRAME_SIZE +#endif // Entry point for new user threads ret_from_fork: diff --git a/so3/kernel/main.c b/so3/kernel/main.c index 1bf429d99..02e68a409 100644 --- a/so3/kernel/main.c +++ b/so3/kernel/main.c @@ -78,7 +78,7 @@ void *rest_init(void *dummy) kernel_thread(app_thread_main, "main_kernel", NULL, 0); - thread_exit(NULL); + thread_exit(0); #elif defined(CONFIG_PROC_ENV) From 680ddfe505408fadf050dada9b4947ee66cc3c6e Mon Sep 17 00:00:00 2001 From: Jean-Pierre Miceli Date: Thu, 22 Jan 2026 10:47:48 +0100 Subject: [PATCH 2/6] [avz] Fix fuctions mismatch between so3 & avz Signed-off-by: Jean-Pierre Miceli --- so3/avz/include/avz/domain.h | 2 +- so3/avz/include/avz/gnttab.h | 6 +++--- so3/avz/include/avz/soo.h | 2 +- so3/avz/kernel/hypercalls.c | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/so3/avz/include/avz/domain.h b/so3/avz/include/avz/domain.h index 27e1ebd9e..a3ff8386e 100644 --- a/so3/avz/include/avz/domain.h +++ b/so3/avz/include/avz/domain.h @@ -149,7 +149,7 @@ extern int construct_agency(struct domain *d); #ifdef CONFIG_SOO extern int construct_ME(struct domain *d); -ME_state_t get_ME_state(unsigned int ME_slotID); +ME_state_t avz_get_ME_state(unsigned int ME_slotID); #endif /* CONFIG_SOO */ void do_domctl(domctl_t *args); diff --git a/so3/avz/include/avz/gnttab.h b/so3/avz/include/avz/gnttab.h index dbfa64d49..b9c95a42e 100644 --- a/so3/avz/include/avz/gnttab.h +++ b/so3/avz/include/avz/gnttab.h @@ -16,8 +16,8 @@ * */ -#ifndef GNTTAB_H -#define GNTTAB_H +#ifndef AVZ_GNTTAB_H +#define AVZ_GNTTAB_H #include @@ -41,4 +41,4 @@ void gnttab_init(struct domain *d); void do_gnttab(gnttab_op_t *args); addr_t map_vbstore_pfn(int target_domid, int pfn); -#endif /* GNTTAB_H */ +#endif /* AVZ_GNTTAB_H */ diff --git a/so3/avz/include/avz/soo.h b/so3/avz/include/avz/soo.h index 627656284..46a1c8b7b 100644 --- a/so3/avz/include/avz/soo.h +++ b/so3/avz/include/avz/soo.h @@ -26,7 +26,7 @@ void soo_activity_init(void); void shutdown_ME(unsigned int ME_slotID); -ME_state_t get_ME_state(uint32_t ME_slotID); +ME_state_t avz_get_ME_state(uint32_t ME_slotID); void set_ME_state(uint32_t slotID, ME_state_t state); #endif /* SOO_H */ diff --git a/so3/avz/kernel/hypercalls.c b/so3/avz/kernel/hypercalls.c index 072ed76c4..ca5cbe3cc 100644 --- a/so3/avz/kernel/hypercalls.c +++ b/so3/avz/kernel/hypercalls.c @@ -47,7 +47,7 @@ * If the ME does not exist anymore (for example, following a KILL_ME), * the state is set to ME_state_dead. */ -ME_state_t get_ME_state(unsigned int ME_slotID) +ME_state_t avz_get_ME_state(unsigned int ME_slotID) { if (domains[ME_slotID] == NULL) return ME_state_dead; @@ -72,7 +72,7 @@ void shutdown_ME(unsigned int ME_slotID) vcpu_pause(dom); - DBG("Destroy evtchn if necessary - state: %d\n", get_ME_state(ME_slotID)); + DBG("Destroy evtchn if necessary - state: %d\n", avz_get_ME_state(ME_slotID)); evtchn_destroy(dom); DBG("Wiping domain area...\n"); @@ -193,7 +193,7 @@ void do_avz_hypercall(void *__args) break; case AVZ_GET_ME_STATE: - args->u.avz_me_state_args.state = get_ME_state(args->u.avz_me_state_args.slotID); + args->u.avz_me_state_args.state = avz_get_ME_state(args->u.avz_me_state_args.slotID); break; case AVZ_SET_ME_STATE: { From 34b617cb8fa94bb21177cf6e726fefaf77f9bd39 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Miceli Date: Thu, 22 Jan 2026 11:30:11 +0100 Subject: [PATCH 3/6] Store `slotID` & `capsuleID` in avz during capsule injection Signed-off-by: Jean-Pierre Miceli --- so3/avz/kernel/injector.c | 4 ++++ so3/soo/drivers/vlogsfront/vlogs.c | 2 +- so3/soo/include/soo/uapi/soo.h | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/so3/avz/kernel/injector.c b/so3/avz/kernel/injector.c index ffd5207b6..f8bb7b7f0 100644 --- a/so3/avz/kernel/injector.c +++ b/so3/avz/kernel/injector.c @@ -87,6 +87,10 @@ void inject_capsule(avz_hyp_t *args) /* At the beginning, the capsule is stopped */ domME->avz_shared->dom_desc.u.ME.state = ME_state_stopped; + /* Store slotID & capsuleID */ + domME->avz_shared->dom_desc.u.ME.slotID = slotID; + domME->avz_shared->dom_desc.u.ME.capsuleID = args->u.avz_inject_capsule_args.capsuleID; + /* Set the size of this ME in its own descriptor with the dom_context size */ domME->avz_shared->dom_desc.u.ME.size = memslot[slotID].size; diff --git a/so3/soo/drivers/vlogsfront/vlogs.c b/so3/soo/drivers/vlogsfront/vlogs.c index e79bd4f4d..4f59247be 100644 --- a/so3/soo/drivers/vlogsfront/vlogs.c +++ b/so3/soo/drivers/vlogsfront/vlogs.c @@ -246,7 +246,7 @@ static int vlogs_cwrite(int fd, const void *buffer, int count) { static char msg[1024]; - sprintf(msg, "[ME:%d] %s", get_ME_desc()->slotID, buffer); + sprintf(msg, "[ME:%d] %s", get_ME_desc()->capsuleID, buffer); vlogs_write((char *) msg); diff --git a/so3/soo/include/soo/uapi/soo.h b/so3/soo/include/soo/uapi/soo.h index ed3da353d..2ad840273 100644 --- a/so3/soo/include/soo/uapi/soo.h +++ b/so3/soo/include/soo/uapi/soo.h @@ -175,6 +175,7 @@ extern atomic_t dc_incoming_domID[DC_EVENT_MAX]; */ typedef struct { unsigned int slotID; + unsigned int capsuleID; uint64_t spid; ME_state_t state; @@ -266,6 +267,7 @@ extern volatile avz_shared_t *avz_shared; typedef struct agency_ioctl_args { void *buffer; /* IN/OUT */ int slotID; + int capsuleID; long value; /* IN/OUT */ } agency_ioctl_args_t; From faf706734a490c7ec2805a7f6f8b0bbf52c5d636 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Miceli Date: Thu, 22 Jan 2026 11:43:44 +0100 Subject: [PATCH 4/6] Fix compilation issue from previous commit Signed-off-by: Jean-Pierre Miceli --- so3/soo/include/soo/uapi/soo.h | 1 + 1 file changed, 1 insertion(+) diff --git a/so3/soo/include/soo/uapi/soo.h b/so3/soo/include/soo/uapi/soo.h index 2ad840273..8564ead45 100644 --- a/so3/soo/include/soo/uapi/soo.h +++ b/so3/soo/include/soo/uapi/soo.h @@ -306,6 +306,7 @@ typedef struct agency_ioctl_args { typedef struct { void *itb_paddr; int slotID; + int capsuleID; } avz_inject_capsule_t; /* AVZ_START_CAPSULE */ From 5f831ecc5071380b9f2b98e946c605598f040c98 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Miceli Date: Thu, 22 Jan 2026 14:57:30 +0100 Subject: [PATCH 5/6] Add missing '\n' in avz startup message Signed-off-by: Jean-Pierre Miceli --- so3/avz/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/so3/avz/kernel/setup.c b/so3/avz/kernel/setup.c index 86d7f87e7..cf7c6eaba 100644 --- a/so3/avz/kernel/setup.c +++ b/so3/avz/kernel/setup.c @@ -78,7 +78,7 @@ void avz_start(void) lprintk("Copyright (c) 2014-2025 REDS Institute, HEIG-VD, Yverdon-les-Bains\n"); lprintk("Version %s\n", SO3_KERNEL_VERSION); - LOG_INFO("\n\nNow bootstraping the hypervisor kernel ..."); + LOG_INFO("\n\nNow bootstraping the hypervisor kernel ...\n"); /* Memory manager subsystem initialization */ memory_init(); From cb48cd081a81ab8c561365ae1b286329170dd837 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Miceli Date: Fri, 30 Jan 2026 11:10:30 +0100 Subject: [PATCH 6/6] Revert name changes of 'get_ME_state()' func Signed-off-by: Jean-Pierre Miceli --- so3/avz/include/avz/domain.h | 2 +- so3/avz/include/avz/gnttab.h | 6 +++--- so3/avz/include/avz/soo.h | 2 +- so3/avz/kernel/hypercalls.c | 6 +++--- so3/include/log.h | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/so3/avz/include/avz/domain.h b/so3/avz/include/avz/domain.h index a3ff8386e..27e1ebd9e 100644 --- a/so3/avz/include/avz/domain.h +++ b/so3/avz/include/avz/domain.h @@ -149,7 +149,7 @@ extern int construct_agency(struct domain *d); #ifdef CONFIG_SOO extern int construct_ME(struct domain *d); -ME_state_t avz_get_ME_state(unsigned int ME_slotID); +ME_state_t get_ME_state(unsigned int ME_slotID); #endif /* CONFIG_SOO */ void do_domctl(domctl_t *args); diff --git a/so3/avz/include/avz/gnttab.h b/so3/avz/include/avz/gnttab.h index b9c95a42e..dbfa64d49 100644 --- a/so3/avz/include/avz/gnttab.h +++ b/so3/avz/include/avz/gnttab.h @@ -16,8 +16,8 @@ * */ -#ifndef AVZ_GNTTAB_H -#define AVZ_GNTTAB_H +#ifndef GNTTAB_H +#define GNTTAB_H #include @@ -41,4 +41,4 @@ void gnttab_init(struct domain *d); void do_gnttab(gnttab_op_t *args); addr_t map_vbstore_pfn(int target_domid, int pfn); -#endif /* AVZ_GNTTAB_H */ +#endif /* GNTTAB_H */ diff --git a/so3/avz/include/avz/soo.h b/so3/avz/include/avz/soo.h index 46a1c8b7b..627656284 100644 --- a/so3/avz/include/avz/soo.h +++ b/so3/avz/include/avz/soo.h @@ -26,7 +26,7 @@ void soo_activity_init(void); void shutdown_ME(unsigned int ME_slotID); -ME_state_t avz_get_ME_state(uint32_t ME_slotID); +ME_state_t get_ME_state(uint32_t ME_slotID); void set_ME_state(uint32_t slotID, ME_state_t state); #endif /* SOO_H */ diff --git a/so3/avz/kernel/hypercalls.c b/so3/avz/kernel/hypercalls.c index ca5cbe3cc..072ed76c4 100644 --- a/so3/avz/kernel/hypercalls.c +++ b/so3/avz/kernel/hypercalls.c @@ -47,7 +47,7 @@ * If the ME does not exist anymore (for example, following a KILL_ME), * the state is set to ME_state_dead. */ -ME_state_t avz_get_ME_state(unsigned int ME_slotID) +ME_state_t get_ME_state(unsigned int ME_slotID) { if (domains[ME_slotID] == NULL) return ME_state_dead; @@ -72,7 +72,7 @@ void shutdown_ME(unsigned int ME_slotID) vcpu_pause(dom); - DBG("Destroy evtchn if necessary - state: %d\n", avz_get_ME_state(ME_slotID)); + DBG("Destroy evtchn if necessary - state: %d\n", get_ME_state(ME_slotID)); evtchn_destroy(dom); DBG("Wiping domain area...\n"); @@ -193,7 +193,7 @@ void do_avz_hypercall(void *__args) break; case AVZ_GET_ME_STATE: - args->u.avz_me_state_args.state = avz_get_ME_state(args->u.avz_me_state_args.slotID); + args->u.avz_me_state_args.state = get_ME_state(args->u.avz_me_state_args.slotID); break; case AVZ_SET_ME_STATE: { diff --git a/so3/include/log.h b/so3/include/log.h index 71f846d03..e6003c45d 100644 --- a/so3/include/log.h +++ b/so3/include/log.h @@ -20,7 +20,7 @@ #include -#ifdef CONFIG_SOO +#ifdef CONFIG_VLOGS_FRONTEND #include #include #endif