From owner-freebsd-hackers@FreeBSD.ORG Sat Apr 26 06:50:30 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 C80FD1065673 for ; Sat, 26 Apr 2008 06:50:30 +0000 (UTC) (envelope-from fazaeli@sepehrs.com) Received: from sepehrs.com (www.sepehrs.com [213.217.59.98]) by mx1.freebsd.org (Postfix) with ESMTP id 0442C8FC17 for ; Sat, 26 Apr 2008 06:50:29 +0000 (UTC) (envelope-from fazaeli@sepehrs.com) Received: from [192.168.1.180] ([192.168.1.180]) by sepehrs.com (8.13.6/8.13.6) with ESMTP id m3Q9qXZF029933 for ; Sat, 26 Apr 2008 09:52:33 GMT (envelope-from fazaeli@sepehrs.com) Message-ID: <4812CA4E.8030004@sepehrs.com> Date: Sat, 26 Apr 2008 10:53:10 +0430 From: "H.fazaeli" User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 CC: freebsd-hackers@freebsd.org References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Sepehr-MailScanner-Information: Please contact the ISP for more information X-Sepehr-MailScanner: Found to be clean X-Sepehr-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.921, required 5, autolearn=not spam, ALL_TRUSTED -1.80, BAYES_00 -2.60, DATE_IN_PAST_03_06 0.48) X-MailScanner-From: fazaeli@sepehrs.com X-Spam-Status: No Subject: Re: 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: Sat, 26 Apr 2008 06:50:30 -0000 Do not allocate my_type (in general, big data structures) on kernel stack (e.g, use malloc(9)). Adam wrote: > 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 > > > > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to > "freebsd-hackers-unsubscribe@freebsd.org" > > > -- With best regards. Hooman Fazaeli Sepehr S. T. Co. Ltd. Web: http://www.sepehrs.com Tel: (9821)88975701-2 Fax: (9821)88983352