From 67f2eebb44e1f27017750eddaf5a5ea513cb9c71 Mon Sep 17 00:00:00 2001 From: mjg Date: Wed, 10 Jun 2015 10:43:59 +0000 Subject: Generalised support for copy-on-write structures shared by threads. Thread credentials are maintained as follows: each thread has a pointer to creds and a reference on them. The pointer is compared with proc's creds on userspace<->kernel boundary and updated if needed. This patch introduces a counter which can be compared instead, so that more structures can use this scheme without adding more comparisons on the boundary. --- sys/kern/kern_kthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/kern/kern_kthread.c') diff --git a/sys/kern/kern_kthread.c b/sys/kern/kern_kthread.c index ee94de0..863bbc6 100644 --- a/sys/kern/kern_kthread.c +++ b/sys/kern/kern_kthread.c @@ -289,7 +289,7 @@ kthread_add(void (*func)(void *), void *arg, struct proc *p, cpu_set_fork_handler(newtd, func, arg); newtd->td_pflags |= TDP_KTHREAD; - newtd->td_ucred = crhold(p->p_ucred); + thread_cow_get_proc(newtd, p); /* this code almost the same as create_thread() in kern_thr.c */ p->p_flag |= P_HADTHREADS; -- cgit v1.1