Re: [BUG?] binfmt_script: interpreted interpreter doesn't work

From: Mark Veltzer (mark@veltzer.org)
Date: Sun Sep 15 2002 - 16:18:35 EST


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 15 September 2002 23:06, Ingo Oeser wrote:
> Hi Pozsar,
>

> Right, this isn't allowed to avoid eating kernel resources
> without getting anything done.

You mean like writing a program to calculate PI to the 1,000,000th digit ?
The kernel is not supposed to dictate what is done with it. If the user wants
to link 10,000 such scripts in a chain then let him. I suspect that that
isn't the problem. The problem is that before the launch of the program the
time is not counted as time spent on that specific user and so this could be
used as loop hole to drain resources from other users. If this is the case
then this time should be accounted for (I'm not sure about this though and if
the time is accounted for then I don't see any reason to disable the chains
except avoiding cycles which needs some coding).

>
> Solution is to always compile an interpreter or to write
> a wrapper in C, which is compiled and calls the perl interpreter
> with your perl script. This wrapper would be ANSI-C with really
> basic POSIX extensions and should thus be as portable as perl ;-)

There is actually already a program that one can use. It's /usr/bin/env and
is part of the sh-utils package from GNU. I always use and instead of writing
something like:

#!/usr/bin/perl
.....

I write:

#!/usr/bin/env perl
.....

This way the users preferred perl is used and I'm reducing all my arbitrary
assumptions about locations of executables to one assumption about the
location of /usr/bin/env (one hardcoded fact is better than many cause it's
easier to fix if need be).

You can use env to solve your problem. In your scripts replace all shbang
lines. /usr/bin/env is, ofcourse, a binary executable.

Name: Mark Veltzer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9hPkuxlxDIcceXTgRAgB+AKCJ8JtVKrpNfnaTy7/kQASSEtxsdACgyPl/
czeMVYsD5Qp+da49hyoPpFc=
=Ux8a
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 15 2002 - 22:00:38 EST