Nmap Development mailing list archives

Re: nmap on sparc/linux


From: Tom Duffy <tduffy () sun com>
Date: Mon, 16 Dec 2002 16:42:33 -0800

On Mon, 2002-12-16 at 17:09, Cliff Woolley wrote:

I assume it's a valid assumption among this group that everybody knows
that SIGBUS on a Sparc usually means an unaligned access was attempted,
right?

As Cliff pointed out, it is probably an unaligned access error.  Here is
the culprit line after the preprocessor has had its way:

A = (ntohl(*(bpf_u_int32 *)&p[k]));

(gdb) disassemble ntohl
Dump of assembler code for function ntohl:
0x702ce540 <ntohl>:     nop 
0x702ce544 <ntohl+4>:   retl 
0x702ce548 <ntohl+8>:   nop 

ntohl is a noop because we are on a big endian architecture.

(gdb) print k
$15 = 30
(gdb) print &p[k]
$16 = (u_char *) 0x7267be "\n\aÆ\034\b"

Can we just make a char* an int* and dereference it?  Only if it is 4
byte aligned.

-tduffy

-- 
YOO-ESS-AYE! YOO-ESS-AYE!


---------------------------------------------------------------------
For help using this (nmap-dev) mailing list, send a blank email to 
nmap-dev-help () insecure org . List run by ezmlm-idx (www.ezmlm.org).



Current thread: