netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
To: davem@davemloft.net
Cc: dlstevens@us.ibm.com, netdev@vger.kernel.org, yoshfuji@linux-ipv6.org
Subject: Re: [GIT PULL] [IPV6] COMPAT: Fix SSM applications on 64bit kernels.
Date: Thu, 24 Apr 2008 18:28:34 +0900 (JST)	[thread overview]
Message-ID: <20080424.182834.104940176.yoshfuji@linux-ipv6.org> (raw)
In-Reply-To: <20080424.014956.94335109.davem@davemloft.net>

In article <20080424.014956.94335109.davem@davemloft.net> (at Thu, 24 Apr 2008 01:49:56 -0700 (PDT)), David Miller <davem@davemloft.net> says:

> From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
> Date: Thu, 24 Apr 2008 17:16:44 +0900 (JST)
> 
> > In article <20080424.010845.257071066.davem@davemloft.net> (at Thu, 24 Apr 2008 01:08:45 -0700 (PDT)), David Miller <davem@davemloft.net> says:
> > 
> > > From: YOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>
> > > Date: Thu, 24 Apr 2008 17:02:57 +0900 (JST)
> > > 
> > > > +#ifdef __KERNEL__
> > > > +struct __compat_sockaddr_storage {
> > > > +	unsigned short  ss_family;
> > > > +	char		__data[_K_SS_MAXSIZE - sizeof(unsigned short)];
> > > > +} __attribute__ ((aligned(4)));
> > > > +#endif
> > > 
> > > Should include <linux/compat.h>, use compat types, and be guarded
> > > by CONFIG_COMPAT.  This goes for all such structures.
> > 
> > Do you mean, something like this?
> > 
> > #ifdef __KERNEL__
> > #include <linux/compat.h>
> > 
> > #ifdef CONFIG_COMPAT
> > struct __compat_sockaddr_storage {
> >    unsigned short  ss_family;
> >   char            __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
> >  __attribute__ ((aligned(alignof(compat_uptr_t))));
> > #endif
> > #endif
> 
> I think first of all that ((packed)) is a better attribute to use than
> the explicit alignment.

Well, I don't think so.

Most (if not all) compat_XXX{} do not have such attribute,
and sockaddr_storage{} shuould actually be aligned on 32bit on
32bit archs, so I think we should declare, no?

For example, if we have
    struct foobar {
        char a;
        struct sockaddr_storage b;
    };
Then, offsetof(struct foobar, b) should be 4, not 1 nor 2.
(Of course all other fields of group_xxx structures are of
u32 here, so it is safe so far...)

Or, are you worrying about alignment of short?

--yoshfuji

  reply	other threads:[~2008-04-24  9:28 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-24  8:02 [GIT PULL] [IPV6] COMPAT: Fix SSM applications on 64bit kernels YOSHIFUJI Hideaki / 吉藤英明
2008-04-24  8:08 ` David Miller
2008-04-24  8:16   ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-24  8:49     ` David Miller
2008-04-24  9:28       ` YOSHIFUJI Hideaki / 吉藤英明 [this message]
2008-04-24  9:35         ` David Miller
2008-04-24 18:46     ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-24 20:01       ` David Stevens
2008-04-24 20:43         ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-24 20:59           ` David Stevens
2008-04-24 17:52 ` David Stevens
2008-04-25  5:38   ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-25  6:23     ` David Stevens
2008-04-25  6:27       ` David Miller
2008-04-25  6:31   ` David Miller
2008-04-25  6:37     ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-25  6:47       ` David Miller
2008-04-25  6:59         ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-25  7:04           ` David Miller
2008-04-25  7:24             ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-26  0:24               ` David Stevens
2008-04-26  3:33                 ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-26  4:36                   ` David Stevens
2008-04-26  4:53                     ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-26  5:32                       ` David Miller
2008-04-26  5:56                         ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-26  6:01                           ` David Miller
2008-04-26  6:25                             ` David Stevens
2008-04-26  6:31                               ` David Miller
2008-04-26  7:13                                 ` David Stevens
2008-04-26  9:07                                   ` David Miller
2008-04-26  5:09                     ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-26  5:31                     ` David Miller
2008-04-26  7:00                       ` David Stevens
2008-04-26  7:09                         ` David Miller
2008-04-26 23:55                   ` David Stevens
2008-04-27  8:06                     ` David Miller
2008-04-26  5:14                 ` YOSHIFUJI Hideaki / 吉藤英明
2008-04-26  5:33                   ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080424.182834.104940176.yoshfuji@linux-ipv6.org \
    --to=yoshfuji@linux-ipv6.org \
    --cc=davem@davemloft.net \
    --cc=dlstevens@us.ibm.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).