Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jul 1996 18:34:14 +0300 (UKD)
From:      Igor Khasilev <igor@jabber.paco.odessa.ua>
To:        freebsd-hackers@freebsd.org
Subject:   incorect (?) execution of gziped executable
Message-ID:  <199607301534.SAA11447@jabber.paco.odessa.ua>

next in thread | raw e-mail | index | archive | help
Hi everybody!

Is it right that code become writeable in gziped executable?

I tried such program:
-------8<--------------------
sub()
{
	printf("sub\n");
}
main()
{
	printf("before: %x\n",*(int*)&sub);
	*(int*)&sub = 0;
	printf("after: %x\n", *(int*)&sub);
	sub();
}
-------8<--------------------

when compiled and executed normally (before gziping executable file)
it produce normal output:

bash$ ./x
before: 68e58955
Bus error (core dumped)
bash$

gdb display that program was terminated with signal 10 at line

        *(int*)&sub = 0;

Nothing unusual...

But...

bash$ gzip x
gzip: x.gz already exists; do you wish to overwrite (y or n)? y
bash$ ./x.gz 
before: 68e58955
after: 0
Segmentation fault (core dumped)
bash$

I become able to write to code? Or i misunderstand something?


Regads!

				Igor.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199607301534.SAA11447>