netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG?] ip6tables: 32bit userspace doesn't work with 64bit kernel
@ 2007-12-08 22:37 Luca Tettamanti
  2007-12-09 16:13 ` Patrick McHardy
  0 siblings, 1 reply; 6+ messages in thread
From: Luca Tettamanti @ 2007-12-08 22:37 UTC (permalink / raw)
  To: netfilter-devel; +Cc: coreteam

Hello,
I just found out that 32bit (x86) ip6tables does not work with a 64bit
kernel. I'm currenly using 2.6.24-rc4-g94545bad, but the structures
involved haven't been touched recently.

Before you read on: I see that IPv6 code is missing compat* stuff, so is
this configuration supported?

A simple "ip6tables -L" fails with:
ip6tables v1.3.8: can't initialize ip6tables table `filter': Bad file
descriptor

kernel says:
get_entries: 892 != 896 (this is do_ip6t_get_ctl)

The problem is that GCC changes the layout of a couple of structures
when compiling 64bit code.
Compiler version - in case it started doing this recently - is:
gcc (GCC) 4.2.2 (Debian 4.2.2-1)

This is what userspace (32bit) is using:

sizeof(struct ip6t_entry) = 164
        ipv6            0
        nfcache         136
        target_offset   140
        next_offset     142
        comefrom        144
        counters        148
        elems           164
sizeof(struct ip6t_get_entries) = 36
        name            0
        size            32
        entrytable      36
sizeof(struct xt_counters) = 16

And this is what the kernel (64bit) expects:

sizeof(struct ip6t_entry) = 168
        ipv6            0
        nfcache         136
        target_offset   140
        next_offset     142
        comefrom        144
        counters        152 <--- ouch
        elems           168
sizeof(struct ip6t_get_entries) = 40
        name            0
        size            32
        entrytable      40
sizeof(struct xt_counters) = 16

It seems that the compiler - in 64 bit mode - goes for 8 bytes alignment
for "counters" (which contains a couple of int64); I guess that
ip6t_get_entries is changed to keep the very same field (in entrytable)
aligned.

Luca
-- 
The trouble with computers is that they do what you tell them, 
not what you want.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-12-14 20:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-08 22:37 [BUG?] ip6tables: 32bit userspace doesn't work with 64bit kernel Luca Tettamanti
2007-12-09 16:13 ` Patrick McHardy
2007-12-10 13:09   ` Luca Tettamanti
2007-12-12  8:36     ` Patrick McHardy
2007-12-12 17:10       ` Patrick McHardy
2007-12-14 20:19         ` Luca Tettamanti

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).