diff options
author | rwatson <rwatson@FreeBSD.org> | 2001-11-08 02:13:18 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2001-11-08 02:13:18 +0000 |
commit | 8cf42b482a9aa3f9ec41071c44bc18a0ea425abf (patch) | |
tree | f48964de5180c6b27c3272456da3b93d16bd1ea3 /sys | |
parent | c4a9f1d3ab184e9dddf4227f8e0781b59d1a82b7 (diff) | |
download | FreeBSD-src-8cf42b482a9aa3f9ec41071c44bc18a0ea425abf.zip FreeBSD-src-8cf42b482a9aa3f9ec41071c44bc18a0ea425abf.tar.gz |
o Replace reference to 'struct proc' with 'struct thread' in 'struct
sysctl_req', which describes in-progress sysctl requests. This permits
sysctl handlers to have access to the current thread, permitting work
on implementing td->td_ucred, migration of suser() to using struct
thread to derive the appropriate ucred, and allowing struct thread to be
passed down to other code, such as network code where td is not currently
available (and curproc is used).
o Note: netncp and netsmb are not updated to reflect this change, as they
are not currently KSE-adapted.
Reviewed by: julian
Obtained from: TrustedBSD Project
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/linux/linux_mib.c | 12 | ||||
-rw-r--r-- | sys/kern/kern_mib.c | 8 | ||||
-rw-r--r-- | sys/kern/kern_sysctl.c | 12 | ||||
-rw-r--r-- | sys/kern/uipc_usrreq.c | 2 | ||||
-rw-r--r-- | sys/netinet/ip_divert.c | 4 | ||||
-rw-r--r-- | sys/netinet/raw_ip.c | 2 | ||||
-rw-r--r-- | sys/netinet/tcp_subr.c | 10 | ||||
-rw-r--r-- | sys/netinet/tcp_timewait.c | 10 | ||||
-rw-r--r-- | sys/netinet/udp_usrreq.c | 6 | ||||
-rw-r--r-- | sys/netinet6/udp6_usrreq.c | 2 | ||||
-rw-r--r-- | sys/sys/sysctl.h | 2 |
11 files changed, 36 insertions, 34 deletions
diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c index fda251b..98ea4f0 100644 --- a/sys/compat/linux/linux_mib.c +++ b/sys/compat/linux/linux_mib.c @@ -56,11 +56,11 @@ linux_sysctl_osname(SYSCTL_HANDLER_ARGS) char osname[LINUX_MAX_UTSNAME]; int error; - strcpy(osname, linux_get_osname(req->p)); + strcpy(osname, linux_get_osname(req->td->td_proc)); error = sysctl_handle_string(oidp, osname, LINUX_MAX_UTSNAME, req); if (error || req->newptr == NULL) return (error); - error = linux_set_osname(req->p, osname); + error = linux_set_osname(req->td->td_proc, osname); return (error); } @@ -77,11 +77,11 @@ linux_sysctl_osrelease(SYSCTL_HANDLER_ARGS) char osrelease[LINUX_MAX_UTSNAME]; int error; - strcpy(osrelease, linux_get_osrelease(req->p)); + strcpy(osrelease, linux_get_osrelease(req->td->td_proc)); error = sysctl_handle_string(oidp, osrelease, LINUX_MAX_UTSNAME, req); if (error || req->newptr == NULL) return (error); - error = linux_set_osrelease(req->p, osrelease); + error = linux_set_osrelease(req->td->td_proc, osrelease); return (error); } @@ -98,11 +98,11 @@ linux_sysctl_oss_version(SYSCTL_HANDLER_ARGS) int oss_version; int error; - oss_version = linux_get_oss_version(req->p); + oss_version = linux_get_oss_version(req->td->td_proc); error = sysctl_handle_int(oidp, &oss_version, 0, req); if (error || req->newptr == NULL) return (error); - error = linux_set_oss_version(req->p, oss_version); + error = linux_set_oss_version(req->td->td_proc, oss_version); return (error); } diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c index ced42e5..1775abf 100644 --- a/sys/kern/kern_mib.c +++ b/sys/kern/kern_mib.c @@ -155,12 +155,12 @@ sysctl_hostname(SYSCTL_HANDLER_ARGS) { int error; - if (jailed(req->p->p_ucred)) { + if (jailed(req->td->td_proc->p_ucred)) { if (!jail_set_hostname_allowed && req->newptr) return(EPERM); error = sysctl_handle_string(oidp, - req->p->p_ucred->cr_prison->pr_host, - sizeof req->p->p_ucred->cr_prison->pr_host, req); + req->td->td_proc->p_ucred->cr_prison->pr_host, + sizeof req->td->td_proc->p_ucred->cr_prison->pr_host, req); } else error = sysctl_handle_string(oidp, hostname, sizeof hostname, req); @@ -186,7 +186,7 @@ sysctl_kern_securelvl(SYSCTL_HANDLER_ARGS) struct prison *pr; int error, level; - pr = req->p->p_ucred->cr_prison; + pr = req->td->td_proc->p_ucred->cr_prison; /* * If the process is in jail, return the maximum of the global and diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 03b5a95..e1b41b3 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -848,7 +848,7 @@ kernel_sysctl(struct thread *td, int *name, u_int namelen, void *old, bzero(&req, sizeof req); - req.p = td->td_proc; + req.td = td; if (oldlenp) { req.oldlen = *oldlenp; @@ -1037,12 +1037,12 @@ sysctl_root(SYSCTL_HANDLER_ARGS) /* Is this sysctl sensitive to securelevels? */ if (req->newptr && (oid->oid_kind & CTLFLAG_SECURE)) { - if (req->p == NULL) { + if (req->td == NULL) { error = securelevel_gt(NULL, 0); /* XXX */ if (error) return (error); } else { - error = securelevel_gt(req->p->p_ucred, 0); + error = securelevel_gt(req->td->td_proc->p_ucred, 0); if (error) return (error); } @@ -1050,14 +1050,14 @@ sysctl_root(SYSCTL_HANDLER_ARGS) /* Is this sysctl writable by only privileged users? */ if (req->newptr && !(oid->oid_kind & CTLFLAG_ANYBODY)) { - if (req->p != NULL) { + if (req->td != NULL) { int flags; if (oid->oid_kind & CTLFLAG_PRISON) flags = PRISON_ROOT; else flags = 0; - error = suser_xxx(NULL, req->p, flags); + error = suser_xxx(NULL, req->td->td_proc, flags); if (error) return (error); } @@ -1132,7 +1132,7 @@ userland_sysctl(struct thread *td, int *name, u_int namelen, void *old, bzero(&req, sizeof req); - req.p = td->td_proc; + req.td = td; if (oldlenp) { if (inkernel) { diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index c8dc5fc..b8b7044 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -850,7 +850,7 @@ unp_pcblist(SYSCTL_HANDLER_ARGS) for (unp = LIST_FIRST(head), i = 0; unp && i < n; unp = LIST_NEXT(unp, unp_link)) { if (unp->unp_gencnt <= gencnt) { - if (cr_cansee(req->p->p_ucred, + if (cr_cansee(req->td->td_proc->p_ucred, unp->unp_socket->so_cred)) continue; unp_list[i++] = unp; diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index d63df09..56a602ac 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -46,6 +46,7 @@ #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/mbuf.h> +#include <sys/proc.h> #include <sys/socket.h> #include <sys/protosw.h> #include <sys/socketvar.h> @@ -485,7 +486,8 @@ div_pcblist(SYSCTL_HANDLER_ARGS) s = splnet(); for (inp = LIST_FIRST(divcbinfo.listhead), i = 0; inp && i < n; inp = LIST_NEXT(inp, inp_list)) { - if (inp->inp_gencnt <= gencnt && !prison_xinpcb(req->p, inp)) + if (inp->inp_gencnt <= gencnt && !prison_xinpcb( + req->td->td_proc, inp)) inp_list[i++] = inp; } splx(s); diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index b31be39..abc9f3b 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -627,7 +627,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) for (inp = LIST_FIRST(ripcbinfo.listhead), i = 0; inp && i < n; inp = LIST_NEXT(inp, inp_list)) { if (inp->inp_gencnt <= gencnt) { - if (cr_cansee(req->p->p_ucred, + if (cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred)) continue; inp_list[i++] = inp; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 99916c6..6a6c9f8 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -855,7 +855,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp && i < n; inp = LIST_NEXT(inp, inp_list)) { if (inp->inp_gencnt <= gencnt) { - if (cr_cansee(req->p->p_ucred, + if (cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred)) continue; inp_list[i++] = inp; @@ -913,7 +913,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS) struct inpcb *inp; int error, s; - error = suser_xxx(0, req->p, PRISON_ROOT); + error = suser_xxx(0, req->td->td_proc, PRISON_ROOT); if (error) return (error); error = SYSCTL_IN(req, addrs, sizeof(addrs)); @@ -926,7 +926,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS) error = ENOENT; goto out; } - error = cr_cansee(req->p->p_ucred, inp->inp_socket->so_cred); + error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred); if (error) goto out; bzero(&xuc, sizeof(xuc)); @@ -953,7 +953,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) struct inpcb *inp; int error, s, mapped = 0; - error = suser_xxx(0, req->p, PRISON_ROOT); + error = suser_xxx(0, req->td->td_proc, PRISON_ROOT); if (error) return (error); error = SYSCTL_IN(req, addrs, sizeof(addrs)); @@ -982,7 +982,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) error = ENOENT; goto out; } - error = cr_cansee(req->p->p_ucred, inp->inp_socket->so_cred); + error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred); if (error) goto out; bzero(&xuc, sizeof(xuc)); diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 99916c6..6a6c9f8 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -855,7 +855,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) for (inp = LIST_FIRST(tcbinfo.listhead), i = 0; inp && i < n; inp = LIST_NEXT(inp, inp_list)) { if (inp->inp_gencnt <= gencnt) { - if (cr_cansee(req->p->p_ucred, + if (cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred)) continue; inp_list[i++] = inp; @@ -913,7 +913,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS) struct inpcb *inp; int error, s; - error = suser_xxx(0, req->p, PRISON_ROOT); + error = suser_xxx(0, req->td->td_proc, PRISON_ROOT); if (error) return (error); error = SYSCTL_IN(req, addrs, sizeof(addrs)); @@ -926,7 +926,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS) error = ENOENT; goto out; } - error = cr_cansee(req->p->p_ucred, inp->inp_socket->so_cred); + error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred); if (error) goto out; bzero(&xuc, sizeof(xuc)); @@ -953,7 +953,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) struct inpcb *inp; int error, s, mapped = 0; - error = suser_xxx(0, req->p, PRISON_ROOT); + error = suser_xxx(0, req->td->td_proc, PRISON_ROOT); if (error) return (error); error = SYSCTL_IN(req, addrs, sizeof(addrs)); @@ -982,7 +982,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS) error = ENOENT; goto out; } - error = cr_cansee(req->p->p_ucred, inp->inp_socket->so_cred); + error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred); if (error) goto out; bzero(&xuc, sizeof(xuc)); diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 8090911..6eeb3a1 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -583,7 +583,7 @@ udp_pcblist(SYSCTL_HANDLER_ARGS) for (inp = LIST_FIRST(udbinfo.listhead), i = 0; inp && i < n; inp = LIST_NEXT(inp, inp_list)) { if (inp->inp_gencnt <= gencnt) { - if (cr_cansee(req->p->p_ucred, + if (cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred)) continue; inp_list[i++] = inp; @@ -635,7 +635,7 @@ udp_getcred(SYSCTL_HANDLER_ARGS) struct inpcb *inp; int error, s; - error = suser_xxx(0, req->p, PRISON_ROOT); + error = suser_xxx(0, req->td->td_proc, PRISON_ROOT); if (error) return (error); error = SYSCTL_IN(req, addrs, sizeof(addrs)); @@ -648,7 +648,7 @@ udp_getcred(SYSCTL_HANDLER_ARGS) error = ENOENT; goto out; } - error = cr_cansee(req->p->p_ucred, inp->inp_socket->so_cred); + error = cr_cansee(req->td->td_proc->p_ucred, inp->inp_socket->so_cred); if (error) goto out; bzero(&xuc, sizeof(xuc)); diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 448945d..a8140c1 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -464,7 +464,7 @@ udp6_getcred(SYSCTL_HANDLER_ARGS) struct inpcb *inp; int error, s; - error = suser(req->p); + error = suser(req->td->td_proc); if (error) return (error); diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index 7f4923c..7144057 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -111,7 +111,7 @@ struct ctlname { * so that we can use the interface from the kernel or from user-space. */ struct sysctl_req { - struct proc *p; /* used for access checking */ + struct thread *td; /* used for access checking */ int lock; void *oldptr; size_t oldlen; |