NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

re: kern/50475: sys_issetugid is missing locking



>    sys_issetugid() reads curproc->p_flag without taking any locks, but
>    sys/proc.h says p_flag is supposed to be protected by p_lock.
> 
>    Granted reading ints is atomic on normal platforms, but it's wrong,
>    and also other code is entitled to assume that it can temporarily
>    leave invalid values in p_flag while it holds p_lock.
> 
>    If the behavior of sys_issetugid() is intended, it should be
>    documented in proc.h.

i think this is entirely intended.  these values are readable
in process context without a lock.  it's not just PK_SUGID.
this happens all over the tree, and i think it's entirely
reasonable.

proc.h comments need updating only here, i think.


.mrg.


Home | Main Index | Thread Index | Old Index