Subject: Re: kern/13615: NetBSD current requires a .note.netbsd.ident section
To: Emmanuel Dreyfus <>
From: Todd Vierling <>
List: netbsd-bugs
Date: 08/05/2001 13:09:23
On Sat, 4 Aug 2001, Emmanuel Dreyfus wrote:

: > Further, the error message printed when you run such a binary is totally
: > unhelpful.
: This is an old problem, and it's not easy to fix: the kernel knows when
: no emulation package matched, but this information does not go back t
: ouserland. Even if it did, it would be useless because we would have to
: modify each program that calls execve() so that it would be able to
: explain what is going on to th user. Modifying our shells would be
: acceptable, but theses are not the only programs to use execve, so it's
: not reasonable.

You could always cause an errno other than ENOEXEC when the file format is
known, but the binary is not executable on the current system.

However, this goes a lot further than just binaries under not-configured-in
emulations; think foreign systems' binaries, like a.out SunOS 4 binaries
marked executable that are attempted to be run on NetBSD on mipsel.  You
aren't likely to desire putting all the detection goop for that situation
into the kernel.

The best solution is to fix shells so they will not run scripts `manually'
by default if exec*() returns ENOEXEC.  Scripts properly prepended with a
magic number (the #! marker) will be started up by the kernel as expected
anyway; only those scripts with no magic number would fail.  This would weed
out the possibility of running a foreign binary as a script.

This can cause some breakage, so the impact of such change would need to be
assessed first.  It might be useful as a shell `internal config variable' in
some cases.

-- Todd Vierling <>  *  Wasabi NetBSD:  Run with it.
-- NetBSD 1.5 now available on CD-ROM  --