linuxolator problem on i386

Boris Samorodov bsam at ipt.ru
Wed Sep 19 03:34:19 PDT 2007


On Wed, 19 Sep 2007 10:54:05 +0200 Roman Divacky wrote:
> > It so happened that here we get a deal with magic (number). Let me
> > show you the broken behaviour one more time:

> >  14594 hlds_i686 CALL  linux_getdents(0x6,0x8da5b44,0x1000)
> >  14594 hlds_i686 RET   linux_getdents 4096/0x1000

> > Look at the first linux_getdents() line. The third parameter (buffer
> > length?) equals to 0x1000 which is 4096. The second line with
> > linux_getdents shows that it has read precisely 4096 (bytes?). What if
> > we face here a (so called at our high school) border-case
> > (border-problem)?
> > 
> > OK, the program reads the directory contents. Lets touch a new file
> > at this directory. What does happen? Follow me:

> >  14579 hlds_i686 CALL  linux_getdents(0x6,0x8da574c,0x1000)
> >  14579 hlds_i686 RET   linux_getdents 4084/0xff4

>  
> > That's it! <loud long applauses>
> > 
> > Roman, I hope now you may create the needed patch.
> > As for me I'm too tied (and too proud :-) ) today and 'm going to have
> > a little sleep.

> I am sorry but I dont understand at all.. what are you trying to show?
> whats wrong with returning 4084?

Sorry to be laconic.

There is nothing wrong with 4084. The magic 4096 is the
answer. I.e. the first case (when a buffer is equal to that
has been really read) is wrongly processed.

Ex. in C strings ends with 0x0. If a buffer 4096 bytes long was
assigned a string 4096 bytes long then the 0x0 will become a 4097
byte. And this string will cause a fault of the program.

PS. I don't say that I gave a strict example of the case. Of cause it
may be something else. But definitely there is a bug in processing of
4096 bytes log strings by our linuxulator code (somewhere at the
linux_getdents area, linux_getdents64 used by linux_base-fc4 is not
affected by _at least_ 4096 bytes long strings).

Hm, is my current explanation more understandable?


WBR
-- 
Boris Samorodov (bsam)
Research Engineer, http://www.ipt.ru Telephone & Internet SP
FreeBSD committer, http://www.FreeBSD.org The Power To Serve


More information about the freebsd-emulation mailing list