Subject: Re: CVS commit: src/sys
To: None <tech-net@netbsd.org>
From: David Young <dyoung@pobox.com>
List: tech-net
Date: 05/29/2007 17:20:33
On Tue, May 29, 2007 at 09:32:31PM +0000, Christos Zoulas wrote:
> 
> Module Name:	src
> Committed By:	christos
> Date:		Tue May 29 21:32:31 UTC 2007
> 
> Modified Files:
> 	src/sys/compat/common: Makefile uipc_syscalls_43.c
> 	src/sys/compat/freebsd: freebsd_ioctl.c freebsd_ioctl.h
> 	src/sys/compat/ibcs2: ibcs2_socksys.h
> 	src/sys/compat/linux/common: linux_socket.c
> 	src/sys/compat/sunos: sunos_ioctl.c
> 	src/sys/compat/sunos32: sunos32_ioctl.c
> 	src/sys/compat/svr4: svr4_sockio.c
> 	src/sys/compat/svr4_32: svr4_32_sockio.c
> 	src/sys/compat/sys: socket.h
> 	src/sys/compat/ultrix: ultrix_ioctl.c
> 	src/sys/conf: files
> 	src/sys/net: bpf.c if.c if.h if_etherip.c if_ethersubr.c if_gre.c
> 	    if_media.c if_tap.c
> 	src/sys/net80211: ieee80211_ioctl.c
> 	src/sys/sys: ioccom.h sockio.h
> Added Files:
> 	src/sys/compat/common: uipc_syscalls_40.c
> 	src/sys/compat/sys: sockio.h
> 
> Log Message:
> Add a sockaddr_storage member to "struct ifreq" maintaining backwards
> compatibility with the older ioctls. This avoids stack smashing and
> abuse of "struct sockaddr" when ioctls placed "struct sockaddr_foo's" that
> were longer than "struct sockaddr".
> XXX: Some of the emulations might be broken; I tried to add code for
> them but I did not test them.

This seems like an awful lot of #ifdef'age to achieve very limited
protection against stack smashing.  Suppose the kernel copies to ifreq
a sockaddr whose sa_len > sizeof(struct sockaddr_storage) ?

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933 ext 24