mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-20 11:11:24 +00:00
Don't acquire sysctlmemlock in userland_sysctl() when the old value
pointer is NULL, as in that case there are no userland pages that could potentially be wired. It is common for old to be NULL and oldlenp to be non-NULL in calls to userland_sysctl(), as this is used to probe for the length of a variable-length sysctl entry before retrieving a value. Note that it is typical for such calls to be made with an uninitialized value in *oldlenp, so sysctlmemlock was essentially being acquired at random (depending on the uninitialized value in *oldlenp being > PAGE_SIZE or not) for these calls prior to this patch. Differential Revision: https://reviews.freebsd.org/D2987 Reviewed by: mjg, kib Approved by: jmallett (mentor) MFC after: 1 month
This commit is contained in:
parent
9889bbac23
commit
6f99ea0520
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285208
@ -1784,7 +1784,7 @@ userland_sysctl(struct thread *td, int *name, u_int namelen, void *old,
|
||||
ktrsysctl(name, namelen);
|
||||
#endif
|
||||
|
||||
if (req.oldlen > PAGE_SIZE) {
|
||||
if (req.oldptr && req.oldlen > PAGE_SIZE) {
|
||||
memlocked = 1;
|
||||
sx_xlock(&sysctlmemlock);
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user