From 6a7073e5f262db9a4578ff00b5b28e34335564ce Mon Sep 17 00:00:00 2001 From: Kimplul Date: Thu, 23 May 2024 19:54:55 +0300 Subject: improve id handling + The number of allowed threads running at the same time is limited to num_tids, but each thread's ID can be any larger than that. This should make ID reuse a lot more rare, and probably makes certain kinds of time-of-check-to-time-of-use attacks more difficult --- arch/riscv64/conf/init.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'arch/riscv64/conf/init.c') diff --git a/arch/riscv64/conf/init.c b/arch/riscv64/conf/init.c index 6783283..293d5e8 100644 --- a/arch/riscv64/conf/init.c +++ b/arch/riscv64/conf/init.c @@ -255,13 +255,12 @@ static void *sys_req_sharedmem(long tid, unsigned long size, void **cbuf) static char *rw_buf = 0; static size_t rw_buf_size = 4096; -void callback(long status, long tid, long d0, long d1, long d2, long d3) +void callback(long pid, long tid, long d0, long d1, long d2, long d3) { - (void)status; - + (void)tid; if (d0 == 1) { void *cbuf = 0; - rw_buf = sys_req_sharedmem(tid, rw_buf_size, &cbuf); + rw_buf = sys_req_sharedmem(pid, rw_buf_size, &cbuf); sys_ipc_resp((long)cbuf, rw_buf_size, 0, 0); __builtin_unreachable(); -- cgit v1.3