mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-02 10:56:21 +08:00
Disable user credentials and use default values
This commit is contained in:
parent
cc5f4b2705
commit
69b29a0c0d
2
Makefile
2
Makefile
@ -84,7 +84,6 @@ LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-sysctlbyname.c
|
|||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-sysctl.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-sysctl.c
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-sysctlnametomib.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-sysctlnametomib.c
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-taskqueue.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-taskqueue.c
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-thread0-ucred.c
|
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-thread.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-thread.c
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-timesupport.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-timesupport.c
|
||||||
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-vm_glue.c
|
LIB_C_FILES += rtemsbsd/rtems/rtems-bsd-vm_glue.c
|
||||||
@ -137,7 +136,6 @@ LIB_C_FILES += freebsd/sys/kern/kern_module.c
|
|||||||
LIB_C_FILES += freebsd/sys/kern/kern_mtxpool.c
|
LIB_C_FILES += freebsd/sys/kern/kern_mtxpool.c
|
||||||
LIB_C_FILES += freebsd/sys/kern/kern_ntptime.c
|
LIB_C_FILES += freebsd/sys/kern/kern_ntptime.c
|
||||||
LIB_C_FILES += freebsd/sys/kern/kern_proc.c
|
LIB_C_FILES += freebsd/sys/kern/kern_proc.c
|
||||||
LIB_C_FILES += freebsd/sys/kern/kern_prot.c
|
|
||||||
LIB_C_FILES += freebsd/sys/kern/kern_resource.c
|
LIB_C_FILES += freebsd/sys/kern/kern_resource.c
|
||||||
LIB_C_FILES += freebsd/sys/kern/kern_subr.c
|
LIB_C_FILES += freebsd/sys/kern/kern_subr.c
|
||||||
LIB_C_FILES += freebsd/sys/kern/kern_sysctl.c
|
LIB_C_FILES += freebsd/sys/kern/kern_sysctl.c
|
||||||
|
@ -641,7 +641,6 @@ rtems.addRTEMSSourceFiles(
|
|||||||
'rtems/rtems-bsd-sysctl.c',
|
'rtems/rtems-bsd-sysctl.c',
|
||||||
'rtems/rtems-bsd-sysctlnametomib.c',
|
'rtems/rtems-bsd-sysctlnametomib.c',
|
||||||
'rtems/rtems-bsd-taskqueue.c',
|
'rtems/rtems-bsd-taskqueue.c',
|
||||||
'rtems/rtems-bsd-thread0-ucred.c',
|
|
||||||
'rtems/rtems-bsd-thread.c',
|
'rtems/rtems-bsd-thread.c',
|
||||||
'rtems/rtems-bsd-timesupport.c',
|
'rtems/rtems-bsd-timesupport.c',
|
||||||
'rtems/rtems-bsd-vm_glue.c',
|
'rtems/rtems-bsd-vm_glue.c',
|
||||||
@ -796,7 +795,6 @@ base.addSourceFiles(
|
|||||||
'sys/kern/kern_mtxpool.c',
|
'sys/kern/kern_mtxpool.c',
|
||||||
'sys/kern/kern_ntptime.c',
|
'sys/kern/kern_ntptime.c',
|
||||||
'sys/kern/kern_proc.c',
|
'sys/kern/kern_proc.c',
|
||||||
'sys/kern/kern_prot.c',
|
|
||||||
'sys/kern/kern_resource.c',
|
'sys/kern/kern_resource.c',
|
||||||
'sys/kern/kern_subr.c',
|
'sys/kern/kern_subr.c',
|
||||||
'sys/kern/kern_sysctl.c',
|
'sys/kern/kern_sysctl.c',
|
||||||
|
@ -2987,8 +2987,13 @@ pf_socket_lookup(int direction, struct pf_pdesc *pd)
|
|||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
if (inp_arg != NULL) {
|
if (inp_arg != NULL) {
|
||||||
INP_LOCK_ASSERT(inp_arg);
|
INP_LOCK_ASSERT(inp_arg);
|
||||||
|
#ifndef __rtems__
|
||||||
pd->lookup.uid = inp_arg->inp_cred->cr_uid;
|
pd->lookup.uid = inp_arg->inp_cred->cr_uid;
|
||||||
pd->lookup.gid = inp_arg->inp_cred->cr_groups[0];
|
pd->lookup.gid = inp_arg->inp_cred->cr_groups[0];
|
||||||
|
#else /* __rtems__ */
|
||||||
|
pd->lookup.uid = BSD_DEFAULT_UID;
|
||||||
|
pd->lookup.gid = BSD_DEFAULT_GID;
|
||||||
|
#endif /* __rtems__ */
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -3085,8 +3090,13 @@ pf_socket_lookup(int direction, struct pf_pdesc *pd)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
|
#ifndef __rtems__
|
||||||
pd->lookup.uid = inp->inp_cred->cr_uid;
|
pd->lookup.uid = inp->inp_cred->cr_uid;
|
||||||
pd->lookup.gid = inp->inp_cred->cr_groups[0];
|
pd->lookup.gid = inp->inp_cred->cr_groups[0];
|
||||||
|
#else /* __rtems__ */
|
||||||
|
pd->lookup.uid = BSD_DEFAULT_UID;
|
||||||
|
pd->lookup.gid = BSD_DEFAULT_GID;
|
||||||
|
#endif /* __rtems__ */
|
||||||
INP_INFO_RUNLOCK(pi);
|
INP_INFO_RUNLOCK(pi);
|
||||||
#else
|
#else
|
||||||
pd->lookup.uid = inp->inp_socket->so_euid;
|
pd->lookup.uid = inp->inp_socket->so_euid;
|
||||||
|
@ -1489,10 +1489,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
|
|||||||
}
|
}
|
||||||
bcopy(&pr->rule, rule, sizeof(struct pf_rule));
|
bcopy(&pr->rule, rule, sizeof(struct pf_rule));
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
rule->cuid = td->td_ucred->cr_ruid;
|
|
||||||
#ifndef __rtems__
|
#ifndef __rtems__
|
||||||
|
rule->cuid = td->td_ucred->cr_ruid;
|
||||||
rule->cpid = td->td_proc ? td->td_proc->p_pid : 0;
|
rule->cpid = td->td_proc ? td->td_proc->p_pid : 0;
|
||||||
#else /* __rtems__ */
|
#else /* __rtems__ */
|
||||||
|
rule->cuid = BSD_DEFAULT_UID;
|
||||||
rule->cpid = BSD_DEFAULT_PID;
|
rule->cpid = BSD_DEFAULT_PID;
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
#else
|
#else
|
||||||
@ -1763,10 +1764,11 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
|
|||||||
}
|
}
|
||||||
bcopy(&pcr->rule, newrule, sizeof(struct pf_rule));
|
bcopy(&pcr->rule, newrule, sizeof(struct pf_rule));
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
newrule->cuid = td->td_ucred->cr_ruid;
|
|
||||||
#ifndef __rtems__
|
#ifndef __rtems__
|
||||||
|
newrule->cuid = td->td_ucred->cr_ruid;
|
||||||
newrule->cpid = td->td_proc ? td->td_proc->p_pid : 0;
|
newrule->cpid = td->td_proc ? td->td_proc->p_pid : 0;
|
||||||
#else /* __rtems__ */
|
#else /* __rtems__ */
|
||||||
|
newrule->cuid = BSD_DEFAULT_UID;
|
||||||
newrule->cpid = BSD_DEFAULT_PID;
|
newrule->cpid = BSD_DEFAULT_PID;
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
#else
|
#else
|
||||||
|
@ -875,7 +875,9 @@ intr_event_schedule_thread(struct intr_event *ie)
|
|||||||
struct intr_thread *it;
|
struct intr_thread *it;
|
||||||
struct thread *td;
|
struct thread *td;
|
||||||
struct thread *ctd;
|
struct thread *ctd;
|
||||||
|
#ifndef __rtems__
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If no ithread or no handlers, then we have a stray interrupt.
|
* If no ithread or no handlers, then we have a stray interrupt.
|
||||||
@ -887,7 +889,9 @@ intr_event_schedule_thread(struct intr_event *ie)
|
|||||||
ctd = curthread;
|
ctd = curthread;
|
||||||
it = ie->ie_thread;
|
it = ie->ie_thread;
|
||||||
td = it->it_thread;
|
td = it->it_thread;
|
||||||
|
#ifndef __rtems__
|
||||||
p = td->td_proc;
|
p = td->td_proc;
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If any of the handlers for this ithread claim to be good
|
* If any of the handlers for this ithread claim to be good
|
||||||
@ -1040,7 +1044,9 @@ intr_event_schedule_thread(struct intr_event *ie, struct intr_thread *it)
|
|||||||
struct intr_entropy entropy;
|
struct intr_entropy entropy;
|
||||||
struct thread *td;
|
struct thread *td;
|
||||||
struct thread *ctd;
|
struct thread *ctd;
|
||||||
|
#ifndef __rtems__
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If no ithread or no handlers, then we have a stray interrupt.
|
* If no ithread or no handlers, then we have a stray interrupt.
|
||||||
@ -1050,7 +1056,9 @@ intr_event_schedule_thread(struct intr_event *ie, struct intr_thread *it)
|
|||||||
|
|
||||||
ctd = curthread;
|
ctd = curthread;
|
||||||
td = it->it_thread;
|
td = it->it_thread;
|
||||||
|
#ifndef __rtems__
|
||||||
p = td->td_proc;
|
p = td->td_proc;
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If any of the handlers for this ithread claim to be good
|
* If any of the handlers for this ithread claim to be good
|
||||||
@ -1341,7 +1349,11 @@ ithread_loop(void *arg)
|
|||||||
struct proc *p;
|
struct proc *p;
|
||||||
|
|
||||||
td = curthread;
|
td = curthread;
|
||||||
|
#ifndef __rtems__
|
||||||
p = td->td_proc;
|
p = td->td_proc;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
p = NULL;
|
||||||
|
#endif /* __rtems__ */
|
||||||
ithd = (struct intr_thread *)arg;
|
ithd = (struct intr_thread *)arg;
|
||||||
KASSERT(ithd->it_thread == td,
|
KASSERT(ithd->it_thread == td,
|
||||||
("%s: ithread and proc linkage out of sync", __func__));
|
("%s: ithread and proc linkage out of sync", __func__));
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1332,7 +1332,6 @@ chgproccnt(uip, diff, max)
|
|||||||
}
|
}
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
#endif /* __rtems__ */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Change the total socket buffer size a user has used.
|
* Change the total socket buffer size a user has used.
|
||||||
@ -1361,7 +1360,6 @@ chgsbsize(uip, hiwat, to, max)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __rtems__
|
|
||||||
/*
|
/*
|
||||||
* Change the count associated with number of pseudo-terminals
|
* Change the count associated with number of pseudo-terminals
|
||||||
* a given user is using. When 'max' is 0, don't enforce a limit
|
* a given user is using. When 'max' is 0, don't enforce a limit
|
||||||
|
@ -3194,6 +3194,7 @@ filt_solisten(struct knote *kn, long hint)
|
|||||||
return (! TAILQ_EMPTY(&so->so_comp));
|
return (! TAILQ_EMPTY(&so->so_comp));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
int
|
int
|
||||||
socheckuid(struct socket *so, uid_t uid)
|
socheckuid(struct socket *so, uid_t uid)
|
||||||
{
|
{
|
||||||
@ -3204,6 +3205,7 @@ socheckuid(struct socket *so, uid_t uid)
|
|||||||
return (EPERM);
|
return (EPERM);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
sysctl_somaxconn(SYSCTL_HANDLER_ARGS)
|
sysctl_somaxconn(SYSCTL_HANDLER_ARGS)
|
||||||
@ -3446,7 +3448,11 @@ sotoxsocket(struct socket *so, struct xsocket *xso)
|
|||||||
xso->so_oobmark = so->so_oobmark;
|
xso->so_oobmark = so->so_oobmark;
|
||||||
sbtoxsockbuf(&so->so_snd, &xso->so_snd);
|
sbtoxsockbuf(&so->so_snd, &xso->so_snd);
|
||||||
sbtoxsockbuf(&so->so_rcv, &xso->so_rcv);
|
sbtoxsockbuf(&so->so_rcv, &xso->so_rcv);
|
||||||
|
#ifndef __rtems__
|
||||||
xso->so_uid = so->so_cred->cr_uid;
|
xso->so_uid = so->so_cred->cr_uid;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
xso->so_uid = BSD_DEFAULT_UID;
|
||||||
|
#endif /* __rtems__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -385,8 +385,12 @@ in_pcbbind_setup(struct inpcb *inp, struct sockaddr *nam, in_addr_t *laddrp,
|
|||||||
ntohl(t->inp_laddr.s_addr) != INADDR_ANY ||
|
ntohl(t->inp_laddr.s_addr) != INADDR_ANY ||
|
||||||
(t->inp_socket->so_options &
|
(t->inp_socket->so_options &
|
||||||
SO_REUSEPORT) == 0) &&
|
SO_REUSEPORT) == 0) &&
|
||||||
|
#ifndef __rtems__
|
||||||
(inp->inp_cred->cr_uid !=
|
(inp->inp_cred->cr_uid !=
|
||||||
t->inp_cred->cr_uid))
|
t->inp_cred->cr_uid))
|
||||||
|
#else /* __rtems__ */
|
||||||
|
0)
|
||||||
|
#endif /* __rtems__ */
|
||||||
return (EADDRINUSE);
|
return (EADDRINUSE);
|
||||||
}
|
}
|
||||||
t = in_pcblookup_local(pcbinfo, sin->sin_addr,
|
t = in_pcblookup_local(pcbinfo, sin->sin_addr,
|
||||||
|
@ -717,11 +717,19 @@ check_uidgid(ipfw_insn_u32 *insn, int proto, struct ifnet *oif,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (insn->o.opcode == O_UID)
|
if (insn->o.opcode == O_UID)
|
||||||
|
#ifndef __rtems__
|
||||||
match = ((*uc)->cr_uid == (uid_t)insn->d[0]);
|
match = ((*uc)->cr_uid == (uid_t)insn->d[0]);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
match = (BSD_DEFAULT_UID == (uid_t)insn->d[0]);
|
||||||
|
#endif /* __rtems__ */
|
||||||
else if (insn->o.opcode == O_GID)
|
else if (insn->o.opcode == O_GID)
|
||||||
match = groupmember((gid_t)insn->d[0], *uc);
|
match = groupmember((gid_t)insn->d[0], *uc);
|
||||||
else if (insn->o.opcode == O_JAIL)
|
else if (insn->o.opcode == O_JAIL)
|
||||||
|
#ifndef __rtems__
|
||||||
match = ((*uc)->cr_prison->pr_id == (int)insn->d[0]);
|
match = ((*uc)->cr_prison->pr_id == (int)insn->d[0]);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
match = (BSD_DEFAULT_PRISON->pr_id == (int)insn->d[0]);
|
||||||
|
#endif /* __rtems__ */
|
||||||
return match;
|
return match;
|
||||||
#endif /* __FreeBSD__ */
|
#endif /* __FreeBSD__ */
|
||||||
}
|
}
|
||||||
@ -1389,9 +1397,17 @@ do { \
|
|||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
&ucred_cache, args->inp);
|
&ucred_cache, args->inp);
|
||||||
if (v == 4 /* O_UID */)
|
if (v == 4 /* O_UID */)
|
||||||
|
#ifndef __rtems__
|
||||||
key = ucred_cache->cr_uid;
|
key = ucred_cache->cr_uid;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
key = BSD_DEFAULT_UID;
|
||||||
|
#endif /* __rtems__ */
|
||||||
else if (v == 5 /* O_JAIL */)
|
else if (v == 5 /* O_JAIL */)
|
||||||
|
#ifndef __rtems__
|
||||||
key = ucred_cache->cr_prison->pr_id;
|
key = ucred_cache->cr_prison->pr_id;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
key = BSD_DEFAULT_PRISON->pr_id;
|
||||||
|
#endif /* __rtems__ */
|
||||||
#else /* !__FreeBSD__ */
|
#else /* !__FreeBSD__ */
|
||||||
(void *)&ucred_cache,
|
(void *)&ucred_cache,
|
||||||
(struct inpcb *)args->m);
|
(struct inpcb *)args->m);
|
||||||
|
@ -735,7 +735,7 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
|
|||||||
thread0.td_ucred)) != 0) {
|
thread0.td_ucred)) != 0) {
|
||||||
#else /* __rtems__ */
|
#else /* __rtems__ */
|
||||||
if ((error = in6_pcbconnect(inp, (struct sockaddr *)&sin6,
|
if ((error = in6_pcbconnect(inp, (struct sockaddr *)&sin6,
|
||||||
rtems_bsd_thread0_ucred)) != 0) {
|
NULL)) != 0) {
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
inp->in6p_laddr = laddr6;
|
inp->in6p_laddr = laddr6;
|
||||||
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
|
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
|
||||||
@ -775,7 +775,7 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
|
|||||||
thread0.td_ucred)) != 0) {
|
thread0.td_ucred)) != 0) {
|
||||||
#else /* __rtems__ */
|
#else /* __rtems__ */
|
||||||
if ((error = in_pcbconnect(inp, (struct sockaddr *)&sin,
|
if ((error = in_pcbconnect(inp, (struct sockaddr *)&sin,
|
||||||
rtems_bsd_thread0_ucred)) != 0) {
|
NULL)) != 0) {
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
inp->inp_laddr = laddr;
|
inp->inp_laddr = laddr;
|
||||||
|
@ -724,7 +724,11 @@ icmp6_input(struct mbuf **mp, int *offp, int proto)
|
|||||||
n->m_pkthdr.rcvif = NULL;
|
n->m_pkthdr.rcvif = NULL;
|
||||||
n->m_len = 0;
|
n->m_len = 0;
|
||||||
maxhlen = M_TRAILINGSPACE(n) - maxlen;
|
maxhlen = M_TRAILINGSPACE(n) - maxlen;
|
||||||
|
#ifndef __rtems__
|
||||||
pr = curthread->td_ucred->cr_prison;
|
pr = curthread->td_ucred->cr_prison;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
pr = &prison0;
|
||||||
|
#endif /* __rtems__ */
|
||||||
mtx_lock(&pr->pr_mtx);
|
mtx_lock(&pr->pr_mtx);
|
||||||
hlen = strlen(pr->pr_hostname);
|
hlen = strlen(pr->pr_hostname);
|
||||||
if (maxhlen > hlen)
|
if (maxhlen > hlen)
|
||||||
@ -1339,7 +1343,11 @@ ni6_input(struct mbuf *m, int off)
|
|||||||
* wildcard match, if gethostname(3) side has
|
* wildcard match, if gethostname(3) side has
|
||||||
* truncated hostname.
|
* truncated hostname.
|
||||||
*/
|
*/
|
||||||
|
#ifndef __rtems__
|
||||||
pr = curthread->td_ucred->cr_prison;
|
pr = curthread->td_ucred->cr_prison;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
pr = &prison0;
|
||||||
|
#endif /* __rtems__ */
|
||||||
mtx_lock(&pr->pr_mtx);
|
mtx_lock(&pr->pr_mtx);
|
||||||
n = ni6_nametodns(pr->pr_hostname,
|
n = ni6_nametodns(pr->pr_hostname,
|
||||||
strlen(pr->pr_hostname), 0);
|
strlen(pr->pr_hostname), 0);
|
||||||
@ -1467,7 +1475,11 @@ ni6_input(struct mbuf *m, int off)
|
|||||||
/*
|
/*
|
||||||
* XXX do we really have FQDN in hostname?
|
* XXX do we really have FQDN in hostname?
|
||||||
*/
|
*/
|
||||||
|
#ifndef __rtems__
|
||||||
pr = curthread->td_ucred->cr_prison;
|
pr = curthread->td_ucred->cr_prison;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
pr = &prison0;
|
||||||
|
#endif /* __rtems__ */
|
||||||
mtx_lock(&pr->pr_mtx);
|
mtx_lock(&pr->pr_mtx);
|
||||||
n->m_next = ni6_nametodns(pr->pr_hostname,
|
n->m_next = ni6_nametodns(pr->pr_hostname,
|
||||||
strlen(pr->pr_hostname), oldfqdn);
|
strlen(pr->pr_hostname), oldfqdn);
|
||||||
|
@ -118,7 +118,11 @@ get_rand_ifid(struct ifnet *ifp, struct in6_addr *in6)
|
|||||||
u_int8_t digest[16];
|
u_int8_t digest[16];
|
||||||
int hostnamelen;
|
int hostnamelen;
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
pr = curthread->td_ucred->cr_prison;
|
pr = curthread->td_ucred->cr_prison;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
pr = &prison0;
|
||||||
|
#endif /* __rtems__ */
|
||||||
mtx_lock(&pr->pr_mtx);
|
mtx_lock(&pr->pr_mtx);
|
||||||
hostnamelen = strlen(pr->pr_hostname);
|
hostnamelen = strlen(pr->pr_hostname);
|
||||||
#if 0
|
#if 0
|
||||||
@ -642,7 +646,11 @@ in6_nigroup(struct ifnet *ifp, const char *name, int namelen,
|
|||||||
* we try to do the hostname lookup ourselves.
|
* we try to do the hostname lookup ourselves.
|
||||||
*/
|
*/
|
||||||
if (!name && namelen == -1) {
|
if (!name && namelen == -1) {
|
||||||
|
#ifndef __rtems__
|
||||||
pr = curthread->td_ucred->cr_prison;
|
pr = curthread->td_ucred->cr_prison;
|
||||||
|
#else /* __rtems__ */
|
||||||
|
pr = &prison0;
|
||||||
|
#endif /* __rtems__ */
|
||||||
mtx_lock(&pr->pr_mtx);
|
mtx_lock(&pr->pr_mtx);
|
||||||
name = pr->pr_hostname;
|
name = pr->pr_hostname;
|
||||||
namelen = strlen(name);
|
namelen = strlen(name);
|
||||||
|
@ -205,8 +205,12 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
|
|||||||
(!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) ||
|
(!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) ||
|
||||||
!IN6_IS_ADDR_UNSPECIFIED(&t->in6p_laddr) ||
|
!IN6_IS_ADDR_UNSPECIFIED(&t->in6p_laddr) ||
|
||||||
(t->inp_socket->so_options & SO_REUSEPORT)
|
(t->inp_socket->so_options & SO_REUSEPORT)
|
||||||
|
#ifndef __rtems__
|
||||||
== 0) && (inp->inp_cred->cr_uid !=
|
== 0) && (inp->inp_cred->cr_uid !=
|
||||||
t->inp_cred->cr_uid))
|
t->inp_cred->cr_uid))
|
||||||
|
#else /* __rtems__ */
|
||||||
|
== 0))
|
||||||
|
#endif /* __rtems__ */
|
||||||
return (EADDRINUSE);
|
return (EADDRINUSE);
|
||||||
if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 &&
|
if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0 &&
|
||||||
IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
|
IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
|
||||||
@ -222,8 +226,12 @@ in6_pcbbind(register struct inpcb *inp, struct sockaddr *nam,
|
|||||||
(so->so_type != SOCK_STREAM ||
|
(so->so_type != SOCK_STREAM ||
|
||||||
ntohl(t->inp_faddr.s_addr) ==
|
ntohl(t->inp_faddr.s_addr) ==
|
||||||
INADDR_ANY) &&
|
INADDR_ANY) &&
|
||||||
|
#ifndef __rtems__
|
||||||
(inp->inp_cred->cr_uid !=
|
(inp->inp_cred->cr_uid !=
|
||||||
t->inp_cred->cr_uid))
|
t->inp_cred->cr_uid))
|
||||||
|
#else /* __rtems__ */
|
||||||
|
0)
|
||||||
|
#endif /* __rtems__ */
|
||||||
return (EADDRINUSE);
|
return (EADDRINUSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -559,6 +559,7 @@ sctp6_ctlinput(int cmd, struct sockaddr *pktdst, void *d)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
/*
|
/*
|
||||||
* this routine can probably be collasped into the one in sctp_userreq.c
|
* this routine can probably be collasped into the one in sctp_userreq.c
|
||||||
* since they do the same thing and now we lookup with a sockaddr
|
* since they do the same thing and now we lookup with a sockaddr
|
||||||
@ -630,6 +631,7 @@ out:
|
|||||||
SYSCTL_PROC(_net_inet6_sctp6, OID_AUTO, getcred, CTLTYPE_OPAQUE | CTLFLAG_RW,
|
SYSCTL_PROC(_net_inet6_sctp6, OID_AUTO, getcred, CTLTYPE_OPAQUE | CTLFLAG_RW,
|
||||||
0, 0,
|
0, 0,
|
||||||
sctp6_getcred, "S,ucred", "Get the ucred of a SCTP6 connection");
|
sctp6_getcred, "S,ucred", "Get the ucred of a SCTP6 connection");
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
|
|
||||||
/* This is the same as the sctp_abort() could be made common */
|
/* This is the same as the sctp_abort() could be made common */
|
||||||
|
@ -361,14 +361,22 @@ void prison_hold_locked(struct prison *pr);
|
|||||||
void prison_proc_hold(struct prison *);
|
void prison_proc_hold(struct prison *);
|
||||||
void prison_proc_free(struct prison *);
|
void prison_proc_free(struct prison *);
|
||||||
int prison_ischild(struct prison *, struct prison *);
|
int prison_ischild(struct prison *, struct prison *);
|
||||||
|
#ifndef __rtems__
|
||||||
int prison_equal_ip4(struct prison *, struct prison *);
|
int prison_equal_ip4(struct prison *, struct prison *);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
#define prison_equal_ip4(p1, p2) 1
|
||||||
|
#endif /* __rtems__ */
|
||||||
int prison_get_ip4(struct ucred *cred, struct in_addr *ia);
|
int prison_get_ip4(struct ucred *cred, struct in_addr *ia);
|
||||||
int prison_local_ip4(struct ucred *cred, struct in_addr *ia);
|
int prison_local_ip4(struct ucred *cred, struct in_addr *ia);
|
||||||
int prison_remote_ip4(struct ucred *cred, struct in_addr *ia);
|
int prison_remote_ip4(struct ucred *cred, struct in_addr *ia);
|
||||||
int prison_check_ip4(struct ucred *cred, struct in_addr *ia);
|
int prison_check_ip4(struct ucred *cred, struct in_addr *ia);
|
||||||
int prison_saddrsel_ip4(struct ucred *, struct in_addr *);
|
int prison_saddrsel_ip4(struct ucred *, struct in_addr *);
|
||||||
#ifdef INET6
|
#ifdef INET6
|
||||||
|
#ifndef __rtems__
|
||||||
int prison_equal_ip6(struct prison *, struct prison *);
|
int prison_equal_ip6(struct prison *, struct prison *);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
#define prison_equal_ip6(p1, p2) 1
|
||||||
|
#endif /* __rtems__ */
|
||||||
int prison_get_ip6(struct ucred *, struct in6_addr *);
|
int prison_get_ip6(struct ucred *, struct in6_addr *);
|
||||||
int prison_local_ip6(struct ucred *, struct in6_addr *, int);
|
int prison_local_ip6(struct ucred *, struct in6_addr *, int);
|
||||||
int prison_remote_ip6(struct ucred *, struct in6_addr *);
|
int prison_remote_ip6(struct ucred *, struct in6_addr *);
|
||||||
|
@ -205,9 +205,7 @@ struct thread {
|
|||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
#ifndef __rtems__
|
#ifndef __rtems__
|
||||||
struct mtx *volatile td_lock; /* replaces sched lock */
|
struct mtx *volatile td_lock; /* replaces sched lock */
|
||||||
#endif /* __rtems__ */
|
|
||||||
struct proc *td_proc; /* (*) Associated process. */
|
struct proc *td_proc; /* (*) Associated process. */
|
||||||
#ifndef __rtems__
|
|
||||||
TAILQ_ENTRY(thread) td_plist; /* (*) All threads in this proc. */
|
TAILQ_ENTRY(thread) td_plist; /* (*) All threads in this proc. */
|
||||||
TAILQ_ENTRY(thread) td_runq; /* (t) Run queue. */
|
TAILQ_ENTRY(thread) td_runq; /* (t) Run queue. */
|
||||||
TAILQ_ENTRY(thread) td_slpq; /* (t) Sleep queue. */
|
TAILQ_ENTRY(thread) td_slpq; /* (t) Sleep queue. */
|
||||||
@ -574,8 +572,6 @@ struct proc {
|
|||||||
LIST_HEAD(, mqueue_notifier) p_mqnotifier; /* (c) mqueue notifiers.*/
|
LIST_HEAD(, mqueue_notifier) p_mqnotifier; /* (c) mqueue notifiers.*/
|
||||||
struct kdtrace_proc *p_dtrace; /* (*) DTrace-specific data. */
|
struct kdtrace_proc *p_dtrace; /* (*) DTrace-specific data. */
|
||||||
struct cv p_pwait; /* (*) wait cv for exit/exec */
|
struct cv p_pwait; /* (*) wait cv for exit/exec */
|
||||||
#else /* __rtems__ */
|
|
||||||
struct ucred *p_ucred; /* (c) Process owner's identity. */
|
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -796,11 +792,7 @@ extern struct sx allproc_lock;
|
|||||||
extern struct sx proctree_lock;
|
extern struct sx proctree_lock;
|
||||||
extern struct mtx ppeers_lock;
|
extern struct mtx ppeers_lock;
|
||||||
extern struct proc proc0; /* Process slot for swapper. */
|
extern struct proc proc0; /* Process slot for swapper. */
|
||||||
#ifndef __rtems__
|
|
||||||
extern struct thread thread0; /* Primary thread in proc0. */
|
extern struct thread thread0; /* Primary thread in proc0. */
|
||||||
#else /* __rtems__ */
|
|
||||||
extern struct ucred *rtems_bsd_thread0_ucred;
|
|
||||||
#endif /* __rtems__ */
|
|
||||||
extern struct vmspace vmspace0; /* VM space for proc0. */
|
extern struct vmspace vmspace0; /* VM space for proc0. */
|
||||||
extern int hogticks; /* Limit on kernel cpu hogs. */
|
extern int hogticks; /* Limit on kernel cpu hogs. */
|
||||||
extern int lastpid;
|
extern int lastpid;
|
||||||
|
@ -111,8 +111,19 @@ void addupc_task(struct thread *td, uintfptr_t pc, u_int ticks);
|
|||||||
void calccru(struct proc *p, struct timeval *up, struct timeval *sp);
|
void calccru(struct proc *p, struct timeval *up, struct timeval *sp);
|
||||||
void calcru(struct proc *p, struct timeval *up, struct timeval *sp);
|
void calcru(struct proc *p, struct timeval *up, struct timeval *sp);
|
||||||
int chgproccnt(struct uidinfo *uip, int diff, rlim_t maxval);
|
int chgproccnt(struct uidinfo *uip, int diff, rlim_t maxval);
|
||||||
|
#ifndef __rtems__
|
||||||
int chgsbsize(struct uidinfo *uip, u_int *hiwat, u_int to,
|
int chgsbsize(struct uidinfo *uip, u_int *hiwat, u_int to,
|
||||||
rlim_t maxval);
|
rlim_t maxval);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
static inline int
|
||||||
|
rtems_bsd_chgsbsize(u_int *hiwat, u_int to)
|
||||||
|
{
|
||||||
|
*hiwat = to;
|
||||||
|
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
#define chgsbsize(uip, hiwat, to, maxval) rtems_bsd_chgsbsize(hiwat, to)
|
||||||
|
#endif /* __rtems__ */
|
||||||
int chgptscnt(struct uidinfo *uip, int diff, rlim_t maxval);
|
int chgptscnt(struct uidinfo *uip, int diff, rlim_t maxval);
|
||||||
int fuswintr(void *base);
|
int fuswintr(void *base);
|
||||||
struct plimit
|
struct plimit
|
||||||
|
@ -257,9 +257,15 @@ void stopprofclock(struct proc *);
|
|||||||
void cpu_startprofclock(void);
|
void cpu_startprofclock(void);
|
||||||
void cpu_stopprofclock(void);
|
void cpu_stopprofclock(void);
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
int cr_cansee(struct ucred *u1, struct ucred *u2);
|
int cr_cansee(struct ucred *u1, struct ucred *u2);
|
||||||
int cr_canseesocket(struct ucred *cred, struct socket *so);
|
int cr_canseesocket(struct ucred *cred, struct socket *so);
|
||||||
int cr_canseeinpcb(struct ucred *cred, struct inpcb *inp);
|
int cr_canseeinpcb(struct ucred *cred, struct inpcb *inp);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
#define cr_cansee(u1, u2) 1
|
||||||
|
#define cr_canseesocket(cred, so) 1
|
||||||
|
#define cr_canseeinpcb(cred, inp) 1
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
char *getenv(const char *name);
|
char *getenv(const char *name);
|
||||||
void freeenv(char *env);
|
void freeenv(char *env);
|
||||||
|
@ -42,6 +42,7 @@
|
|||||||
* priv(9) interface should be used to check for privilege.
|
* priv(9) interface should be used to check for privilege.
|
||||||
*/
|
*/
|
||||||
#if defined(_KERNEL) || defined(_WANT_UCRED)
|
#if defined(_KERNEL) || defined(_WANT_UCRED)
|
||||||
|
#ifndef __rtems__
|
||||||
struct ucred {
|
struct ucred {
|
||||||
u_int cr_ref; /* reference count */
|
u_int cr_ref; /* reference count */
|
||||||
#define cr_startcopy cr_uid
|
#define cr_startcopy cr_uid
|
||||||
@ -63,6 +64,9 @@ struct ucred {
|
|||||||
gid_t *cr_groups; /* groups */
|
gid_t *cr_groups; /* groups */
|
||||||
int cr_agroups; /* Available groups */
|
int cr_agroups; /* Available groups */
|
||||||
};
|
};
|
||||||
|
#else /* __rtems__ */
|
||||||
|
struct ucred;
|
||||||
|
#endif /* __rtems__ */
|
||||||
#define NOCRED ((struct ucred *)0) /* no credential available */
|
#define NOCRED ((struct ucred *)0) /* no credential available */
|
||||||
#define FSCRED ((struct ucred *)-1) /* filesystem credential */
|
#define FSCRED ((struct ucred *)-1) /* filesystem credential */
|
||||||
#endif /* _KERNEL || _WANT_UCRED */
|
#endif /* _KERNEL || _WANT_UCRED */
|
||||||
@ -73,11 +77,13 @@ struct ucred {
|
|||||||
* This is the external representation of struct ucred.
|
* This is the external representation of struct ucred.
|
||||||
*/
|
*/
|
||||||
struct xucred {
|
struct xucred {
|
||||||
|
#ifndef __rtems__
|
||||||
u_int cr_version; /* structure layout version */
|
u_int cr_version; /* structure layout version */
|
||||||
uid_t cr_uid; /* effective user id */
|
uid_t cr_uid; /* effective user id */
|
||||||
short cr_ngroups; /* number of groups */
|
short cr_ngroups; /* number of groups */
|
||||||
gid_t cr_groups[XU_NGROUPS]; /* groups */
|
gid_t cr_groups[XU_NGROUPS]; /* groups */
|
||||||
void *_cr_unused1; /* compatibility with old ucred */
|
void *_cr_unused1; /* compatibility with old ucred */
|
||||||
|
#endif /* __rtems__ */
|
||||||
};
|
};
|
||||||
#define XUCRED_VERSION 0
|
#define XUCRED_VERSION 0
|
||||||
|
|
||||||
@ -88,6 +94,7 @@ struct xucred {
|
|||||||
struct proc;
|
struct proc;
|
||||||
struct thread;
|
struct thread;
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
void change_egid(struct ucred *newcred, gid_t egid);
|
void change_egid(struct ucred *newcred, gid_t egid);
|
||||||
void change_euid(struct ucred *newcred, struct uidinfo *euip);
|
void change_euid(struct ucred *newcred, struct uidinfo *euip);
|
||||||
void change_rgid(struct ucred *newcred, gid_t rgid);
|
void change_rgid(struct ucred *newcred, gid_t rgid);
|
||||||
@ -105,6 +112,11 @@ int crshared(struct ucred *cr);
|
|||||||
void cru2x(struct ucred *cr, struct xucred *xcr);
|
void cru2x(struct ucred *cr, struct xucred *xcr);
|
||||||
void crsetgroups(struct ucred *cr, int n, gid_t *groups);
|
void crsetgroups(struct ucred *cr, int n, gid_t *groups);
|
||||||
int groupmember(gid_t gid, struct ucred *cred);
|
int groupmember(gid_t gid, struct ucred *cred);
|
||||||
|
#else /* __rtems__ */
|
||||||
|
#define crfree(cr) do { } while (0)
|
||||||
|
#define crhold(cr) NULL
|
||||||
|
#define cru2x(cr, xcr) do { } while (0)
|
||||||
|
#endif /* __rtems__ */
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
#endif /* !_SYS_UCRED_H_ */
|
#endif /* !_SYS_UCRED_H_ */
|
||||||
|
@ -56,6 +56,14 @@ the current Git submodule commit is this
|
|||||||
* Process identifiers are not supported. Every PID value is set to zero
|
* Process identifiers are not supported. Every PID value is set to zero
|
||||||
(= BSD_DEFAULT_PID).
|
(= BSD_DEFAULT_PID).
|
||||||
|
|
||||||
|
* User credentials are not supported. The following functions allow the
|
||||||
|
operation for everyone
|
||||||
|
- prison_equal_ip4(),
|
||||||
|
- chgsbsize(),
|
||||||
|
- cr_cansee(),
|
||||||
|
- cr_canseesocket() and
|
||||||
|
- cr_canseeinpcb().
|
||||||
|
|
||||||
* Sebastian Huber and Joel Sherrill discussed the need for a a basic USB
|
* Sebastian Huber and Joel Sherrill discussed the need for a a basic USB
|
||||||
functionality test that is known to work on qemu pc.
|
functionality test that is known to work on qemu pc.
|
||||||
|
|
||||||
|
@ -140,6 +140,12 @@ void rtems_bsd_assert_func(const char *file, int line, const char *func, const c
|
|||||||
|
|
||||||
#define BSD_DEFAULT_PID 0
|
#define BSD_DEFAULT_PID 0
|
||||||
|
|
||||||
|
#define BSD_DEFAULT_UID 0
|
||||||
|
|
||||||
|
#define BSD_DEFAULT_GID 0
|
||||||
|
|
||||||
|
#define BSD_DEFAULT_PRISON (&prison0)
|
||||||
|
|
||||||
extern rtems_chain_control rtems_bsd_lock_chain;
|
extern rtems_chain_control rtems_bsd_lock_chain;
|
||||||
|
|
||||||
extern rtems_chain_control rtems_bsd_mtx_chain;
|
extern rtems_chain_control rtems_bsd_mtx_chain;
|
||||||
|
@ -114,7 +114,7 @@ int
|
|||||||
prison_flag(struct ucred *cred, unsigned flag)
|
prison_flag(struct ucred *cred, unsigned flag)
|
||||||
{
|
{
|
||||||
/* This is an atomic read, so no locking is necessary. */
|
/* This is an atomic read, so no locking is necessary. */
|
||||||
return (cred->cr_prison->pr_flags & flag);
|
return (prison0.pr_flags & flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -154,15 +154,6 @@ prison_saddrsel_ip6(struct ucred *cred, struct in6_addr *ia6)
|
|||||||
return EAFNOSUPPORT;
|
return EAFNOSUPPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Return true if pr1 and pr2 have the same IPv4 address restrictions.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
prison_equal_ip4(struct prison *pr1, struct prison *pr2)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if given address belongs to the jail referenced by cred/prison.
|
* Check if given address belongs to the jail referenced by cred/prison.
|
||||||
*
|
*
|
||||||
@ -213,15 +204,6 @@ prison_remote_ip4(struct ucred *cred, struct in_addr *ia)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Return true if pr1 and pr2 have the same IPv6 address restrictions.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
prison_equal_ip6(struct prison *pr1, struct prison *pr2)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure our (source) address is set to something meaningful to this jail.
|
* Make sure our (source) address is set to something meaningful to this jail.
|
||||||
*
|
*
|
||||||
|
@ -48,26 +48,12 @@
|
|||||||
#include <sys/kthread.h>
|
#include <sys/kthread.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/selinfo.h>
|
#include <sys/selinfo.h>
|
||||||
#include <sys/filedesc.h>
|
|
||||||
#include <sys/jail.h>
|
|
||||||
#include <sys/resourcevar.h>
|
|
||||||
|
|
||||||
#include <rtems/score/threadimpl.h>
|
#include <rtems/score/threadimpl.h>
|
||||||
#include <rtems/score/objectimpl.h>
|
#include <rtems/score/objectimpl.h>
|
||||||
|
|
||||||
RTEMS_CHAIN_DEFINE_EMPTY(rtems_bsd_thread_chain);
|
RTEMS_CHAIN_DEFINE_EMPTY(rtems_bsd_thread_chain);
|
||||||
|
|
||||||
/* FIXME: What to do with the credentials? */
|
|
||||||
static struct ucred FIXME_ucred = {
|
|
||||||
.cr_ref = 1 /* reference count */
|
|
||||||
};
|
|
||||||
static struct proc FIXME_proc = {
|
|
||||||
.p_ucred = NULL /* (c) Process owner's identity. */
|
|
||||||
};
|
|
||||||
static struct prison FIXME_prison = {
|
|
||||||
.pr_parent = NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static size_t rtems_bsd_extension_index;
|
static size_t rtems_bsd_extension_index;
|
||||||
|
|
||||||
struct thread *
|
struct thread *
|
||||||
@ -108,7 +94,6 @@ rtems_bsd_thread_create(Thread_Control *thread, int wait)
|
|||||||
|
|
||||||
if (td != NULL) {
|
if (td != NULL) {
|
||||||
td->td_thread = thread;
|
td->td_thread = thread;
|
||||||
td->td_proc = &FIXME_proc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
thread->extensions[rtems_bsd_extension_index] = td;
|
thread->extensions[rtems_bsd_extension_index] = td;
|
||||||
@ -207,15 +192,6 @@ rtems_bsd_threads_init(void *arg __unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rtems_bsd_extension_index = rtems_object_id_get_index(ext_id);
|
rtems_bsd_extension_index = rtems_object_id_get_index(ext_id);
|
||||||
|
|
||||||
mtx_init(&FIXME_prison.pr_mtx, "prison lock", NULL, MTX_DEF | MTX_DUPOK);
|
|
||||||
|
|
||||||
FIXME_ucred.cr_prison = &FIXME_prison; /* jail(2) */
|
|
||||||
FIXME_ucred.cr_uidinfo = uifind(0);
|
|
||||||
FIXME_ucred.cr_ruidinfo = uifind(0);
|
|
||||||
FIXME_ucred.cr_ngroups = 1; /* group 0 */
|
|
||||||
|
|
||||||
FIXME_proc.p_ucred = crhold(&FIXME_ucred);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSINIT(rtems_bsd_threads, SI_SUB_INTRINSIC, SI_ORDER_ANY, rtems_bsd_threads_init, NULL);
|
SYSINIT(rtems_bsd_threads, SI_SUB_INTRINSIC, SI_ORDER_ANY, rtems_bsd_threads_init, NULL);
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file
|
|
||||||
*
|
|
||||||
* @ingroup rtems_bsd_rtems
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2012 On-Line Applications Research Corporation (OAR).
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <machine/rtems-bsd-config.h>
|
|
||||||
|
|
||||||
#include <rtems/bsd/sys/param.h>
|
|
||||||
#include <rtems/bsd/sys/types.h>
|
|
||||||
#include <sys/systm.h>
|
|
||||||
#include <sys/proc.h>
|
|
||||||
#include <sys/jail.h>
|
|
||||||
#include <sys/kernel.h>
|
|
||||||
#include <sys/resourcevar.h>
|
|
||||||
|
|
||||||
struct ucred *rtems_bsd_thread0_ucred;
|
|
||||||
|
|
||||||
static void rtems_bsd_thread0_ucred_init(void *arg)
|
|
||||||
{
|
|
||||||
rtems_bsd_thread0_ucred = crget();
|
|
||||||
rtems_bsd_thread0_ucred->cr_ngroups = 1; /* group 0 */
|
|
||||||
rtems_bsd_thread0_ucred->cr_uidinfo = uifind(0);
|
|
||||||
rtems_bsd_thread0_ucred->cr_prison = &prison0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SYSINIT(cpu, SI_SUB_INTRINSIC, SI_ORDER_SECOND, rtems_bsd_thread0_ucred_init, NULL);
|
|
Loading…
x
Reference in New Issue
Block a user