Re: [RELEASE] ebtables version 2.0.8-rc3

Carl-Daniel Hailfinger <[email protected]> Sat, 23 Dec 2006 20:37:55 +0100
Newsgroups gmane.linux.network.bridge.ebtables.user
Message-ID <[email protected]>
Bart De Schuymer wrote:
> Op za, 23-12-2006 te 02:29 +0100, schreef Carl-Daniel Hailfinger: 
>> However, the "among" match still reports problems:
>> The source of the problem is easy to spot:
>> In userspace, wh_dst_ofs==16 (because (**match).match_size==16 at
>> line 357 in extensions/ebt_among.c), but in kernelspace we check
>> wh_dst_ofs against sizeof(struct ebt_among_info)==12.
> 
> Are you saying sizeof(struct ebt_among_info) differs between userspace
> and the kernel? Please double check this...

No, I wanted to say that match_size is set in userspace to something
which is != sizeof(struct ebt_among_info).

More diagnostics:
on x86-64:
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 8 aligned from 6
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 56 aligned from 52
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 32 aligned from 28
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 8 aligned from 8
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 24 aligned from 24
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 8 aligned from 2
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 72 aligned from 72
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 16 aligned from 12 (among)
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 32 aligned from 32

on i386:
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 8 aligned from 6
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 52 aligned from 52
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 28 aligned from 28
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 8 aligned from 8
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 12 aligned from 12
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 4 aligned from 2
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 72 aligned from 72
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 12 aligned from 12 (among)
libebtc.c:1175 in ebt_register_match: m->m->match_size set to 24 aligned from 24

Userspace sets wh_dst_ofs=EBT_ALIGN(sizeof(struct ebt_among_info)), but the
kernel expects wh_dst_ofs=sizeof(struct ebt_among_info). On i386, the EBT_ALIGN
macro has no effect for the among match, but on x86_64 it does. That explains
why the bug was never noticed on i386.

So we either change the kernel or userspace. Changing the kernel would mean
that suddenly all existing userspace works.

Regards,
Carl-Daniel
-- 
http://www.hailfinger.org/

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV