From: Luca Tettamanti <kronos.it@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: coreteam@netfilter.org
Subject: [BUG?] ip6tables: 32bit userspace doesn't work with 64bit kernel
Date: Sat, 8 Dec 2007 23:37:37 +0100 [thread overview]
Message-ID: <20071208223737.GA8885@dreamland.darkstar.lan> (raw)
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.
next reply other threads:[~2007-12-08 22:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-08 22:37 Luca Tettamanti [this message]
2007-12-09 16:13 ` [BUG?] ip6tables: 32bit userspace doesn't work with 64bit kernel 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
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=20071208223737.GA8885@dreamland.darkstar.lan \
--to=kronos.it@gmail.com \
--cc=coreteam@netfilter.org \
--cc=netfilter-devel@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).