From: Blaisorblade <blaisorblade@yahoo.it>
To: user-mode-linux-devel@lists.sourceforge.net
Cc: Jeff Dike <jdike@addtoit.com>, Olivier Crameri <olivier.crameri@epfl.ch>
Subject: Re: [uml-devel] system call accessing the host os
Date: Fri, 7 Apr 2006 02:20:00 +0200 [thread overview]
Message-ID: <200604070220.01278.blaisorblade@yahoo.it> (raw)
In-Reply-To: <20060405181812.GA5684@ccure.user-mode-linux.org>
On Wednesday 05 April 2006 20:18, Jeff Dike wrote:
> 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.
No, I made it "greater than 4k" in 2.4.24 time... in fact it's what's
happening to him (see his last mail):
void *__wrap_malloc(int size)
{
void *ret;
if(!CAN_KMALLOC())
return(__real_malloc(size));
else if(size <= PAGE_SIZE) /* finding contiguos pages can be hard*/
ret = um_kmalloc(size);
else ret = um_vmalloc(size);
}
128K is the maximum conceivable kmallocable size, but it hardly works due to
fragmentation.
> 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).
By default on UML you get 4 pages, 16K, i.e. PAGE_SIZE * (1 <<
CONFIG_KERNEL_STACK_ORDER) == 4k * (1<<2) == 4k * 4.
> printf will completely use it up, so it is unusable in kernel code.
Indeed. sprintf() + write(1) works, instead - grep for my_printf in the source
code, I've coded this hack up.
> 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
--
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
-------------------------------------------------------
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
next prev parent reply other threads:[~2006-04-07 0:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-05 17:16 [uml-devel] system call accessing the host os Olivier Crameri
2006-04-05 17:18 ` D. Bahi
2006-04-05 18:18 ` Jeff Dike
2006-04-05 20:20 ` Olivier Crameri
2006-04-06 1:43 ` Jeff Dike
2006-04-06 7:18 ` Olivier Crameri
2006-04-07 0:20 ` Blaisorblade [this message]
2006-04-06 23:42 ` Jeff Dike
2006-04-07 8:20 ` Olivier Crameri
[not found] <946EDC7F-5F36-4453-93E8-36BBC8D9F032@epfl.ch>
2006-04-05 17:24 ` Olivier Crameri
2006-04-05 17:28 ` D. Bahi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200604070220.01278.blaisorblade@yahoo.it \
--to=blaisorblade@yahoo.it \
--cc=jdike@addtoit.com \
--cc=olivier.crameri@epfl.ch \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox