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
The following reply was made to PR kern/50475; it has been noted by GNATS.
From: matthew green <mrg%eterna.com.au@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: kern-bug-people%netbsd.org@localhost, gnats-admin%netbsd.org@localhost,
netbsd-bugs%netbsd.org@localhost
Subject: re: kern/50475: sys_issetugid is missing locking
Date: Sun, 29 Nov 2015 10:13:54 +1100
> 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