bug-hurd
[Top][All Lists]
Advanced

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

Re: MACH_SEND_MSG_TOO_SMALL is mig breakage (was: Re: current CVS Hurd a


From: Marcus Brinkmann
Subject: Re: MACH_SEND_MSG_TOO_SMALL is mig breakage (was: Re: current CVS Hurd and glibc (except libthreads)
Date: Tue, 30 Jul 2002 02:51:54 +0200
User-agent: Mutt/1.4i

On Mon, Jul 29, 2002 at 05:24:08PM -0700, Thomas Bushnell, BSG wrote:
> > So MiG miscalculates the size of the message, doesn't it?
> 
> Yeah.  The constant is computed inside MiG by just summing up the
> sizes of structures itself.  This is actually dangerous, because it
> presumes that the sizes will be the same between when MiG runs and
> when the header files are included at compile time.

Ok.  Well.  For now I would be happy with MiG calculating it correctly at
all :)  Using the sizeof values might not be good enough because of padding,
etc, unless you take this into account, too, of course.

I think I traced it down to the following:

static u_int
rtFindSize(const argument_t *args, u_int mask)
{

[Blablabla]

            if (arg->argLongForm) {
                /* might need proper alignment on 64bit archies */
                size = (size + word_size-1) & ~(word_size-1);
                size += sizeof_mach_msg_type_long_t;
            } else {
                register bs = (it->itSize / 8); /* in bytes */
                size += (bs > sizeof_mach_msg_type_t) ? bs : 
sizeof_mach_msg_type_t;
            }

            size += it->itMinTypeSize;

[Blablabla]
}

For the loff_t type (which is not in long form) itSize is 64, and
itMinTypeSize is 8 (because padding is 0, see itCalculateSizeInfo).
However, why the hell does MiG add the BS value to size instead the
sizeof mach_msg_type_t if this is the larger one?  Because this is
of course 8, and so it adds 8+8, instead 4+8.  Does the alignment
comment apply here as well?

Anyway, this is where the extra 4 come from.  It's too late to recompile
glibc and the Hurd without the BS thing, so I am back on this tomorrow.

Thanks,
Marcus

-- 
`Rhubarb is no Egyptian god.' GNU      http://www.gnu.org    marcus@gnu.org
Marcus Brinkmann              The Hurd http://www.gnu.org/software/hurd/
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]