Check to see if we wired the user-supplied buffers in SYSCTL_OUT, if

the buffer has not been wired and we are holding any non-sleep-able locks,
drop a witness warning. If the buffer has not been wired, it is possible
that the writing of the data can sleep, especially if the page is not in
memory. This can result in a number of different locking issues, including
dead locks.

MFC after:	1 week
Discussed with:	rwatson
Reviewed by:	jhb
This commit is contained in:
Christian S.J. Peron 2005-08-08 18:54:35 +00:00
parent c1225b52f6
commit 417ab24f78

View File

@ -1066,7 +1066,12 @@ sysctl_old_user(struct sysctl_req *req, const void *p, size_t l)
req->oldidx += l;
if (req->oldptr == NULL)
return (0);
if (req->lock == REQ_LOCKED)
/*
* If we have not wired the user supplied buffer and we are currently
* holding locks, drop a witness warning, as it's possible that
* write operations to the user page can sleep.
*/
if (req->lock != REQ_WIRED)
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
"sysctl_old_user()");
i = l;