From owner-cvs-all Fri Apr 27 15:24:53 2001 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 6EDAB37B424; Fri, 27 Apr 2001 15:24:46 -0700 (PDT) (envelope-from alfred@FreeBSD.org) Received: (from alfred@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f3RMOk092539; Fri, 27 Apr 2001 15:24:46 -0700 (PDT) (envelope-from alfred) Message-Id: <200104272224.f3RMOk092539@freefall.freebsd.org> From: Alfred Perlstein Date: Fri, 27 Apr 2001 15:24:46 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/vm vm_zone.c X-FreeBSD-CVS-Branch: HEAD Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG alfred 2001/04/27 15:24:46 PDT Modified files: sys/vm vm_zone.c Log: Address a number of problems with sysctl_vm_zone(). The zone allocator's locks should be leaflocks, meaning that they should never be held when entering into another subsystem, however the sysctl grabs the zone global mutex and individual zone mutexes while holding the lock it calls SYSCTL_OUT which recurses into the VM subsystem in order to wire user memory to do a safe copy. This can block and cause lock order reversals. To fix this: lock zone global. get a count of the number of zones. unlock global. allocate temporary storage. format and SYSCTL_OUT the banner. lock global. traverse list. make sure we haven't looped more than the initial count taken to avoid overflowing the allocated buffer. lock each nodes. read values and format into buffer. unlock individual node. unlock global. format and SYSCTL_OUT the rest of the data. free storage. return. Other problems included not checking for errors when doing sysctl out of the column header. Fixed. Inconsistant termination of the copied string. Fixed. Objected to by: des (for not using sbuf) Since the output is not variable length and I'm actually over allocating signifigantly and I'd like to get this fixed now, I'll work on the sbuf convertion at a later date. I would not object to someone else taking it upon themselves to convert it to sbuf. I hold no MAINTIANER rights to this code (for now). Revision Changes Path 1.43 +30 -12 src/sys/vm/vm_zone.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message