*BSD News Article 17050


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!xlink.net!nntp.fh-augsburg.de!obelix.informatik.fh-augsburg.de!mubo!phoenix!usys
From: usys@phoenix.abg.sub.org (Uwe C Schroeder)
Newsgroups: comp.os.386bsd.questions
Subject: Joerg-shared-libs and netbsd 0.8
Keywords: mmap
Message-ID: <8@phoenix.abg.sub.org>
Date: 11 Jun 93 20:23:08 GMT
Organization: UCS Anwendungssysteme
Lines: 30

Hi all,

I found the 'joerg-shared-libs' and tried to implement them to
netbsd 0.8 . It seems, that the kernel protection has changed
between bsd01 with patchkit and netbsd 0.8 . the startup-code
produces a bus-error. i debugged it an found, that this seems
to be a 'not there' write-permission to the map, allocated with
mmap. i tried to set PROT_WRITE (via mprotect), but this fails
with permission denied. The file (shared lib) is set to rwx for 
everybody (for testing :-)). It seems, that the permission given
with mmap isn't set as given. Since the shared lib is split to
a 'text' segement and a 'data' segment, normally there needn't be
a write permission to the 'text' segement, but some functions
seem to write there (printf, specially __sinit()). I guess, that 
the processor doesn't like write-permission to executable segements,
but how does the processor know, that this are the functions ?
When i put the code mapping the shared lib to a normal file, there
are no problems setting permission to read|write|exec. One can also do
anything with the data in the map. But why does this not work as
startup-code ??
The mmap doesn't create any errors. Just when leaving the startup 
code (via _exit(exec....)) the prog dumps.

Any hint is welcome.

(static shared libs are better than nothing ...)

So long
	Uwe