From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 25 14:35:15 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D625810656B4 for ; Fri, 25 Apr 2008 14:35:15 +0000 (UTC) (envelope-from adamw@signallake.com) Received: from pro38.abac.com (pro38.abac.com [66.226.64.39]) by mx1.freebsd.org (Postfix) with ESMTP id 4FA3F8FC20 for ; Fri, 25 Apr 2008 14:35:15 +0000 (UTC) (envelope-from adamw@signallake.com) Received: from [192.168.1.200] (c-24-218-111-132.hsd1.ma.comcast.net [24.218.111.132]) (authenticated bits=0) by pro38.abac.com (8.14.1/8.14.1) with ESMTP id m3PDxuRl013957 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Fri, 25 Apr 2008 06:59:57 -0700 (PDT) (envelope-from adamw@signallake.com) Message-Id: From: Adam To: freebsd-hackers@freebsd.org Mime-Version: 1.0 (Apple Message framework v919.2) Date: Fri, 25 Apr 2008 09:59:55 -0400 X-Mailer: Apple Mail (2.919.2) X-Spam-Score: 0.101 (HTML_MESSAGE) X-Mailman-Approved-At: Fri, 25 Apr 2008 14:52:51 +0000 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: CopyOut Size Limits X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Apr 2008 14:35:16 -0000 Hi, I am writing a custom system call that needs to transfer 16kb of data from the kernel to userspace. I am transferring the data out of the kernel by using copyout. This seems to work for a small struct of data < 4k. int my_system_call(struct thread *td, struct my_system_call_args *uap) { my_structtype_t my_type; copyout(&my_type,uap->my_type,sizeof(my_type) ))!=0) { printf("\n copyout failed ret%d\n",error); return error; } printf("exiting kernel %d\n",error); return (0); } However once I expand my struct size beyond around 4k that I get a "Fatal Double Fault." It seems like I am overrunning the kernel stack. Does copyout use memory from the kernel stack? What is the limit for copyout? Is there some way to allocate additional space? Alternatively what is the appropriate method for transferring kbs of data from kernel to userspace? Thanks, Adam