Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Dec 2001 09:00:46 +0100
From:      Bernd Walter <ticso@cicely9.cicely.de>
To:        Matthew Jacob <mjacob@feral.com>
Cc:        Wilko Bulte <wkb@freebie.xs4all.nl>, freebsd-alpha@FreeBSD.ORG
Subject:   Re: FreeBSD 4.5 alpha buyglet
Message-ID:  <20011223080046.GB61241@cicely9.cicely.de>
In-Reply-To: <Pine.BSF.4.21.0112222233290.2338-100000@beppo>
References:  <20011223032201.GA61241@cicely9.cicely.de> <Pine.BSF.4.21.0112222233290.2338-100000@beppo>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Dec 22, 2001 at 10:37:55PM -0800, Matthew Jacob wrote:
> 
> 
> On Sun, 23 Dec 2001, Bernd Walter wrote:
> 
> > On Sat, Dec 22, 2001 at 05:12:32PM -0800, Matthew Jacob wrote:
> > > 
> > > >Yes, see Message-ID: <20011221175252.A25617@freebie.xs4all.nl>
> > > >on -alpha.
> > > 
> > > Ooops- so right you are. Anyway, I looked at this just a bit- seems a compiler
> > > error to me- it shouldn't be generating ldq's for those tags because they
> > > couldn't possibly be at 8 byte offsets given the structures involved. Oh well.
> > 
> > The two variables it fails on are defined as beeing long but only 32 bit
> > aligned. I'm more about beleaving the sysctl tranfer misaligns them. But I
> > have currently no system where I see this problem so I can't be shure. The
> > sysctl receive buffer is malloc'ed so it should be 64 bit aligned.
> 
> Hmm? I used gdb to find the misaligned reference to be, e.g.:
> 
> ***>    if (ifm->ifm_data.ifi_metric)
>                 printf(" metric %ld", ifm->ifm_data.ifi_metric);
> ***>    if (ifm->ifm_data.ifi_mtu)
>                 printf(" mtu %ld", ifm->ifm_data.ifi_mtu);
>         putchar('\n');
> 
> struct if_msghdr {
>         u_short ifm_msglen;     /* to skip over non-understood messages */
>         u_char  ifm_version;    /* future binary compatability */
>         u_char  ifm_type;       /* message type */
>         int     ifm_addrs;      /* like rtm_addrs */
>         int     ifm_flags;      /* value of if_flags */
>         u_short ifm_index;      /* index for associated ifp */
> offset: 14
>         struct  if_data ifm_data;/* statistics and other data about if */ 
> };
> 
> 
> ...
> 
> 
> struct if_data {
>         /* generic interface information */
>         u_char  ifi_type;               /* ethernet, tokenring, etc */
>         u_char  ifi_physical;           /* e.g., AUI, Thinnet, 10base-T, etc
> */
>         u_char  ifi_addrlen;            /* media address length */
>         u_char  ifi_hdrlen;             /* media header length */
>         u_char  ifi_recvquota;          /* polling quota for receive intrs */
>         u_char  ifi_xmitquota;          /* polling quota for xmit intrs */
> 
> offset: 6
> 
>         u_long  ifi_mtu;                /* maximum transmission unit */
          ^^^^^^^^^^^^^^^^
>         u_long  ifi_metric;             /* routing metric (external only) */
          ^^^^^^^^^^^^^^^^^^^
>         u_long  ifi_baudrate;           /* linespeed */
> 
> 
> So, if gdb was right and dereferencing ifi_mtu or ifi_metric is generating
> a ldq, then the compiler seems to be broken.

What else would you use for loading a 64 bit value?

If it starts with the second or later interface I would asume it's
because several structs are concatenated in the sysctl output and read
as one.
If one of them is not n*8 bytes long you get an alignment offset.
But as I don't have more debug output than posted on the list I can
only guess.

-- 
B.Walter              COSMO-Project         http://www.cosmo-project.de
ticso@cicely.de         Usergroup           info@cosmo-project.de


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011223080046.GB61241>