From owner-freebsd-hackers@FreeBSD.ORG Fri Apr 25 21:00:13 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 C5D291065676 for ; Fri, 25 Apr 2008 21:00:13 +0000 (UTC) (envelope-from pisymbol@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.28]) by mx1.freebsd.org (Postfix) with ESMTP id 850ED8FC0A for ; Fri, 25 Apr 2008 21:00:13 +0000 (UTC) (envelope-from pisymbol@gmail.com) Received: by yw-out-2324.google.com with SMTP id 5so515213ywh.13 for ; Fri, 25 Apr 2008 14:00:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=yyWw9ogP6hx8OIRvwKTSc+gSM5quwRlO3h1YuKdewsc=; b=TU5LDpqzBTDwfcZcWvsnGX28Kkn4NSH/+7COU/VIhsCZ6hTRT3zaLIt2mZZ31qAjxGAQ7yGFYaiOtUi/hXSce9ZYNqqrJ9xHB3ffazm/Vu2uWL5DD1uy/jMFSOE8zGsW1WXGBR/JIcCahxqD0YG98yOzEtq/O6ZnGINFPu4PbHM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=eTij3wNghwV+hYxDyh27d+gVfXJRd40QYSrN28UGduTcmmCxURiV3CDVdBpmHxdsr9Ke9Q5WWTVgpTcph4hr+cQ92vIHV89A32F7Y1rS5EXdNAKDR1z6iC830ARWW5Sy7YdzffkvdwwNfVgfEh14Tkk2A8czSED8IUUIV3KNETA= Received: by 10.150.86.10 with SMTP id j10mr1177801ybb.202.1209157210658; Fri, 25 Apr 2008 14:00:10 -0700 (PDT) Received: by 10.151.11.1 with HTTP; Fri, 25 Apr 2008 14:00:10 -0700 (PDT) Message-ID: <3c0b01820804251400r68335fd2geaf9889b939f8379@mail.gmail.com> Date: Fri, 25 Apr 2008 17:00:10 -0400 From: "Alexander Sack" To: Adam In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Cc: freebsd-hackers@freebsd.org 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: Fri, 25 Apr 2008 21:00:13 -0000 On Fri, Apr 25, 2008 at 9:59 AM, 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 Adam, I have no idea the context and Joerg hit it on the head but have you considered using shared memory instead of a system call to achieve what you want? shmat(2) and its elk? Thanks! -aps