IBCS2 regression in FreeBSD 5??

Dan Nelson dnelson at allantgroup.com
Fri Mar 26 13:20:37 PST 2004


In the last episode (Mar 26), Dan Nelson said:
> In the last episode (Oct 11), Paul Mather said:
> > Does anyone know whether the IBCS2 emulation functionality
> > regressed going from FreeBSD 4 to FreeBSD 5?  I ask because I have
> > a statically-linked SCO binary that works under FreeBSD 4.8-STABLE
> > but not under FreeBSD 5.1-RELEASE-p10 (or a version of
> > 5.1-CURRENT).
> > 
> > I have ibcs2 and coff modules, and know that IBCS2 at least
> > partially works.  For example, I can run the "hello_world" example
> > program in /usr/share/examples/ibcs2 as well as some others.  But,
> > the program in question exits immediately with "Abort".  Here's
> > what I get when running the program using ktrace on 5.1:
> > 
> >  40019 ktrace   RET   ktrace 0
> >  40019 ktrace   CALL  execve(0xbfbffc7b,0xbfbffb88,0xbfbffb94)
> >  40019 ktrace   NAMI  "/usr/adsm/dsmc"
> 
> And I guess this is a very belated "me too" :)  I get the same on
> 5.2-RELEASE and -current.
> 
> Paul, did you ever figure out the cause?

After a short bit of debugging it looks like a memory mapping issue. 
The vm_map_find call at line 475 overlaps a previously-mapped range and
fails.  The error isn't checked, so the exec continues and the process
aborts later.  If I manually add one page to the map address it works
and my test program is able to at least print out its version number. 
Here's a comparison of the /proc/pid/map files between 4.8 and 5.2. 
They were generated by trussing the program, then hitting ^Z to pause
it.  Without the truss it exited too quickly.

==> map.4 <==
0x0 0x6000 6 9 0xd62c4360 r-x 2 1 0x0 COW NC vnode
0x400000 0x403000 3 0 0xd68ad1e0 rwx 1 0 0x2180 COW NNC vnode
0x403000 0x406000 3 0 0xd6ffb7e0 rwx 1 0 0x2180 NCOW NNC default
0xbfbe0000 0xbfc00000 2 0 0xd6e73d80 rwx 1 0 0x2180 NCOW NNC default

==> map.5 <==
0x0 0x6000 6 14 0xc625b8c4 r-x 2 1 0x0 COW NC vnode /a/emssrv5/io1/g1/cobol.7a.1a.11.10/bin/cobrun
0x400000 0x403000 3 0 0xc3fe7840 rwx 1 0 0x2180 COW NNC vnode /a/emssrv5/io1/g1/cobol.7a.1a.11.10/bin/cobrun
0x403000 0x407000 3 0 0xc3edfc60 rwx 1 0 0x2180 NCOW NNC default -
0xbfbe0000 0xbfc00000 2 0 0xc60b3000 rwx 1 0 0x2180 NCOW NNC default -

The third region looks like it has one extra page of memory allocated
for some reason. 

And more interestingly, not all programs fail.  I have one that works
fine on a stock kernel.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-emulation mailing list