[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Fwd: ps broken]



On Mon, 2003-11-10 at 21:21, Prasanna Meda wrote:
> Albert Cahalan wrote:
> 
> > On Mon, 2003-11-10 at 19:21, Prasanna Meda wrote:
> >
> > > In reply to
> > > http://lists.debian.org/debian-user/2002/debian-user-200206/msg01866.html
> > >
> > > I also noticed  the same problem.  It  is due to
> > > ps trying to access the past end of    mmaped
> > > System.map file  in my case.  What does your
> > > trace show? Is this fixed in later  versions?
> > > It  is  mapping one  byte  more  and accessing
> > > that byte and is getting SIGBUS.
> >
> > Back in the Linux 1.x.xx era, Linus deliberately
> > made an allowance for the above. It seemed, and
> > still seems, to be good kernel behavior. After all,
> > an incomplete page is padded with '\0' characters.
> > Why should a full page be any different?
> >
> > Unfortunately, some idiot got SIGBUS into the
> > UNIX standard. With regret, Linus changed the
> > kernel. This broke even his own mkdep code
> > that was part of the kernel build process.
> >
> > The procps-3.x.xx releases available in recent
> > versions of Debian no longer rely on this
> > wonderful old Linux feature.
> 
> Yes, I see the semantics change in kernel from
> 2.2 to 2.4, but  what is the reason behind your
> mapping filesize+1 bytes in first than filesize
> bytes?
> In my case, the file size is 475136 bytes, that is
> exactly 116 pages, mmap is done for 475137
> bytes.

It's to get System.map as a NUL-terminated string.
Processing is easier when the kernel guarantees
that there will be a '\0' on the end.

I was bitten by an ABI change. :-(




Reply to: