-/* $OpenBSD: kern_fork.c,v 1.236 2021/06/19 02:05:33 cheloha Exp $ */
+/* $OpenBSD: kern_fork.c,v 1.237 2021/12/05 22:00:42 cheloha Exp $ */
/* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */
/*
return EINVAL;
#endif /* TCB_INVALID */
+ /*
+ * kbind(2) can only be used if it is initialized before the
+ * process goes multithreaded.
+ */
+ if (p->p_p->ps_kbind_addr == 0)
+ p->p_p->ps_kbind_addr = BOGO_PC;
+
return thread_fork(p, param.tf_stack, param.tf_tcb, param.tf_tid,
retval);
}
-/* $OpenBSD: proc.h,v 1.316 2021/11/26 04:42:13 visa Exp $ */
+/* $OpenBSD: proc.h,v 1.317 2021/12/05 22:00:42 cheloha Exp $ */
/* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */
/*-
uint64_t ps_pledge;
uint64_t ps_execpledge;
- int64_t ps_kbind_cookie;
- u_long ps_kbind_addr;
+ int64_t ps_kbind_cookie; /* [K] */
+ u_long ps_kbind_addr; /* [K] */
+/* an address that can't be in userspace or kernelspace */
+#define BOGO_PC (u_long)-1
/* End area that is copied on creation. */
#define ps_endcopy ps_refcnt
-/* $OpenBSD: uvm_mmap.c,v 1.164 2021/03/26 13:40:05 mpi Exp $ */
+/* $OpenBSD: uvm_mmap.c,v 1.165 2021/12/05 22:00:42 cheloha Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/*
return error;
}
-/* an address that can't be in userspace or kernelspace */
-#define BOGO_PC (u_long)-1
int
sys_kbind(struct proc *p, void *v, register_t *retval)
{