From f9e23e6e41068d63d42f950941c3d2fc155ef21c Mon Sep 17 00:00:00 2001 From: Kimplul Date: Thu, 18 Jul 2024 17:39:15 +0300 Subject: add ipc_tail() + ipc_kick() does a forward and a tail at the same time The idea with ipc_tail() is to allow 'trusted' calls, so for example a process is not allowed to willy-nilly open a file, as it has to go via init(), making the eid 1. This way the receiver can know that the request has gone through init() and can open up a new connection (file, whatever) after which requests from that pid/tid are allowed without init() intervention --- include/kmi/syscalls.h | 8 ++++++-- include/kmi/uapi.h | 19 +++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/kmi/syscalls.h b/include/kmi/syscalls.h index 4319812..2701bbc 100644 --- a/include/kmi/syscalls.h +++ b/include/kmi/syscalls.h @@ -87,12 +87,16 @@ enum sys_code { /** @name IPC. */ /** @{ */ /** Send IPC request as client. */ - SYS_IPC_REQ, /* IPC request to server */ + SYS_IPC_REQ, /** Forward IPC request from client. */ SYS_IPC_FWD, - /** Kick request handling to someone else. */ + /** Tail call, i.e. 'do this for me and then return to whoever called + * me" */ + SYS_IPC_TAIL, + + /** Kick request handling to someone else. Forwards AND does a tailcall. */ SYS_IPC_KICK, /** IPC response from server. */ diff --git a/include/kmi/uapi.h b/include/kmi/uapi.h index 2805a04..fa4aeae 100644 --- a/include/kmi/uapi.h +++ b/include/kmi/uapi.h @@ -512,10 +512,25 @@ SYSCALL_DECLARE5(ipc_req, pid, d0, d1, d2, d3); */ SYSCALL_DECLARE5(ipc_fwd, pid, d0, d1, d2, d3); +/** + * Tail syscall. + * + * Requests that the current process doesn't get returned to in an rpc stack. + * + * @param t Current tcb. + * @param pid Tail target process. + * @param d0 First argument. + * @param d1 Second argument. + * @param d2 Third argument. + * @param d3 Fourth argument. + */ +SYSCALL_DECLARE5(ipc_tail, pid, d0, d1, d2, d3); + /** * Kicking syscall. - * Kicks the handling of an IPC req/fwd to someone else, jumping over the - * current process at ipc_resp(). + * Kicks the handling of an IPC to someone else, jumping over the + * current process at ipc_resp(). Effectively does a forward and a tail at the + * same time. * * I'm imagining that this is useful in cases where an init process connects a * client to another server, and kicks the actual request handling to the -- cgit v1.3