[Snort-devel] linux/sparc BUS ERROR [more info]

Fyodor fygrave at ...1...
Thu Jan 17 09:59:08 EST 2002


On Wed, Jan 16, 2002 at 03:33:44PM -0300, Ricardo A. Gorosito wrote:
> Roelof:
> 
> This is the output:
> 
> (gdb) set args -v
> <snip>
> (gdb) run
> <snip>
> Program received signal SIGBUS, Bus error.
> 0x0001b408 in DecodeIP (pkt=0x9977e "E\020", len=132, p=0xeffff398) at
> decode.c:1194
> 1194        if(p->iph->ip_ver != 4)
> (gdb) set print address on
> (gdb) bt

Yep. Now it fails in different place. can we have x/20i $pc to see which
instruction it uses to compare?

if that's what I think (compiler inproperly generates some 8bit aligned
instruction for 4 bit field, I'd think it is a compiler bug and pretty
much that the only way to fix it here would be:
 if ((p->iph->ip_ver & 0xf0) == 0x40)
 or something although it looks kind of cumbersome... (and to cover both
big and little endian architectures:
 if ((p->iph->ip_ver & IPVER_MASK) == IPVER_VALUE)
 {
...

Although it really makes me wondering how the heck does it work in linux
kernel on sparc then? ;-)


"/usr/src/linux/net/ipv4/ip_input.c" line 415 of 450 --92%-- col 27-30

    struct iphdr *iph = skb->nh.iph;
...
    if (iph->ihl < 5 || iph->version != 4)
        goto inhdr_error;

...


Does changing compilers help here?!





More information about the Snort-devel mailing list