All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laszlo Valko <valko@linux.karinthy.hu>
To: Thomas Heinz <creatix@hipac.org>
Cc: Anders Fugmann <afu@fugmann.dhs.org>,
	netfilter-devel@lists.netfilter.org
Subject: Re: Comments about IPT_ALIGN
Date: Mon, 27 Jan 2003 01:43:04 +0100	[thread overview]
Message-ID: <20030127014304.A10076@linux.karinthy.hu> (raw)
In-Reply-To: <3E346A9A.5020305@hipac.org>; from creatix@hipac.org on Mon, Jan 27, 2003 at 12:09:14AM +0100

Hi Thomas!

On Mon, Jan 27, 2003 at 12:09:14AM +0100, Thomas Heinz wrote:
> > The problem is that you _cannot_ determine from an x-bit userspace compiler
> > what alignment restrictions do exist on a y-bit kernelspace compiler. Since
> > they are two distinct compilers.
> > That's the fundamental flaw in __alignof__/IPT_ALIGN-type "hacking".
> 
> Hm, but we agree that the alignment of types of fixed width is the
> same even if x != y, e.g. __u64 is 8 byte aligned in sparc64 user and
> kernel space. The problem of stacking structs with different alignment

On sparc, it happens to be the same. I'm not sure how much pure luck
or intention this is. However, on x86, __u64 is definitely 4 byte aligned,
and I would expect x86-64 to do it differently (8 byte alignment).
This might even be a function of using different compiler options...

> requirements next to each other can be solved by aligning the structures
> according to what you call "strictest alignment on this platform"
> which IMO can be expressed by:
>    struct foo {[...]}__attribute__((aligned(__alignof__(u_int64_t))));

I think the "strictest alignment on this platform" should not come
from the compiler. It should be defined in some kernel header under
linux/include/asm-*.

Regards,
Laszlo

> Thomas
> 

  reply	other threads:[~2003-01-27  0:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-26  3:57 Comments about IPT_ALIGN Thomas Heinz
2003-01-26 11:01 ` Laszlo Valko
2003-01-26 11:28   ` Anders Fugmann
2003-01-26 13:58     ` Thomas Heinz
2003-01-26 14:26       ` Laszlo Valko
2003-01-26 16:50         ` Thomas Heinz
2003-01-26 19:31           ` Laszlo Valko
2003-01-31 11:51       ` Harald Welte
2003-01-26 14:22     ` Laszlo Valko
2003-01-26 18:05       ` Thomas Heinz
2003-01-26 19:43         ` Laszlo Valko
2003-01-26 23:09           ` Thomas Heinz
2003-01-27  0:43             ` Laszlo Valko [this message]
2003-01-27 10:33               ` Thomas Heinz
2003-01-31 11:57                 ` Harald Welte
2003-01-26 19:48         ` Thomas Heinz
2003-01-31 11:55       ` Harald Welte
2003-01-31 23:37         ` Laszlo Valko
2003-01-26 17:06   ` Thomas Heinz

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=20030127014304.A10076@linux.karinthy.hu \
    --to=valko@linux.karinthy.hu \
    --cc=afu@fugmann.dhs.org \
    --cc=creatix@hipac.org \
    --cc=netfilter-devel@lists.netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.