Subject: Re: a.out dynamic libraries
To: None <tech-toolchain@NetBSD.ORG>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-toolchain
Date: 05/24/1998 20:29:46
>> If you had done this to a running program, you would have gotten
>> ETXTBSY when you tried to write, but since the shared library is
>> mapped by user code and not the kernel exec code, the vnode doesn't
>> have the VTEXT flag set (which would cause the error to be
>> returned).

> This idea is a gross and horrible hack, but may have enough utility
> to give it merit:  How about a system call to set and clear VTEXT on
> a file?

I'd much rather have a flag bit to mmap(2) which considers the mapped
section as a text segment for VTEXT purposes.  This has the advantage
that (almost?) all of the necessary underlying machinery is already in
place for "real" text segments.  It also associates the bit with the
right thing - the memory segment - letting the underlying file get
VTEXT set and cleared normally.

The major disadvantage, I think, is that it means that any file you can
read you can ETXTBUSY out by mmapping it with this bit set.  On most
systems that includes interesting things like logfiles - which could be
very useful to an attacker.

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B