delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/06/09/19:31:50

Date: Mon, 9 Jun 1997 16:27:06 -0700 (PDT)
Message-Id: <199706092327.QAA04931@adit.ap.net>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: DJGPP runs bogus binaries

Hi everyone.
Here's something to watch out for with DJGPP. When running another program
with spawn, system, exec or the like, very little checking is done to make
sure the program is an appropriate executable. All files without extensions
are essentially checked only for being V1 COFFs, then run as V2 if not.

I spent hours suspecting a bug in Make before finding a Linux ELF binary in
the directory of something I was trying to port. Make would try to run it,
it would be run (!) and of course crash. (As an aside, it *completely*
wedged the system, requiring cold boot. Isn't protected mode supposed to
prevent this?)

I notice a comment in the source (src/libc/dos/process/dosexec.c) indicating
that this is a known problem. Perhaps some effort should be put into fixing
it. It doesn't seem that difficult; there are presumably magic numbers and
such to check for.

I realize this is rather a case of "Don't do that, then", but it would sure
be nice if bogus binaries were checked for, or at *least* if this problem
could be documented better. Hopefully others can avoid a similar difficulty.
--------------------
Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019