Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2008 17:00:10 -0400
From:      "Alexander Sack" <pisymbol@gmail.com>
To:        Adam <adamw@signallake.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: CopyOut Size Limits
Message-ID:  <3c0b01820804251400r68335fd2geaf9889b939f8379@mail.gmail.com>
In-Reply-To: <DAB770F2-C987-4AEB-BD02-BD1AEF099702@signallake.com>
References:  <DAB770F2-C987-4AEB-BD02-BD1AEF099702@signallake.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Apr 25, 2008 at 9:59 AM, Adam <adamw@signallake.com> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3c0b01820804251400r68335fd2geaf9889b939f8379>