On Wed, Apr 05, 2006 at 07:16:22PM +0200, Olivier Crameri wrote: > Unfortunately, I'm having some weird issues that I can't really > understand. I can read the file using fread, but only in a buffer > that I allocated using um_kmalloc. If I use a buffer allocated by > malloc, the fread fails. Then, even if I replace all my mallocs by > um_kmallocs, some libc functions (such as sscanf) don't seem to work > properly. I guess I'm missing something, but I can't figure out what.
Define "fails" and "don't seem to work properly". If your buffers are larger than 128K, then libc malloc gets turned into UML kernel vmalloc. In this case, the buffer isn't mapped, and passing it into a system call will make it return -EFAULT. The easiest workaround for this is to memset the thing immediately after allocating it. Also, if you're using the libc things you're talking about, watch out for your stack consumption. By default, you get two pages (8K). printf will completely use it up, so it is unusable in kernel code. UML kernel stack size is configurable - CONFIG_KERNEL_STACK_ORDER - bumping that to 3 will double the kernel stack size. If problems then go away, then you know that libc is overflowing your stack. Jeff ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ User-mode-linux-devel mailing list User-mode-linux-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel