All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] Clearing kmalloc_ok during shutdown is broken - malloc will clear our data.
@ 2005-09-28 11:46 Blaisorblade
  2005-09-28 20:12 ` Jeff Dike
  2005-09-28 21:31 ` Jeff Dike
  0 siblings, 2 replies; 10+ messages in thread
From: Blaisorblade @ 2005-09-28 11:46 UTC (permalink / raw)
  To: Jeff Dike, user-mode-linux-devel

I've recently realized how potentially misguided that thing is.

And I am wondering about whether the recent "eactivate_all_fds failed, errno = 
9" (no, the initial "d" never comes out) may be due to this. Even if, now I 
see that was done even before... but first only on TT mode, then also in SKAS 
mode with commit 6770cb61ff6d557613a8382b28f9b0a919fb112f, which says "when 
getting a fatal signal".

But still, Jeff, how can we expect that malloc won't stomp over all our data 
which we preallocated with kmalloc and such?

There's no single mention of that in your original changelog, and this is 
untrivial, so I can assume you didn't realize this issue.

The git commit is 026549d28469f7d4ca7e5a4707f0d2dc4f2c164c.

On the other side, could you explain why you don't like kmalloc in first 
place? It surely works.

Also, there are some calls to kmalloc in the shutdown path - and they work. 
I know this because I saw a problem with one of them: it gave "might_sleep 
while atomic", and it was kmalloc in the shutdown, or rather, in panic() - 
for the broken sysrq t (where's the fix you promised?).

While looking for the "change" function, I thought even if it's static, that's 
still not enough to deserve such an insignificant name. Ah, it's in 
arch/um/drivers/net_user.c.

 <3>Debug: sleeping function called from invalid context 
at /home/paolo/Admin/kernel/6/VCS/linux-2.6.13/mm/slab.c:2096
in_atomic():1, irqs_disabled():0

a0327088:  [<a00164f2>] dump_stack+0x22/0x30
a03270a8:  [<a0049e1c>] __might_sleep+0xac/0xd0
a03270c8:  [<a0094fa0>] __kmalloc+0xc0/0x110
a03270f8:  [<a00129ba>] um_kmalloc+0x1a/0x20
a0327108:  [<a0038b6b>] change+0xcb/0x220
a03271d8:  [<a0038d10>] close_addr+0x20/0x30
a03271e8:  [<a00385bb>] iter_addresses+0x7b/0x90
a0327218:  [<a0041b0a>] tuntap_close+0x4a/0x70
a0327238:  [<a003827d>] close_devices+0x4d/0x90
a0327258:  [<a0012a92>] do_uml_exitcalls+0x22/0x40
a0327268:  [<a0013763>] uml_cleanup+0x13/0x20
.... panic...

The real solution for this warning is to replace um_kmalloc with malloc(), and 
set, during shutdown, kmalloc_only_atomic - which would switch 
__wrap_malloc() from um_kmalloc to um_kmalloc_atomic.

Or better yet, simply test in_atomic() and irqs_disabled() to choose between 
the atomic and normal versions.
-- 
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:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-10-03 18:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-28 11:46 [uml-devel] Clearing kmalloc_ok during shutdown is broken - malloc will clear our data Blaisorblade
2005-09-28 20:12 ` Jeff Dike
2005-09-29 12:07   ` Blaisorblade
2005-09-28 21:31 ` Jeff Dike
2005-09-29 14:14   ` Blaisorblade
2005-10-02  1:08     ` Jeff Dike
2005-10-02 10:31       ` Blaisorblade
2005-10-02 18:27         ` Jeff Dike
2005-10-03 13:40         ` Allan Graves
2005-10-03 18:48           ` Blaisorblade

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.