Subject: Re: veriexec by default (Re: CVS commit: src/sys/arch)
To: None <tech-kern@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: tech-kern
Date: 10/27/2006 16:31:51
In article <20061027115448.A7D8F11705@yamt.dyndns.org>,
YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp> wrote:
>> >> vn_open uses MAXPATHLEN-sized buffer on kernel stack.
>> 
>> just like lots of other code... but okay, this can be fixed.
>
>lots?  where?  if so, they should be fixed as well.
>
>YAMAMOTO Takashi

The big (>1K) stack users are:

1020 c08756f4:zz0016d732+0xb68
1032 c078a0d1:fdioctl+0x3
1040 c05bcff8:setup_memmap+0x3
1048 c018dd4b:ippr_rpcb_in+0x3
1052 c05478e1:vfs_buf_print+0x6
1064 c018deb6:ippr_rpcb_out+0x3
1064 c0245160:ahc_print_register+0x3
1064 c02627c0:ahd_print_register+0x3
1072 c02c4ea2:wi_get_cfg+0x5 
1072 c04a8d70:audioattach+0x5  
1088 c0180cb9:fr_natgetent+0x5
1088 c02c55f9:wi_set_cfg+0x5
1096 c0850f96:fw_bmr+0x3
1100 c04cd2c2:coredump_writeseghdrs_elf32+0x6
1144 c04ba8da:sysctl_hw_firmware_path+0x3
1160 c05bca8c:setup_biosgeom+0x3
1628 c0876e64:zz0016d832+0x940 
1628 c0878320:zz0016cd32+0xadc 
4128 c03d077d:procfs_dodevices+0x5


Here's a script for x86 to print the stack users:

#!/bin/sh
objdump --prefix-addresses --disassemble $1 | awk '
/.*sub.*,%esp/ {
	addr = $1;
	fun = substr($2, 2, length($2) - 2);
	split(substr($4, 2), a, ",");
	stack = sprintf("%d", a[1]);
	printf("%d %s:%s\n", stack, addr, fun);
}' | sort -n

christos