From owner-freebsd-arch@FreeBSD.ORG Sat Dec 29 23:43:58 2007 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1527A16A417 for ; Sat, 29 Dec 2007 23:43:58 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from webaccess-cl.virtdom.com (webaccess-cl.virtdom.com [216.240.101.25]) by mx1.freebsd.org (Postfix) with ESMTP id D3D6913C4D3 for ; Sat, 29 Dec 2007 23:43:57 +0000 (UTC) (envelope-from jroberson@chesapeake.net) Received: from [192.168.1.107] (cpe-24-94-75-93.hawaii.res.rr.com [24.94.75.93]) (authenticated bits=0) by webaccess-cl.virtdom.com (8.13.6/8.13.6) with ESMTP id lBTNhrx4067553 for ; Sat, 29 Dec 2007 18:43:54 -0500 (EST) (envelope-from jroberson@chesapeake.net) Date: Sat, 29 Dec 2007 13:44:50 -1000 (HST) From: Jeff Roberson X-X-Sender: jroberson@desktop To: arch@freebsd.org Message-ID: <20071229133256.D957@desktop> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Subject: kvm_getfiles is badly broken X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Dec 2007 23:43:58 -0000 >From kvm_getfiles(3): The number of files found is returned in the reference parameter cnt. The files are returned as a contiguous array of file structures, preceded by the address of the first file entry in the kernel. sysctl kern.file is used if the kernel is live. This code assumes the kernel copies out a struct filelist before any files. It does not. I can not find any consumers of this interface however. I also don't understand why it supplies the address of the first file and what this would be used for. There are other users of sysctl kern.file which assume it does not prepend this address so it would be wrong to change that. Would it also be wrong to change kvm to supply null as the first address? Other inconsistencies include live kernels returning strcut xfile and dead kernels returning struct file. The interface in kvm_getfiles() claims to return struct files. I can't imagine any code actually relies on this routine. Any opinions on what we should do with this? It has been broken since 2002 at least. I'm committing changes for my lockless struct file work. As part of that I'll commit a broken but compiling implementation that matches current bugs but causes the code to fail whenever it is called. Cheers, Jeff