linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* binfmt_misc & different PE binaries
@ 2023-07-06 11:55 Pali Rohár
  2023-08-06 16:23 ` Pali Rohár
  0 siblings, 1 reply; 6+ messages in thread
From: Pali Rohár @ 2023-07-06 11:55 UTC (permalink / raw)
  To: Eric Biederman, Kees Cook; +Cc: linux-mm, linux-kernel

Hello,

I would like to ask how to properly register binfmt_misc for different
PE binaries, so kernel could execute the correct loader for them.

I mean, how to register support for Win32 (console/gui) PE binaries and
also for CLR PE binaries (dotnet). Win32 needs to be executed under wine
and CLR ideally under dotnet core (or mono).

I have read kernel documentation files admin-guide/binfmt-misc.rst
and admin-guide/mono.rst. But seems that they are in conflicts as both
wants to registers its own handler for the same magic:

  echo ':DOSWin:M::MZ::/usr/local/bin/wine:' > register

  echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register

Not mentioning the fact that they register DOS MZ handler, which matches
not only all PE binaries (including EFI, libraries, other processors),
but also all kind of other NE/LE/LX binaries and different DOS extenders.

From documentation it looks like that even registering PE binaries is
impossible by binfmt_misc as PE is detected by checking that indirect
reference from 0x3C is PE\0\0. And distinguish between Win32 and CLR
needs to parse PE COM descriptor directory.

Or it is possible to write binfmt_misc pattern match based on indirect
offset?


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

end of thread, other threads:[~2023-08-11 19:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-06 11:55 binfmt_misc & different PE binaries Pali Rohár
2023-08-06 16:23 ` Pali Rohár
2023-08-07 14:45   ` Kees Cook
2023-08-07 17:08     ` Pali Rohár
2023-08-10 20:24       ` Kees Cook
2023-08-11 19:05         ` Pali Rohár

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox