Mark Kettenis <[email protected]> wrote: > > * XXX > > * The current hack for YP support in "getpw" > > * is to enable some "inet" features until > > - * next pledge call. Setting a bit in ps_pledge > > - * is not safe with respect to multiple threads, > > - * a very different approach is needed. > > + * next pledge call. > > */ > > + mtx_enter(&p->p_p->ps_mtx); > > p->p_p->ps_pledge |= PLEDGE_YPACTIVE; > > + mtx_leave(&p->p_p->ps_mtx); > > + pledge |= PLEDGE_YPACTIVE; > > This appears to be a "dead store" since you're modifying a local variable > that isn't used between here > and the return two lines below.
Yes that is a bug, it should write to p->p_p->ps_pledge. (The pledge unsafely is far more serious than the poor mutexing, and if I finally write a replacement for the libc-ypserv discovery protocol the YPACTIVE code will be completely deleted.) > > ni->ni_cnd.cn_flags |= BYPASSUNVEIL; > > Is it safe to modify these flags without holding the kernel lock? The "ni" is a name-cache search structure only used by this thread, noone else can see it. This callback is used to change the behaviour of the name-cache search based upon pledge/unveil security before completing the search. It is safe.
