CopyOut Size Limits
H.fazaeli
fazaeli at sepehrs.com
Sat Apr 26 06:50:30 UTC 2008
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 at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to
> "freebsd-hackers-unsubscribe at freebsd.org"
>
>
>
--
With best regards.
Hooman Fazaeli <fazaeli at sepehrs.com>
Sepehr S. T. Co. Ltd.
Web: http://www.sepehrs.com
Tel: (9821)88975701-2
Fax: (9821)88983352
More information about the freebsd-hackers
mailing list