All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] Potential heap corruption on thread cleanup
@ 2010-03-03  8:58 Jan Kiszka
  2010-03-03  9:04 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 15+ messages in thread
From: Jan Kiszka @ 2010-03-03  8:58 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: Wolfgang Mauerer, xenomai-core, Gernot Hillier

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

Hi Gilles,

I'm pushing your findings to the list, also as my colleagues showed
strong interest - this thing may explain rare corruptions for us as well.

I thought a bit about that likely u_mode-related crash in your test case
and have the following theory so far: If the xeno_current_mode storage
is allocated on the application heap (!HAVE_THREAD, that's also what we
are forced to use), it is automatically freed on thread termination in
the context of the dying thread. If the thread is already migrated to
secondary or if that happens while it is cleaned up (i.e. before calling
for exit into the kernel), there is no problem, Xenomai will not touch
the mode storage anymore. But if the thread happens to delete the
storage "silently", without any migration, the final exit will trigger
one further access. And that takes place against an invalid head area at
this point.

Does this make sense?

If that is true, all we need to do is to force a migration before
releasing the mode storage. Could you check this?

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 257 bytes --]

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

end of thread, other threads:[~2010-03-05 11:45 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-03  8:58 [Xenomai-core] Potential heap corruption on thread cleanup Jan Kiszka
2010-03-03  9:04 ` Gilles Chanteperdrix
2010-03-03  9:13   ` Jan Kiszka
2010-03-03  9:16     ` Gilles Chanteperdrix
2010-03-04 18:28       ` Jan Kiszka
2010-03-04 18:36         ` Gilles Chanteperdrix
2010-03-04 20:25           ` Jan Kiszka
2010-03-04 20:42             ` Gilles Chanteperdrix
2010-03-05 11:21               ` Jan Kiszka
2010-03-05 11:30                 ` Gilles Chanteperdrix
2010-03-05 11:39                   ` Jan Kiszka
2010-03-05 11:42                     ` Gilles Chanteperdrix
2010-03-05 11:45                       ` Jan Kiszka
2010-03-05 11:08             ` Wolfgang Mauerer
2010-03-05 11:29               ` Gilles Chanteperdrix

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.