Track errno and errstr in the kthread
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 28 Sep 2017 21:50:23 +0000 (17:50 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 29 Sep 2017 14:45:17 +0000 (10:45 -0400)
commitf6d7d6a058977eaa6c32c62244c8434c80a8d89f
tree4ca99b590d0549655f84db8169d6c5f02723be5a
parentbb2d19db8a3325f0f2fe4484a99dc4d603837a51
Track errno and errstr in the kthread

Using user memory was slightly dangerous.

First, there are some places in the kernel where we'd read errno/errstr
and make decisions based on it.  Userspace could influence those
decisions - often to their detriment, but perhaps to the kernel's.

The other issue is that the kernel could PF setting errno or errstr,
perhaps if userspace unmaps their syscall struct.  Now, the only places
where that can happen are controlled.  Since we'll want to call error()
(setting errno/errstr) from kernel PF contexts, we don't want to
possibly PF again.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/include/kthread.h
kern/src/syscall.c