2001-02-13 05:10:08

by Matt Stegman

[permalink] [raw]
Subject: gzipped executables

Is there any kernel patch that would allow Linux to properly recognize,
and execute gzipped executables?

I know I could use binfmt_misc to run a wrapper script:

decompress to /tmp/prog.decompressed
execute /tmp/prog.decompressed
rm /tmp/prog.decompressed

But that's not as clean, secure, or fast as the kernel transparently
decompressing & executing. Is there a better way to do this?

-Matt



2001-02-13 08:41:03

by Ketil Froyn

[permalink] [raw]
Subject: Re: gzipped executables

On Mon, 12 Feb 2001 23:09:39 -0600 (CST) Matt Stegman <[email protected]> wrote:
>Is there any kernel patch that would allow Linux to properly recognize,
>and execute gzipped executables?
>
>I know I could use binfmt_misc to run a wrapper script:
>
> decompress to /tmp/prog.decompressed
> execute /tmp/prog.decompressed
> rm /tmp/prog.decompressed
>
>But that's not as clean, secure, or fast as the kernel transparently
>decompressing & executing. Is there a better way to do this?

Perhaps you could put it in the filesystem. Look at the "chattr" manpage, which
shows how this is meant to work with ext2. It seems not to have been implemented
yet. This way you could also compress any files, not just executables.

Ketil

--
Get your firstname@lastname email for FREE at http://Nameplanet.com/?su

2001-02-13 12:10:18

by Ingo Oeser

[permalink] [raw]
Subject: Re: gzipped executables

On Tue, Feb 13, 2001 at 08:40:31AM -0000, [email protected] wrote:
> On Mon, 12 Feb 2001 23:09:39 -0600 (CST) Matt Stegman <[email protected]> wrote:
> >Is there any kernel patch that would allow Linux to properly recognize,
> >and execute gzipped executables?
>
> Perhaps you could put it in the filesystem. Look at the
> "chattr" manpage, which shows how this is meant to work with
> ext2. It seems not to have been implemented yet. This way you
> could also compress any files, not just executables.

A nice way already implemented in 2.4.x is cramfs. Many embedded
people (like me) use it to fill up their flash disks.

Look at linux/Documentation/filesystems/cramfs.txt for more info.

Regards

Ingo Oeser
--
10.+11.03.2001 - 3. Chemnitzer LinuxTag <http://www.tu-chemnitz.de/linux/tag>
<<<<<<<<<<<< come and join the fun >>>>>>>>>>>>

2001-02-13 13:08:58

by Padraig Brady

[permalink] [raw]
Subject: Re: gzipped executables

You might consider UPX (http://upx.tsx.org)
Very cool. The beta version supports compressing the kernel
and "direct-to-memory" compression. I think it still
has the disadvantage of not sharing segments between many
instances of the same program. Is there any way of fixing
this? (probably would have to hack a bit with the loader?)

For a general solution I would look @ changing the filesystem
so that particular files (not just executables) can be compressed/
decompressed transparently. (I.E. for ext2 implement `chattr +c`).

Padraig.

Ingo Oeser wrote:

> On Tue, Feb 13, 2001 at 08:40:31AM -0000, [email protected] wrote:
>
>> On Mon, 12 Feb 2001 23:09:39 -0600 (CST) Matt Stegman <[email protected]> wrote:
>>
>>> Is there any kernel patch that would allow Linux to properly recognize,
>>> and execute gzipped executables?
>>
>> Perhaps you could put it in the filesystem. Look at the
>> "chattr" manpage, which shows how this is meant to work with
>> ext2. It seems not to have been implemented yet. This way you
>> could also compress any files, not just executables.
>
>
> A nice way already implemented in 2.4.x is cramfs. Many embedded
> people (like me) use it to fill up their flash disks.
>
> Look at linux/Documentation/filesystems/cramfs.txt for more info.
>
> Regards
>
> Ingo Oeser

2001-02-13 13:59:25

by Matt Stegman

[permalink] [raw]
Subject: Re: gzipped executables

Hello,

Anything in 2.4 isn't an option right now. I'm using, and am really happy
with, the ext3 journalling patch. I'm not planning on a 2.4 upgrade until
ext3 has been ported. Damn shame I don't have the skill to do that
myself...

ext2 compression would be great. First off, though, I'm already using the
ext3 patch. Would ext2 compression be compatible, and take effect for
ext3 (ext3 support is a separate option in the kernel from ext2)? Also, I
can't even get to the ext2 compression page
http://e2compr.memalpha.cx/e2compr/.

UPX looks interesting; I'll have to check it out in depth. Thanks, all!

-Matt


2001-02-13 14:10:48

by Xavier Bestel

[permalink] [raw]
Subject: Re: gzipped executables

Le 13 Feb 2001 07:58:56 -0600, Matt Stegman a ?crit :
> Hello,
>
> Anything in 2.4 isn't an option right now. I'm using, and am really happy
> with, the ext3 journalling patch. I'm not planning on a 2.4 upgrade until
> ext3 has been ported. Damn shame I don't have the skill to do that
> myself...
>
> ext2 compression would be great. First off, though, I'm already using the
> ext3 patch. Would ext2 compression be compatible, and take effect for
> ext3 (ext3 support is a separate option in the kernel from ext2)? Also, I
> can't even get to the ext2 compression page
> http://e2compr.memalpha.cx/e2compr/.
>
> UPX looks interesting; I'll have to check it out in depth. Thanks, all!
>
> -Matt


If you're really adventurous, I've once done a patch for uClinux to
enable a compressed (gzip) executable format (not ELF, way lighter). It
should be at http://aplionet.aplio.fr/uclinux (the kernel loader is
linux/fs/binfmt_flat.c, the tools to generate the execs are in
tools/elf2flt)

Xav

2001-02-13 21:10:16

by Mike Castle

[permalink] [raw]
Subject: Re: gzipped executables

On Mon, Feb 12, 2001 at 11:09:39PM -0600, Matt Stegman wrote:
> Is there any kernel patch that would allow Linux to properly recognize,
> and execute gzipped executables?

What's wrong with using gzexe?

mrc
--
Mike Castle Life is like a clock: You can work constantly
[email protected] and be right all the time, or not work at all
http://www.netcom.com/~dalgoda/ and be right at least twice a day. -- mrc
We are all of us living in the shadow of Manhattan. -- Watchmen

2001-02-17 13:35:17

by Pavel Machek

[permalink] [raw]
Subject: Re: gzipped executables

Hi!

> Is there any kernel patch that would allow Linux to properly recognize,
> and execute gzipped executables?
>
> I know I could use binfmt_misc to run a wrapper script:
>
> decompress to /tmp/prog.decompressed
> execute /tmp/prog.decompressed
> rm /tmp/prog.decompressed
>
> But that's not as clean, secure, or fast as the kernel transparently
> decompressing & executing. Is there a better way to do this?

You could do this with uservfs(.sourceforge.net):

ln -s /overlay/path/.../executable.gz#ugz executable

and let uservfs do it for you. It will essentially do what you
described, but it will work on any file.
Pavel

--
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]