NetBSD Problem Report #10004
Received: (qmail 23482 invoked from network); 28 Apr 2000 10:12:28 -0000
Message-Id: <200004281012.DAA17149@digital.clock.org>
Date: Fri, 28 Apr 2000 03:12:27 -0700 (PDT)
From: "Erik E. Fair" <fair@digital.clock.org>
Reply-To: fair@digital.clock.org
To: gnats-bugs@gnats.netbsd.org
Subject: IP options processing bug causes panic on alpha, sparc
X-Send-Pr-Version: 3.95
>Number: 10004
>Category: security
>Synopsis: IP options processing bug causes panic on alpha, sparc
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: security-officer
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 28 10:13:00 +0000 2000
>Closed-Date: Tue May 16 19:09:01 +0000 2000
>Last-Modified: Sun Dec 17 13:34:35 +0000 2000
>Originator: Erik E. Fair
>Release: 20000428
>Organization:
International Organization of Internet Clock Watchers
>Environment:
System: NetBSD digital.clock.org 1.4.2_ALPHA NetBSD 1.4.2_ALPHA (DIGITAL) #10: Mon Jan 10 22:38:56 PST 2000 fair@doomsday.clock.org:/usr/obj/sys/arch/alpha/compile/DIGITAL alpha
>Description:
An IP packet with the right combination of options will cause
a panic in ip_dooptions (/sys/netinet/ip_input.c:1074). Complete
record of this problem follows.
% tcpdump -vv -x -r badpacket.tcpdump dst jittery
02:07:13.308075 alarm.clock.org > jittery.clock.org: icmp: type-#229 [tos 0xac] (ttl 117, id 21896, optlen=20 IPOPT-241{6} TS{12} IPOPT-174{38}[|ip])
4aac 0508 5588 0000 7501 7343 d8f0 28db
d8f0 28d4 f106 d692 57e9 440c 2d21 6206
f3c3 b0a8 29a3 ae26 e5ba 6833 6bbe c8dd
618e 865d 47d6 740e 9daf 12cc e38f e09d
99a8 5e97 3f47 0cb8 5535 6acb 5b18 f848
d1d1
This packet was generated by a program specifically designed to
send random trash to a target to strain its IP stack. We lost.
>How-To-Repeat:
send magic packet to sparc or alpha. boom.
Sun Mar 12 00:06:32 PST 2000
# WARNING: mclpool limit reached; increase NMBCLUSTERS
fatal kernel trap:
trap entry = 0x4 (unaligned access fault)
a0 = 0xfffffc00032a502a
a1 = 0x28
a2 = 0x4
pc = 0xfffffc00003c3ec0
ra = 0xfffffc00003c2470
curproc = 0x0
panic: trap
Stopped at cpu_Debugger+0x4: ret zero,(ra)
db> tr
cpu_Debugger() at cpu_Debugger+0x4
panic() at panic+0xe4
trap() at trap+0x528
XentUna() at XentUna+0x20
--- unaligned access fault (from ipl 1) ---
ip_dooptions() at ip_dooptions+0x4c0
ip_input() at ip_input+0x3d0
ipintr() at ipintr+0x94
netintr() at netintr+0x90
do_sir() at do_sir+0x34
esigcode() at esigcode+0x80
prologue botch: displacement 216
--- root of call graph ---
db>
# cd /usr/obj/sys/arch/alpha/compile/PC164
# gdb netbsd.gdb
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "alpha--netbsd"...
(gdb) list *(ip_dooptions + 0x4c0)
0xfffffc00003c3ec0 is in ip_dooptions (/sys/netinet/ip_input.c:1074).
1069 (caddr_t)(cp + off),
sizeof(struct in_addr))
;
1070 cp[IPOPT_OFFSET] += sizeof(struct in_addr);
1071 break;
1072
1073 case IPOPT_TS:
1074 code = cp - (u_char *)ip;
1075 ipt = (struct ip_timestamp *)cp;
1076 if (ipt->ipt_len < 5)
1077 goto bad;
1078 if (ipt->ipt_ptr > ipt->ipt_len -
sizeof (int32_
t)) {
(gdb)
>Fix:
>Release-Note:
>Audit-Trail:
MESSAGE netbsd/security:96
Date: Wed, 1 Mar 2000 03:42:22 -0800
From: "Erik E. Fair" <fair@clock.org>
Return-path: fair@clock.org
<fair@clock.org>
Subject: IP options processing bug causes panic on alpha, sparc
To: NetBSD Lerts (be a Lert, because the world needs more Lerts) <security-alert@netbsd.org>,
***NetBSD Release Engineers <releng@netbsd.org>
CC: Jason Thorpe <thorpej@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 03:42:42 2000
Mime-Version: 1.0
X-Sender: eef-play@pop.mercy.st.clock.org
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-Orcpt: rfc822;fair@clock.org
My friend Matt Hargett, late of NAI, came over to my house to do some
testing this evening of various exploits against NetBSD. He found a
chink in our armor.
Send a magic packet, NetBSD/alpha go "boom!" in ip_dooptions(),
called from ip_input() as shown by a DDB traceback. This works
whether the alpha is the target, or just a nominally innocent router
(routers have to process IP options). It killed both a PC164 running
a 1.4T kernel, and a DigitalServer 3305 running 1.4.2_ALPHA. A
capture of the panic and traceback for the PC164 are included below.
Similar result against NetBSD/sparc on an SS10 with 90 MHz
HyperSPARCs running 1.4.1 GENERIC.
Oddly, shooting at a Shark only made "mclpool exhausted; increase
NMBCLUSTERS" appear. I tried to test against NetBSD/macppc, but that
was on the other side of the alpha router...
It appears to be consistently reproduceable. If I remember the packet
dump correctly, this was unhappiness to do with a fragment offset.
Instructions for reproducing this are given below.
I include releng in this because this might be an issue we want to
hold up 1.4.2 until solved. OTOH, there's always another bug.
Jason, I include you because you're a frequently whacking on our
network stacks, and you've just taken on Alpha co-Portmastership
(this might just be some LP64 thing, but the SPARC result belies
that).
trying to have this dealt with quickly & quietly,
Erik <fair@clock.org>
>From: Matt <matt@use.net>
>X-Sender: matt@cesium.clock.org
>To: "Erik E. FAIR" <fair@use.net>
>Subject: tcp options panic
>Date: Wed, 1 Mar 2000 02:16:09 -0800
>
>I have stashed libnet v1.0 and isic v0.05 @
>http://www.clock.org/~matt/tmp
>
>(ignore the pictures my mom sent me that are also in that dir =] )
>
>libnet needs a minor tweak to configure properly. after uncompressing it
>into a directory, edit the config.sub file and change all instances of
>'arm-' to 'arm'. Then libnet should configure and compile just fine. Do
>'configure', then 'make', and then 'make install' (tweak the installation
>paths beforehand if you don't want them to go into the default places).
>
>uncompress isic, run configure, and make. I usually edit the Makefile to
>get rid of '-g -O2', and add '-O3 -funroll-loops -fomit-frame-pointer' to
>squeeze an extra couple hundred kilobytes per second of output.
>
>Then run:
>tcpsic -s <source host> -d <destination host> -r 22026 -k 9267 -p 9268
>
>This sets a random seed of 22026, and skips to packet 9,267, and then
>sends only 9,268 packets (sending only the packet we want and the previous
>one).
>
>This causes panics in 1.4.1-sparc and 1.4T-PC164, and is potentially in
>the 1.4.2 release. After some additional testing on FreeBSD and OpenBSD, I
>will probably release an advisory through newhackcity.
fatal kernel trap:
trap entry = 0x4 (unaligned access fault)
a0 = 0xfffffc0004d1382a
a1 = 0x28
a2 = 0x4
pc = 0xfffffc00003cafa0
ra = 0xfffffc00003c9510
curproc = 0x0
panic: trap
Stopped at cpu_Debugger+0x4: ret zero,(ra)
db> t
cpu_Debugger() at cpu_Debugger+0x4
panic() at panic+0xe4
trap() at trap+0x51c
XentUna() at XentUna+0x20
--- unaligned access fault (from ipl 1) ---
ip_dooptions() at ip_dooptions+0x4c0
ip_input() at ip_input+0x3d0
ipintr() at ipintr+0x94
netintr() at netintr+0x90
do_sir() at do_sir+0x34
esigcode() at esigcode+0x80
prologue botch: displacement 216
--- root of call graph ---
MESSAGE netbsd/security:97
Date: Wed, 1 Mar 2000 10:49:25 -0800
From: Jason Thorpe <thorpej@netbsd.org>
Return-path: thorpej@netbsd.org
<thorpej@netbsd.org>
Sender: thorpej@netbsd.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: "Erik E. Fair" <fair@clock.org>
CC: NetBSD Lerts (be a Lert,\
because the world needs more Lerts) <security-alert@netbsd.org>,
NetBSD Release Engineers <releng@netbsd.org>,
Jason Thorpe <thorpej@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 10:49:42 2000
Reply-To: Jason Thorpe <thorpej@netbsd.org>
X-Orcpt: rfc822;fair@clock.org
On Wed, 1 Mar 2000 03:42:04 -0800
"Erik E. Fair" <fair@clock.org> wrote:
> Send a magic packet, NetBSD/alpha go "boom!" in ip_dooptions(),
> called from ip_input() as shown by a DDB traceback. This works
> whether the alpha is the target, or just a nominally innocent router
> (routers have to process IP options). It killed both a PC164 running
> a 1.4T kernel, and a DigitalServer 3305 running 1.4.2_ALPHA. A
> capture of the panic and traceback for the PC164 are included below.
>
> Similar result against NetBSD/sparc on an SS10 with 90 MHz
> HyperSPARCs running 1.4.1 GENERIC.
>
> Oddly, shooting at a Shark only made "mclpool exhausted; increase
> NMBCLUSTERS" appear. I tried to test against NetBSD/macppc, but that
> was on the other side of the alpha router...
The reason the Shark loses that way is because unaligned accesses on
the ARM don't produce faults --- instead they produce incorrect data.
Anyhow, at first glance, it appears to be in the processing of the
IP Timestamp option. I'll look at it more today.
>
> It appears to be consistently reproduceable. If I remember the packet
> dump correctly, this was unhappiness to do with a fragment offset.
> Instructions for reproducing this are given below.
>
> I include releng in this because this might be an issue we want to
> hold up 1.4.2 until solved. OTOH, there's always another bug.
>
> Jason, I include you because you're a frequently whacking on our
> network stacks, and you've just taken on Alpha co-Portmastership
> (this might just be some LP64 thing, but the SPARC result belies
> that).
>
> trying to have this dealt with quickly & quietly,
>
> Erik <fair@clock.org>
>
>
> >From: Matt <matt@use.net>
> >X-Sender: matt@cesium.clock.org
> >To: "Erik E. FAIR" <fair@use.net>
> >Subject: tcp options panic
> >Date: Wed, 1 Mar 2000 02:16:09 -0800
> >
> >I have stashed libnet v1.0 and isic v0.05 @
> >http://www.clock.org/~matt/tmp
> >
> >(ignore the pictures my mom sent me that are also in that dir =] )
> >
> >libnet needs a minor tweak to configure properly. after uncompressing it
> >into a directory, edit the config.sub file and change all instances of
> >'arm-' to 'arm'. Then libnet should configure and compile just fine. Do
> >'configure', then 'make', and then 'make install' (tweak the installation
> >paths beforehand if you don't want them to go into the default places).
> >
> >uncompress isic, run configure, and make. I usually edit the Makefile to
> >get rid of '-g -O2', and add '-O3 -funroll-loops -fomit-frame-pointer' to
> >squeeze an extra couple hundred kilobytes per second of output.
> >
> >Then run:
> >tcpsic -s <source host> -d <destination host> -r 22026 -k 9267 -p 9268
> >
> >This sets a random seed of 22026, and skips to packet 9,267, and then
> >sends only 9,268 packets (sending only the packet we want and the previous
> >one).
> >
> >This causes panics in 1.4.1-sparc and 1.4T-PC164, and is potentially in
> >the 1.4.2 release. After some additional testing on FreeBSD and OpenBSD, I
> >will probably release an advisory through newhackcity.
>
> fatal kernel trap:
>
> trap entry = 0x4 (unaligned access fault)
> a0 = 0xfffffc0004d1382a
> a1 = 0x28
> a2 = 0x4
> pc = 0xfffffc00003cafa0
> ra = 0xfffffc00003c9510
> curproc = 0x0
>
> panic: trap
> Stopped at cpu_Debugger+0x4: ret zero,(ra)
> db> t
> cpu_Debugger() at cpu_Debugger+0x4
> panic() at panic+0xe4
> trap() at trap+0x51c
> XentUna() at XentUna+0x20
> --- unaligned access fault (from ipl 1) ---
> ip_dooptions() at ip_dooptions+0x4c0
> ip_input() at ip_input+0x3d0
> ipintr() at ipintr+0x94
> netintr() at netintr+0x90
> do_sir() at do_sir+0x34
> esigcode() at esigcode+0x80
> prologue botch: displacement 216
> --- root of call graph ---
>
-- Jason R. Thorpe <thorpej@netbsd.org>
MESSAGE netbsd/security:98
Date: Wed, 1 Mar 2000 11:03:13 -0800
From: Jason Thorpe <thorpej@netbsd.org>
Return-path: thorpej@netbsd.org
<thorpej@netbsd.org>
Sender: thorpej@netbsd.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: "Erik E. Fair" <fair@clock.org>
CC: NetBSD Lerts (be a Lert,\
because the world needs more Lerts) <security-alert@netbsd.org>,
NetBSD Release Engineers <releng@netbsd.org>,
Jason Thorpe <thorpej@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 11:03:24 2000
Reply-To: Jason Thorpe <thorpej@netbsd.org>
X-Orcpt: rfc822;fair@clock.org
On Wed, 1 Mar 2000 03:42:04 -0800
"Erik E. Fair" <fair@clock.org> wrote:
> I include releng in this because this might be an issue we want to
> hold up 1.4.2 until solved. OTOH, there's always another bug.
This actually may be a compiler bug. Upon further looking, looks like
the code is careful to use bcopy(), which libkern.h changes into a
memcpy(), which GCC is probably inlining ... and being "clever" to emit
a load-store of the single 32-bit value. Bad. This is due to GCC not
disabling the optimized inline unless it can guarantee that both the source
and destination are properly aligned.
Sigh.
> Jason, I include you because you're a frequently whacking on our
> network stacks, and you've just taken on Alpha co-Portmastership
> (this might just be some LP64 thing, but the SPARC result belies
> that).
>
> trying to have this dealt with quickly & quietly,
>
> Erik <fair@clock.org>
>
>
> >From: Matt <matt@use.net>
> >X-Sender: matt@cesium.clock.org
> >To: "Erik E. FAIR" <fair@use.net>
> >Subject: tcp options panic
> >Date: Wed, 1 Mar 2000 02:16:09 -0800
> >
> >I have stashed libnet v1.0 and isic v0.05 @
> >http://www.clock.org/~matt/tmp
> >
> >(ignore the pictures my mom sent me that are also in that dir =] )
> >
> >libnet needs a minor tweak to configure properly. after uncompressing it
> >into a directory, edit the config.sub file and change all instances of
> >'arm-' to 'arm'. Then libnet should configure and compile just fine. Do
> >'configure', then 'make', and then 'make install' (tweak the installation
> >paths beforehand if you don't want them to go into the default places).
> >
> >uncompress isic, run configure, and make. I usually edit the Makefile to
> >get rid of '-g -O2', and add '-O3 -funroll-loops -fomit-frame-pointer' to
> >squeeze an extra couple hundred kilobytes per second of output.
> >
> >Then run:
> >tcpsic -s <source host> -d <destination host> -r 22026 -k 9267 -p 9268
> >
> >This sets a random seed of 22026, and skips to packet 9,267, and then
> >sends only 9,268 packets (sending only the packet we want and the previous
> >one).
> >
> >This causes panics in 1.4.1-sparc and 1.4T-PC164, and is potentially in
> >the 1.4.2 release. After some additional testing on FreeBSD and OpenBSD, I
> >will probably release an advisory through newhackcity.
>
> fatal kernel trap:
>
> trap entry = 0x4 (unaligned access fault)
> a0 = 0xfffffc0004d1382a
> a1 = 0x28
> a2 = 0x4
> pc = 0xfffffc00003cafa0
> ra = 0xfffffc00003c9510
> curproc = 0x0
>
> panic: trap
> Stopped at cpu_Debugger+0x4: ret zero,(ra)
> db> t
> cpu_Debugger() at cpu_Debugger+0x4
> panic() at panic+0xe4
> trap() at trap+0x51c
> XentUna() at XentUna+0x20
> --- unaligned access fault (from ipl 1) ---
> ip_dooptions() at ip_dooptions+0x4c0
> ip_input() at ip_input+0x3d0
> ipintr() at ipintr+0x94
> netintr() at netintr+0x90
> do_sir() at do_sir+0x34
> esigcode() at esigcode+0x80
> prologue botch: displacement 216
> --- root of call graph ---
>
-- Jason R. Thorpe <thorpej@netbsd.org>
MESSAGE netbsd/security:99
Date: Wed, 1 Mar 2000 11:28:04 -0800
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
Return-path: sommerfeld@orchard.arlington.ma.us
<sommerfeld@orchard.arlington.ma.us>
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: Jason Thorpe <thorpej@netbsd.org>
CC: "Erik E. Fair" <fair@clock.org>, security-alert@netbsd.org, NetBSD Release Engineers <rele
***ng@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 11:28:15 2000
In-Reply-To: Message from Jason Thorpe <thorpej@netbsd.org>
of "Wed, 01 Mar 2000 11:03:07 PST." <20000301190307.14478.qmail@mail.netbsd.org>
X-Orcpt: rfc822;fair@clock.org
[speaking with my security-officer hat on..]
I agree with Erik and Jason that this is a showstopper for 1.4.2.
I just spoke to Jason on the phone and he will be investigating:
1) recoding the particular piece of ip_input.c to avoid the compiler
bug.
2) because it will be hard to tell where else this will bite us,
pulling the alignment-related fixes already in gcc-2.9x.xx into the
egcs-1.1.x-based compiler in -current ..
Let me know if you need help with anything..
- Bill
MESSAGE netbsd/security:100
Date: Wed, 1 Mar 2000 11:36:45 -0800
From: Jason Thorpe <thorpej@netbsd.org>
Return-path: thorpej@netbsd.org
<thorpej@netbsd.org>
Sender: thorpej@netbsd.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: "Erik E. Fair" <fair@clock.org>
CC: NetBSD Lerts (be a Lert, because the world needs more Lerts) <security-alert@netbsd.org>,
NetBSD Release Engineers <releng@netbsd.org>,
Jason Thorpe <thorpej@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 11:37:05 2000
Reply-To: Jason Thorpe <thorpej@netbsd.org>
X-Orcpt: rfc822;fair@clock.org
On Wed, 1 Mar 2000 03:42:04 -0800
"Erik E. Fair" <fair@clock.org> wrote:
> My friend Matt Hargett, late of NAI, came over to my house to do some
> testing this evening of various exploits against NetBSD. He found a
> chink in our armor.
Please try the following patch and let me know if it works around the
problem. If it does, I will commit it to the trunk, and send a pullup
for 1.4.2 (I think this is a 1.4.2 showstopper).
Long term, we need to fix the compiler. I'll take a look at this RSN,
but that's too much for 1.4.2.
-- Jason R. Thorpe <thorpej@netbsd.org>
Index: ip_input.c
===================================================================
RCS file: /cvsroot/syssrc/sys/netinet/ip_input.c,v
retrieving revision 1.103
diff -c -r1.103 ip_input.c
*** ip_input.c 2000/03/01 12:49:33 1.103
--- ip_input.c 2000/03/01 19:34:05
***************
*** 949,959 ****
struct mbuf *m;
{
register struct ip *ip = mtod(m, struct ip *);
! register u_char *cp;
register struct ip_timestamp *ipt;
register struct in_ifaddr *ia;
int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0;
! struct in_addr *sin, dst;
n_time ntime;
dst = ip->ip_dst;
--- 949,959 ----
struct mbuf *m;
{
register struct ip *ip = mtod(m, struct ip *);
! register u_char *cp, *cp0;
register struct ip_timestamp *ipt;
register struct in_ifaddr *ia;
int opt, optlen, cnt, off, code, type = ICMP_PARAMPROB, forward = 0;
! struct in_addr dst;
n_time ntime;
dst = ip->ip_dst;
***************
*** 1082,1088 ****
goto bad;
break;
}
! sin = (struct in_addr *)(cp + ipt->ipt_ptr - 1);
switch (ipt->ipt_flg) {
case IPOPT_TS_TSONLY:
--- 1082,1088 ----
goto bad;
break;
}
! cp0 = (cp + ipt->ipt_ptr - 1);
switch (ipt->ipt_flg) {
case IPOPT_TS_TSONLY:
***************
*** 1097,1104 ****
m->m_pkthdr.rcvif));
if (ia == 0)
continue;
! bcopy((caddr_t)&ia->ia_addr.sin_addr,
! (caddr_t)sin, sizeof(struct in_addr));
ipt->ipt_ptr += sizeof(struct in_addr);
break;
--- 1097,1104 ----
m->m_pkthdr.rcvif));
if (ia == 0)
continue;
! bcopy(&ia->ia_addr.sin_addr,
! cp0, sizeof(struct in_addr));
ipt->ipt_ptr += sizeof(struct in_addr);
break;
***************
*** 1106,1112 ****
if (ipt->ipt_ptr - 1 + sizeof(n_time) +
sizeof(struct in_addr) > ipt->ipt_len)
goto bad;
! bcopy((caddr_t)sin, (caddr_t)&ipaddr.sin_addr,
sizeof(struct in_addr));
if (ifatoia(ifa_ifwithaddr(sintosa(&ipaddr)))
== NULL)
--- 1106,1112 ----
if (ipt->ipt_ptr - 1 + sizeof(n_time) +
sizeof(struct in_addr) > ipt->ipt_len)
goto bad;
! bcopy(cp0, &ipaddr.sin_addr,
sizeof(struct in_addr));
if (ifatoia(ifa_ifwithaddr(sintosa(&ipaddr)))
== NULL)
***************
*** 1118,1124 ****
goto bad;
}
ntime = iptime();
! bcopy((caddr_t)&ntime, (caddr_t)cp + ipt->ipt_ptr - 1,
sizeof(n_time));
ipt->ipt_ptr += sizeof(n_time);
}
--- 1118,1125 ----
goto bad;
}
ntime = iptime();
! cp0 = (u_char *) &ntime; /* XXX GCC BUG */
! bcopy(cp0, (caddr_t)cp + ipt->ipt_ptr - 1,
sizeof(n_time));
ipt->ipt_ptr += sizeof(n_time);
}
MESSAGE netbsd/security:101
Date: Wed, 1 Mar 2000 12:08:25 -0800
From: Jason Thorpe <thorpej@netbsd.org>
Return-path: thorpej@netbsd.org
<thorpej@netbsd.org>
Sender: thorpej@netbsd.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: "Erik E. Fair" <fair@clock.org>
CC: NetBSD Lerts (be a Lert,\
because the world needs more Lerts) <security-alert@netbsd.org>,
NetBSD Release Engineers <releng@netbsd.org>,
Jason Thorpe <thorpej@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 12:08:47 2000
Reply-To: Jason Thorpe <thorpej@netbsd.org>
X-Orcpt: rfc822;fair@clock.org
On Wed, 1 Mar 2000 03:42:04 -0800
"Erik E. Fair" <fair@clock.org> wrote:
> Send a magic packet, NetBSD/alpha go "boom!" in ip_dooptions(),
> called from ip_input() as shown by a DDB traceback. This works
> whether the alpha is the target, or just a nominally innocent router
> (routers have to process IP options). It killed both a PC164 running
> a 1.4T kernel, and a DigitalServer 3305 running 1.4.2_ALPHA. A
> capture of the panic and traceback for the PC164 are included below.
BTW, the following simple program demonstrates the GCC bug.
Compile it with "-S -O2" and look at the resulting .s file.
-- Jason R. Thorpe <thorpej@netbsd.org>
#include <string.h>
struct s {
unsigned int i;
};
unsigned int
foo(unsigned char *cp)
{
struct s *src, dst;
src = (struct s *)(cp + 1);
memcpy(&dst, src, sizeof(struct s));
return (dst.i);
}
MESSAGE netbsd/security:102
Date: Wed, 1 Mar 2000 13:46:58 -0800
From: Daniel Carosone <dan@geek.com.au>
Return-path: dan@geek.com.au
<dan@geek.com.au>
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: Jason Thorpe <thorpej@netbsd.org>
CC: "Erik E. Fair" <fair@clock.org>,
NetBSD Lerts (be a Lert,\
because the world needs more Lerts) <security-alert@netbsd.org>,
NetBSD Release Engineers <releng@netbsd.org>,
Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 13:47:11 2000
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
In-Reply-To: <20000301200812.22812.qmail@mail.netbsd.org>
References: <20000301200812.22812.qmail@mail.netbsd.org>
X-Mailer: VM 6.43 under 20.4 "Emerald" XEmacs Lucid
X-Orcpt: rfc822;fair@clock.org
I'll start working up the text of an advisory today..
--
Dan.
MESSAGE netbsd/security:103
Date: Wed, 1 Mar 2000 16:55:25 -0800
From: "CAROSONE, Daniel" <dcarosone@westpac.com.au>
Return-path: dcarosone@westpac.com.au
<dcarosone@westpac.com.au>
Subject: RE: IP options processing bug causes panic on alpha, sparc
To: Jason Thorpe <thorpej@netbsd.org>, "Erik E. Fair" <fair@clock.org>
CC: NetBSD Lerts <security-alert@netbsd.org>, NetBSD Release Engineers <releng@netbsd.org>, Ma
***tt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 16:55:39 2000
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2448.0)
Content-Type: multipart/mixed;
boundary="----_=_NextPart_000_01BF83E2.554D42BC"
X-Orcpt: rfc822;fair@clock.org
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01BF83E2.554D42BC
Content-Type: text/plain;
charset="iso-8859-1"
Here's a draft of the SA for comment and review.
Questions to help make it more informative and accurate:
- is it only the timestamp option, or should I make the statement more
general?
- what can we add about other architectures? Is the gcc bug applicable to
all of them?
- do we know if the alignment fixes in 2.9x will address this?
- do we want to provide more details of how the packets are malformed?
- please keep me up-to-date on what's happening with the compiler issue..
--
Dan.
DRAFT
NetBSD Security Advisory 2000-002
=================================
Topic: IP options processing Denial of Service
Version: NetBSD 1.4.1 and prior; NetBSD-current until 200003xx
Severity: Network-connected systems can be crashed remotely.
Abstract
========
Processing of IP packets with malfomed IP Timestamp options can cause
a misaligned access in kernel space, resulting in a panic (on most
architectures) or other problems.
The problem is the result of a compiler optimisation bug, not a bug in
the IP stack itself.
Technical Details
=================
IP packets can contain optional processing directives, which must be
processed both by the destination system of the packet, as well as by
intermediate routers. These options can be malformed, if constructed
maliciously. Tools to construct such packets are widely available and
in common use.
Due to a compiler problem, the NetBSD code to process certain IP
options may generate misaligned accesses in kernel space, which will
result in a panic (on most architectures). GCC is inlining calls to
memcpy(), and optimising them to emit a load-store of the single
32-bit value, however it does not presently guarantee that both the
source and destination are properly aligned before enabling this
optimisation.
This problem is known to produce alignment fault panics on the Alpha,
SPARC, .... and ... architectures. On some architectures, for example
the ARM, misaligned accesses do not produce faults; instead they
produce incorrect data. These systems will not panic, but instead
produce other problems, such as exhaustion of the mbuf cluster pool.
Solutions and Workarounds
=========================
A patch is available for NetBSD 1.4.1, that works around the compiler
problem by avoiding the optimisation path. It is located at:
ftp://ftp.NetBSD.ORG/pub/NetBSD/misc/security/patches/20000229-ipopts
This patch will be included in the upcoming NetBSD 1.4.2 minor release.
NetBSD-current since 200003xx also contains this workaround, and is
not vulnerable. Users of NetBSD-current should upgrade to a source
tree later than 200003xx.
The compiler problem must be fixed, because this issue may affect
other NetBSD code. Alignment-related fixes in gcc-2.9x.xx may address
this case, and investigation is underway to determine whether these
fixes are appropriate and can be incorporated into the
egcs-1.1.1-derived compiler currently used by NetBSD.
Thanks To
=========
Matt Hargett and Erik Fair for discovering and reporting the problem.
Jason Thorpe for analysing the problem and implementing the code
change to work around the compiler for the 1.4.2 release, and
pursuing the fix to the compiler for -current.
Revision History
================
2000/02/29 - initial version
More Information
================
Information about NetBSD and NetBSD security can be found at
http://www.NetBSD.ORG/ and http://www.NetBSD.ORG/Security/.
Copyright 2000, The NetBSD Foundation, Inc. All Rights Reserved.
$NetBSD: NetBSD-SA2000-001.txt,v 1.3 2000/02/19 04:02:43 dan Exp $
------_=_NextPart_000_01BF83E2.554D42BC
Content-Type: application/ms-tnef
Content-Transfer-Encoding: base64
eJ8+IjYAAQaQCAAEAAAAAAABAAEAAQeQBgAIAAAA5AQAAAAAAADoAAEIgAcAGAAAAElQTS5NaWNy
b3NvZnQgTWFpbC5Ob3RlADEIAQSAAQA8AAAAUkU6IElQIG9wdGlvbnMgcHJvY2Vzc2luZyBidWcg
Y2F1c2VzIHBhbmljIG9uIGFscGhhLCBzcGFyYyAA6BQBCYABACEAAAAxMTMzRURDM0M5OTlDQzQx
ODg4RTk1NkQ1NkY1N0FFMABIBwEggAMADgAAANAHAwACAAsAOQAyAAQAVgEBBYADAA4AAADQBwMA
AgALAC0AJQAEAD0BAQ2ABAACAAAAAgACAAEDkAYAqA4AAC4AAAALAAIAAQAAAAMALgAAAAAAQAA5
ACCXVaDgg78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lMIEFERFJFU1NFUy9DTj1EQ0FS
T1NPTkVGNTg5ODc1QwAAAAAeAPg/AQAAABEAAABDQVJPU09ORSwgRGFuaWVsAAAAAB4AOEABAAAA
EgAAAERDQVJPU09ORUY1ODk4NzVDAAAAAgH7PwEAAABlAAAAAAAAANynQMjAQhAatLkIACsv4YIB
AAAABgAAAC9PPVdFU1RQQUMvT1U9V0JDL0NOPVJFQ0lQSUVOVFMvQ049TVNNQUlMIEFERFJFU1NF
Uy9DTj1EQ0FST1NPTkVGNTg5ODc1QwAAAAAeAPo/AQAAABEAAABDQVJPU09ORSwgRGFuaWVsAAAA
AB4AOUABAAAAEgAAAERDQVJPU09ORUY1ODk4NzVDAAAAQAAHMGA5sW3fg78BQAAIMLxCTVXig78B
HgA9AAEAAAAFAAAAUkU6IAAAAAAeAB0OAQAAADgAAABJUCBvcHRpb25zIHByb2Nlc3NpbmcgYnVn
IGNhdXNlcyBwYW5pYyBvbiBhbHBoYSwgc3BhcmMgAAsAKQAAAAAACwAjAAAAAAADAAYQikUIpAMA
BxBzCwAAAwAQEAAAAAADABEQAAAAAB4ACBABAAAAZQAAAEhFUkVTQURSQUZUT0ZUSEVTQUZPUkNP
TU1FTlRBTkRSRVZJRVdRVUVTVElPTlNUT0hFTFBNQUtFSVRNT1JFSU5GT1JNQVRJVkVBTkRBQ0NV
UkFURTotSVNJVE9OTFlUSEVUSU0AAAAAG1s=
------_=_NextPart_000_01BF83E2.554D42BC--
MESSAGE netbsd/security:104
Date: Wed, 1 Mar 2000 17:09:41 -0800
From: itojun@iijlab.net
Return-path: itojun@itojun.org
<itojun@itojun.org>
Sender: itojun@itojun.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: Jason Thorpe <thorpej@netbsd.org>
CC: "Erik E. Fair" <fair@clock.org>, security-alert@netbsd.org, NetBSD Release Engineers <rele
***ng@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 17:09:50 2000
In-reply-to: thorpej's message of Wed, 01 Mar 2000 11:03:07 PST.
<20000301190307.14478.qmail@mail.netbsd.org>
X-Template-Reply-To: itojun@itojun.org
X-Template-Return-Receipt-To: itojun@itojun.org
X-PGP-Fingerprint: F8 24 B4 2C 8C 98 57 FD 90 5F B4 60 79 54 16 E2
X-Orcpt: rfc822;fair@clock.org
> > I include releng in this because this might be an issue we want to
> > hold up 1.4.2 until solved. OTOH, there's always another bug.
>This actually may be a compiler bug. Upon further looking, looks like
>the code is careful to use bcopy(), which libkern.h changes into a
>memcpy(), which GCC is probably inlining ... and being "clever" to emit
>a load-store of the single 32-bit value. Bad. This is due to GCC not
>disabling the optimized inline unless it can guarantee that both the source
>and destination are properly aligned.
It looks to be the same issue with PR 9189. sigh...
itojun
MESSAGE netbsd/security:105
Date: Wed, 1 Mar 2000 17:34:05 -0800
From: Jason Thorpe <thorpej@netbsd.org>
Return-path: thorpej@netbsd.org
<thorpej@netbsd.org>
Sender: thorpej@netbsd.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: itojun@iijlab.net
CC: Jason Thorpe <thorpej@netbsd.org>, "Erik E. Fair" <fair@clock.org>, security-alert@netbsd.
***org, NetBSD Release Engineers <releng@netbsd.org>,
Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 17:34:10 2000
Reply-To: Jason Thorpe <thorpej@netbsd.org>
X-Orcpt: rfc822;fair@clock.org
On Thu, 02 Mar 2000 10:09:37 +0900
itojun@iijlab.net wrote:
> > > I include releng in this because this might be an issue we want to
> > > hold up 1.4.2 until solved. OTOH, there's always another bug.
> >This actually may be a compiler bug. Upon further looking, looks like
> >the code is careful to use bcopy(), which libkern.h changes into a
> >memcpy(), which GCC is probably inlining ... and being "clever" to emit
> >a load-store of the single 32-bit value. Bad. This is due to GCC not
> >disabling the optimized inline unless it can guarantee that both the source
> >and destination are properly aligned.
>
> It looks to be the same issue with PR 9189. sigh...
*ding*
-- Jason R. Thorpe <thorpej@netbsd.org>
MESSAGE netbsd/security:106
Date: Wed, 1 Mar 2000 17:36:11 -0800
From: itojun@iijlab.net
Return-path: itojun@itojun.org
<itojun@itojun.org>
Sender: itojun@itojun.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: Jason Thorpe <thorpej@netbsd.org>
CC: "Erik E. Fair" <fair@clock.org>, security-alert@netbsd.org, NetBSD Release Engineers <rele
***ng@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 17:36:20 2000
In-reply-to: thorpej's message of Wed, 01 Mar 2000 17:34:00 PST.
<20000302013401.11321.qmail@mail.netbsd.org>
X-Template-Reply-To: itojun@itojun.org
X-Template-Return-Receipt-To: itojun@itojun.org
X-PGP-Fingerprint: F8 24 B4 2C 8C 98 57 FD 90 5F B4 60 79 54 16 E2
X-Orcpt: rfc822;fair@clock.org
> > It looks to be the same issue with PR 9189. sigh...
>*ding*
for 1.4.2, isn't it better to weaken the default compiler optimization
options? (specifically for the kernel) there can be others...
itojun
MESSAGE netbsd/security:107
Date: Wed, 1 Mar 2000 19:51:09 -0800
From: Erik Fair <fair@clock.org>
Return-path: fair@clock.org
<fair@clock.org>
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: Jason Thorpe <thorpej@netbsd.org>
CC: NetBSD Lerts (be a Lert, because the world needs more Lerts) <security-alert@netbsd.org>,
***NetBSD Release Engineers <releng@netbsd.org>,
Jason Thorpe <thorpej@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 19:51:24 2000
Mime-Version: 1.0
X-Sender: eef-info@pop
In-Reply-To: <20000301193640.18222.qmail@mail.netbsd.org>
References: <20000301193640.18222.qmail@mail.netbsd.org>
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-Orcpt: rfc822;fair@clock.org
The patch worked. No more panic.
Erik <fair@clock.org>
MESSAGE netbsd/security:108
Date: Wed, 1 Mar 2000 21:28:41 -0800
From: Jason Thorpe <thorpej@netbsd.org>
Return-path: thorpej@netbsd.org
<thorpej@netbsd.org>
Sender: thorpej@netbsd.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: Erik Fair <fair@clock.org>
CC: Jason Thorpe <thorpej@netbsd.org>,
NetBSD Lerts (be a Lert,\
because the world needs more Lerts) <security-alert@netbsd.org>,
NetBSD Release Engineers <releng@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 21:28:48 2000
Reply-To: Jason Thorpe <thorpej@netbsd.org>
X-Orcpt: rfc822;fair@clock.org
On Wed, 1 Mar 2000 19:48:44 -0800
Erik Fair <fair@clock.org> wrote:
> The patch worked. No more panic.
Ok, I'll commit it and submit a pullup for 1.4.2.
-- Jason R. Thorpe <thorpej@netbsd.org>
MESSAGE netbsd/security:109
Date: Wed, 1 Mar 2000 21:29:17 -0800
From: Jason Thorpe <thorpej@netbsd.org>
Return-path: thorpej@netbsd.org
<thorpej@netbsd.org>
Sender: thorpej@netbsd.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: itojun@iijlab.net
CC: Jason Thorpe <thorpej@netbsd.org>, "Erik E. Fair" <fair@clock.org>, security-alert@netbsd.
***org, NetBSD Release Engineers <releng@netbsd.org>,
Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 21:29:29 2000
Reply-To: Jason Thorpe <thorpej@netbsd.org>
X-Orcpt: rfc822;fair@clock.org
On Thu, 02 Mar 2000 10:36:07 +0900
itojun@iijlab.net wrote:
> for 1.4.2, isn't it better to weaken the default compiler optimization
> options? (specifically for the kernel) there can be others...
We could just disable all inlining of memcpy()/memset() for now...
-- Jason R. Thorpe <thorpej@netbsd.org>
MESSAGE netbsd/security:110
Date: Wed, 1 Mar 2000 22:38:27 -0800
From: Matt <matt@use.net>
Return-path: matt@use.net
<matt@use.net>
Subject: RE: IP options processing bug causes panic on alpha, sparc
To: "CAROSONE, Daniel" <dcarosone@westpac.com.au>
CC: Jason Thorpe <thorpej@netbsd.org>, "Erik E. Fair" <fair@clock.org>, NetBSD Lerts <security
***-alert@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Wed Mar 1 22:38:39 2000
X-Sender: matt@cesium.clock.org
In-Reply-To: <200003020055.LAA12601@mail.westpac.com.au>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Orcpt: rfc822;fair@clock.org
On Wed, 1 Mar 2000, CAROSONE, Daniel wrote:
> Here's a draft of the SA for comment and review.
>
> Questions to help make it more informative and accurate:
> - is it only the timestamp option, or should I make the statement more
> general?
> - what can we add about other architectures? Is the gcc bug applicable to
> all of them?
> - do we know if the alignment fixes in 2.9x will address this?
> - do we want to provide more details of how the packets are malformed?
> - please keep me up-to-date on what's happening with the compiler issue..
We used a tool by Mike Frantzen called ISIC to find this bug. If you could
plug it's URL @ http://expert.cc.purdue.edu/~frantzen , that would be
cool.
(ISIC stands for IP Stack Integrity Checker and has very legitimate QA
purposes. I contibuted a couple of patches to this project as it came in
very handy when testing packet filtering and VPN software at my previous
job.)
ttyl
--
it's only fair to tell you
I'm absolutely cuckoo
MESSAGE netbsd/security:111
Date: Thu, 2 Mar 2000 00:59:46 -0800
From: Havard.Eidnes@runit.sintef.no
Return-path: he@runit.sintef.no
<he@runit.sintef.no>
Sender: Havard Eidnes <he@runit.sintef.no>
Subject: RE: IP options processing bug causes panic on alpha, sparc
To: dcarosone@westpac.com.au
CC: thorpej@netbsd.org, fair@clock.org, security-alert@netbsd.org, releng@netbsd.org, matt@clo
***ck.org
Delivery-Date: Thu Mar 2 01:00:03 2000
In-Reply-To: Your message of "Thu, 2 Mar 2000 11:45:37 +1100 "
<200003020055.LAA12601@mail.westpac.com.au>
References: <200003020055.LAA12601@mail.westpac.com.au>
X-Mailer: Mew version 1.93 on Emacs 19.34
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-8859-1
Content-Transfer-Encoding: 8BIT
X-Dispatcher: imput version 980905(IM100)
Lines: 18
X-Orcpt: rfc822;fair@clock.org
> Topic: IP options processing Denial of Service
> Version: NetBSD 1.4.1 and prior; NetBSD-current until 200003xx
> Severity: Network-connected systems can be crashed remotely.
>
>
> Abstract
> ========
>
> Processing of IP packets with malfomed IP Timestamp options can
> cause a misaligned access in kernel space, resulting in a panic
> (on most architectures) or other problems.
Is this a problem on "most" architectures? Is it a problem on
the i386 architecture (which I guess is the most prevalent)?
Perhaps we should be more specific on this point.
- Håvard
MESSAGE netbsd/security:112
Date: Thu, 2 Mar 2000 12:08:37 -0800
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
Return-path: sommerfeld@orchard.arlington.ma.us
<sommerfeld@orchard.arlington.ma.us>
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: Jason Thorpe <thorpej@netbsd.org>
CC: itojun@iijlab.net, "Erik E. Fair" <fair@clock.org>, security-alert@netbsd.org, NetBSD Rele
***ase Engineers <releng@netbsd.org>,
Matt Hargett <matt@clock.org>
Delivery-Date: Thu Mar 2 12:08:54 2000
In-Reply-To: Message from Jason Thorpe <thorpej@netbsd.org>
of "Wed, 01 Mar 2000 21:28:09 PST." <20000302052809.10854.qmail@mail.netbsd.org>
X-Orcpt: rfc822;fair@clock.org
> Return-Path: thorpej@netbsd.org
> Delivery-Date: Thu Mar 2 05:28:19 2000
> Received: from orchard.arlington.ma.us (stack.hamachi.org [4.255.0.97])
> by orchard.arlington.ma.us (8.8.8/1.34) with ESMTP id FAA22896
> for <sommerfeld@orchard.arlington.ma.us>; Thu, 2 Mar 2000 05:28:19 GMT
> Received: from mail.netbsd.org (redmail.netbsd.org [155.53.200.193])
> by orchard.arlington.ma.us (8.8.8/8.8.8) with SMTP id AAA28245
> for <sommerfeld@orchard.arlington.ma.us>; Thu, 2 Mar 2000 00:28:17 -0500 (EST)
> Received: (qmail 10917 invoked by uid 1099); 2 Mar 2000 05:28:15 -0000
> Delivered-To: sommerfeld@netbsd.org
> Received: (qmail 10890 invoked by alias); 2 Mar 2000 05:28:13 -0000
> Delivered-To: security-officer@netbsd.org
> Received: (qmail 10865 invoked by alias); 2 Mar 2000 05:28:11 -0000
> Delivered-To: security-alert@netbsd.org
> Received: (qmail 10856 invoked by uid 1076); 2 Mar 2000 05:28:09 -0000
> Message-ID: <20000302052809.10854.qmail@mail.netbsd.org>
> To: itojun@iijlab.net
> Cc: Jason Thorpe <thorpej@netbsd.org>, "Erik E. Fair" <fair@clock.org>,
> security-alert@netbsd.org,
> NetBSD Release Engineers <releng@netbsd.org>,
> Matt Hargett <matt@clock.org>
> Subject: Re: IP options processing bug causes panic on alpha, sparc
> Reply-To: Jason Thorpe <thorpej@netbsd.org>
> From: Jason Thorpe <thorpej@netbsd.org>
> Date: Wed, 01 Mar 2000 21:28:09 -0800
> Sender: thorpej@netbsd.org
>
> On Thu, 02 Mar 2000 10:36:07 +0900
> itojun@iijlab.net wrote:
>
> > for 1.4.2, isn't it better to weaken the default compiler optimization
> > options? (specifically for the kernel) there can be others...
>
> We could just disable all inlining of memcpy()/memset() for now...
this seems like the safest option on platforms which have alignment
issues..
(sparc, alpha, mips, arm32 definitely; power pc as well, i think)
i386 currently has alignment checking turned off (it's possible to
turn on alignment checks on i486 or greater, I believe), so
it's a non-issue there.
vax and m68k doesn't have a problem with it.
let's not forget pc532 :-)
what about sh3?
did I forget anything?
MESSAGE netbsd/security:113
Date: Thu, 2 Mar 2000 15:00:24 -0800
From: Jason Thorpe <thorpej@netbsd.org>
Return-path: thorpej@netbsd.org
<thorpej@netbsd.org>
Sender: thorpej@netbsd.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: Havard.Eidnes@runit.sintef.no
CC: dcarosone@westpac.com.au, thorpej@netbsd.org, fair@clock.org, security-alert@netbsd.org, r
***eleng@netbsd.org, matt@clock.org
Delivery-Date: Thu Mar 2 15:00:31 2000
Reply-To: Jason Thorpe <thorpej@netbsd.org>
X-Orcpt: rfc822;fair@clock.org
On Thu, 02 Mar 2000 09:58:47 +0100
Havard.Eidnes@runit.sintef.no wrote:
> > Processing of IP packets with malfomed IP Timestamp options can
> > cause a misaligned access in kernel space, resulting in a panic
> > (on most architectures) or other problems.
>
> Is this a problem on "most" architectures? Is it a problem on
> the i386 architecture (which I guess is the most prevalent)?
>
> Perhaps we should be more specific on this point.
Lessee... should affect:
alpha, arm32, mips, sh3, sparc, sparc64
Might affect:
powerpc
No problems:
i386, m68k, pc532, vax
Pretty sure that's how it breaks down.
-- Jason R. Thorpe <thorpej@netbsd.org>
MESSAGE netbsd/security:114
Date: Thu, 2 Mar 2000 15:25:11 -0800
From: "Daniel Carosone" <D.Carosone@e-Secure.com.au>
Return-path: D.Carosone@e-Secure.com.au
<D.Carosone@e-Secure.com.au>
Subject: RE: IP options processing bug causes panic on alpha, sparc
To: "'Matt'" <matt@use.net>
CC: "'Jason Thorpe'" <thorpej@netbsd.org>, "'Erik E. Fair'" <fair@clock.org>, "'NetBSD Lerts'"
*** <security-alert@netbsd.org>,
"'Matt Hargett'" <matt@clock.org>
Delivery-Date: Thu Mar 2 15:25:22 2000
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0)
In-Reply-To: <Pine.NEB.4.10.10003012217060.19597-100000@cesium.clock.org>
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
X-Orcpt: rfc822;fair@clock.org
> We used a tool by Mike Frantzen called ISIC to find this bug.
> If you could plug it's URL @ http://expert.cc.purdue.edu/~frantzen
> that would be cool.
>
> (ISIC stands for IP Stack Integrity Checker and has very legitimate QA
> purposes. I contibuted a couple of patches to this project as
> it came in very handy when testing packet filtering and VPN software at
> my previous job.)
>
Sounds like something that should be in pkgsrc..
I'll take a look at it, it may not be appropriate to plug stuff in a
security advisory..
--
Dan.
MESSAGE netbsd/security:115
Date: Thu, 2 Mar 2000 19:16:02 -0800
From: Matt <matt@use.net>
Return-path: matt@use.net
<matt@use.net>
Subject: RE: IP options processing bug causes panic on alpha, sparc
To: Daniel Carosone <D.Carosone@e-Secure.com.au>
CC: 'Jason Thorpe' <thorpej@netbsd.org>, "'Erik E. Fair'" <fair@clock.org>, 'NetBSD Lerts' <se
***curity-alert@netbsd.org>
Delivery-Date: Thu Mar 2 19:16:11 2000
X-Sender: matt@cesium.clock.org
In-Reply-To: <004701bf8494$c5d3c6c0$0fc910cb@NOISY>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
X-Orcpt: rfc822;fair@clock.org
On Thu, 2 Mar 2000, Daniel Carosone wrote:
> > We used a tool by Mike Frantzen called ISIC to find this bug.
> > If you could plug it's URL @ http://expert.cc.purdue.edu/~frantzen
> > that would be cool.
> >
> > (ISIC stands for IP Stack Integrity Checker and has very legitimate QA
> > purposes. I contibuted a couple of patches to this project as
> > it came in very handy when testing packet filtering and VPN software at
> > my previous job.)
> >
>
> Sounds like something that should be in pkgsrc..
>
> I'll take a look at it, it may not be appropriate to plug stuff in a
> security advisory..
It's free and opensource, and we wouldn't have found this very easily
without it. I think it would be nice to give credit where it's due, at the
very least point out we used the utility, if you're uncomfortable with
placing the URL in there.
If you want to include the package in the distro, you'll also need Libnet.
It's normally at http://www.packetfacory.net/libnet , but they're having
DNS troubles at the moment/
--
it's only fair to tell you
I'm absolutely cuckoo
MESSAGE netbsd/security:116
Date: Sun, 5 Mar 2000 18:16:02 -0800
From: "Daniel Carosone" <D.Carosone@e-Secure.com.au>
Return-path: D.Carosone@e-Secure.com.au
<D.Carosone@e-Secure.com.au>
Subject: RE: IP options processing bug causes panic on alpha, sparc
To: "'Matt'" <matt@use.net>
CC: "'Jason Thorpe'" <thorpej@netbsd.org>, "'Erik E. Fair'" <fair@clock.org>, "'NetBSD Lerts'"
*** <security-alert@netbsd.org>
Delivery-Date: Sun Mar 5 18:16:21 2000
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2910.0)
In-Reply-To: <Pine.NEB.4.10.10003021909460.19597-100000@cesium.clock.org>
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211
X-Orcpt: rfc822;fair@clock.org
> > Sounds like something that should be in pkgsrc..
It also looks, at first blush, similar to iptest, which is part of ipfilter,
and is in the base distribution. In any case, I'll mention it in the
advisory.
--
Dan..
MESSAGE netbsd/security:117
Date: Mon, 6 Mar 2000 21:40:52 -0800
From: Jason Thorpe <thorpej@nas.nasa.gov>
Return-path: thorpej@lestat.nas.nasa.gov
<thorpej@lestat.nas.nasa.gov>
Sender: thorpej@nas.nasa.gov
Subject: please try that attack against ip_input.c,v 1.106
To: fair@netbsd.org
Delivery-Date: Mon Mar 6 21:41:07 2000
Delivered-To: fair@netbsd.org
Reply-To: Jason Thorpe <thorpej@nas.nasa.gov>
X-Orcpt: rfc822;fair@clock.org
...there was part of it that wasn't necessary.
-- Jason R. Thorpe <thorpej@nas.nasa.gov>
MESSAGE netbsd/security:118
Date: Mon, 6 Mar 2000 22:09:36 -0800
From: Jason Thorpe <thorpej@netbsd.org>
Return-path: thorpej@netbsd.org
<thorpej@netbsd.org>
Sender: thorpej@netbsd.org
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: "CAROSONE, Daniel" <dcarosone@westpac.com.au>
CC: Jason Thorpe <thorpej@netbsd.org>, "Erik E. Fair" <fair@clock.org>, NetBSD Lerts <security
***-alert@netbsd.org>,
NetBSD Release Engineers <releng@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Mon Mar 6 22:10:07 2000
Reply-To: Jason Thorpe <thorpej@netbsd.org>
X-Orcpt: rfc822;fair@clock.org
On Thu, 2 Mar 2000 11:45:37 +1100
"CAROSONE, Daniel" <dcarosone@westpac.com.au> wrote:
> Questions to help make it more informative and accurate:
> - is it only the timestamp option, or should I make the statement more
> general?
As far as I can tell, it's only the Timestamp option.
> - what can we add about other architectures? Is the gcc bug applicable to
> all of them?
> - do we know if the alignment fixes in 2.9x will address this?
> - do we want to provide more details of how the packets are malformed?
Well, if the option before the timestamp option is a length such that the
timestamp option will not be 4-byte aligned, that causes the problem.
> - please keep me up-to-date on what's happening with the compiler issue..
It turns out that it's not a compiler bug. It was a bug in the code; the
code was illegally casting an unaligned pointer to something which needed
more strict alignment, and this is disallowed by ANSI C.
I've suggested some rewording below.
> Dan.
>
> DRAFT
> NetBSD Security Advisory 2000-002
> =================================
>
> Topic: IP options processing Denial of Service
> Version: NetBSD 1.4.1 and prior; NetBSD-current until 200003xx
> Severity: Network-connected systems can be crashed remotely.
>
>
> Abstract
> ========
>
> Processing of IP packets with malfomed IP Timestamp options can cause
> a misaligned access in kernel space, resulting in a panic (on most
> architectures) or other problems.
Processing of IP packets with a certain sequence of malformed IP options
can cause an unaligned access in kernel mode, resulting in a panic (on
most architectures) or other problems.
> The problem is the result of a compiler optimisation bug, not a bug in
> the IP stack itself.
The problem is the the result of an interaction between an optimization that
GCC performs and a code fragment which violates ANSI C.
> Technical Details
> =================
>
> IP packets can contain optional processing directives, which must be
> processed both by the destination system of the packet, as well as by
> intermediate routers. These options can be malformed, if constructed
> maliciously. Tools to construct such packets are widely available and
> in common use.
>
> Due to a compiler problem, the NetBSD code to process certain IP
> options may generate misaligned accesses in kernel space, which will
> result in a panic (on most architectures). GCC is inlining calls to
> memcpy(), and optimising them to emit a load-store of the single
> 32-bit value, however it does not presently guarantee that both the
> source and destination are properly aligned before enabling this
> optimisation.
In the code fragment that processes the IP Timestamp option, an illegal
type cast is performed which violates the ANSI C standard. This interacts
poorly with an optimization that GCC performs on the code fragment; the
compiler is inlining a call to memcpy(), and, due to the illegal type cast,
is emitting a load-store of a single 32-bit value. This causes an
unaligned access. This unaligned access will result in a panic on most
architectures.
> This problem is known to produce alignment fault panics on the Alpha,
> SPARC, .... and ... architectures. On some architectures, for example
> the ARM, misaligned accesses do not produce faults; instead they
> produce incorrect data. These systems will not panic, but instead
> produce other problems, such as exhaustion of the mbuf cluster pool.
>
>
> Solutions and Workarounds
> =========================
>
> A patch is available for NetBSD 1.4.1, that works around the compiler
> problem by avoiding the optimisation path. It is located at:
A patch is available for NetBSD 1.4.1, that fixes the illegal type
cast. It is located at:
> ftp://ftp.NetBSD.ORG/pub/NetBSD/misc/security/patches/20000229-ipopts
>
> This patch will be included in the upcoming NetBSD 1.4.2 minor release.
>
> NetBSD-current since 200003xx also contains this workaround, and is
> not vulnerable. Users of NetBSD-current should upgrade to a source
> tree later than 200003xx.
NetBSD-current since 200003xx also contains this fix, and is not vulnerable.
Users of NetBSD-current should upgrade to a source tree later than 200003xx.
> The compiler problem must be fixed, because this issue may affect
> other NetBSD code. Alignment-related fixes in gcc-2.9x.xx may address
> this case, and investigation is underway to determine whether these
> fixes are appropriate and can be incorporated into the
> egcs-1.1.1-derived compiler currently used by NetBSD.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Delete this paragraph.
> Thanks To
> =========
>
> Matt Hargett and Erik Fair for discovering and reporting the problem.
> Jason Thorpe for analysing the problem and implementing the code
> change to work around the compiler for the 1.4.2 release, and
> pursuing the fix to the compiler for -current.
Matt Hargett and Erik Fair for discovering and reporting the problem.
Jason Thorpe for analysing the problem and implementing the fix.
> Revision History
> ================
>
> 2000/02/29 - initial version
>
> More Information
> ================
>
> Information about NetBSD and NetBSD security can be found at
> http://www.NetBSD.ORG/ and http://www.NetBSD.ORG/Security/.
>
>
> Copyright 2000, The NetBSD Foundation, Inc. All Rights Reserved.
>
> $NetBSD: NetBSD-SA2000-001.txt,v 1.3 2000/02/19 04:02:43 dan Exp $
>
-- Jason R. Thorpe <thorpej@netbsd.org>
MESSAGE netbsd/security:119
Date: Thu, 9 Mar 2000 02:17:51 -0800
From: Daniel Carosone <dan@geek.com.au>
Return-path: dan@geek.com.au
<dan@geek.com.au>
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: Jason Thorpe <thorpej@netbsd.org>
CC: "CAROSONE, Daniel" <dcarosone@westpac.com.au>, "Erik E. Fair" <fair@clock.org>, NetBSD Ler
***ts <security-alert@netbsd.org>,
NetBSD Release Engineers <releng@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Thu Mar 9 02:17:59 2000
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
In-Reply-To: <20000307060931.23581.qmail@mail.netbsd.org>
References: <20000307060931.23581.qmail@mail.netbsd.org>
X-Mailer: VM 6.72 under 21.1 (patch 6) "Big Bend" XEmacs Lucid
X-Orcpt: rfc822;fair@clock.org
Jason Thorpe writes:
> It turns out that it's not a compiler bug. It was a bug in the code; the
> code was illegally casting an unaligned pointer to something which needed
> more strict alignment, and this is disallowed by ANSI C.
>
> I've suggested some rewording below.
Thanks.. now, all I need to release the advisory is an official patch
against 1.4.1.. I'm guessing the patch might have changed?
--
Dan.
MESSAGE netbsd/security:120
Date: Thu, 9 Mar 2000 09:51:37 -0800
From: Jason R Thorpe <thorpej@shagadelic.org>
Return-path: thorpej@shagadelic.org
<thorpej@shagadelic.org>
Organization: Zembu Labs, Inc.
Subject: Re: IP options processing bug causes panic on alpha, sparc
To: Daniel Carosone <dan@geek.com.au>
CC: "CAROSONE, Daniel" <dcarosone@westpac.com.au>, "Erik E. Fair" <fair@clock.org>, NetBSD Ler
***ts <security-alert@netbsd.org>,
NetBSD Release Engineers <releng@netbsd.org>, Matt Hargett <matt@clock.org>
Delivery-Date: Thu Mar 9 09:51:47 2000
Reply-To: thorpej@shagadelic.org
References: <20000307060931.23581.qmail@mail.netbsd.org> <14535.31413.946790.516570@passion.geek.co
***m.au>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: Mutt 1.0.1us
In-Reply-To: <14535.31413.946790.516570@passion.geek.com.au>; from dan@geek.com.au on Thu, Mar 09,
***2000 at 09:19:33PM +1100
X-Orcpt: rfc822;fair@clock.org
On Thu, Mar 09, 2000 at 09:19:33PM +1100, Daniel Carosone wrote:
> Thanks.. now, all I need to release the advisory is an official patch
> against 1.4.1.. I'm guessing the patch might have changed?
No change required to the patch. It's been pulled up into 1.4.2, and
a cvs log on ip_input.c should point out the revision you need to generate
the patch.
--
-- Jason R. Thorpe <thorpej@shagadelic.org>
MESSAGE netbsd/security:121
Date: Fri, 10 Mar 2000 14:22:23 -0800
From: "Erik E. Fair" <fair@clock.org>
Return-path: fair@clock.org
<fair@clock.org>
Subject: Re: please try that attack against ip_input.c,v 1.106
To: Jason Thorpe <thorpej@nas.nasa.gov>
Delivery-Date: Fri Mar 10 14:22:46 2000
Mime-Version: 1.0
X-Sender: eef-play@pop.mercy.st.clock.org
In-Reply-To: <200003070540.VAA25869@lestat.nas.nasa.gov>
References: <200003070540.VAA25869@lestat.nas.nasa.gov>
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-Orcpt: rfc822;fair@clock.org
I tried the attack again. Boom. We need to revisit this one.
Erik
MESSAGE netbsd/security:122
Date: Fri, 10 Mar 2000 14:39:21 -0800
From: Jason R Thorpe <thorpej@shagadelic.org>
Return-path: thorpej@shagadelic.org
<thorpej@shagadelic.org>
Organization: Zembu Labs, Inc.
Subject: Re: please try that attack against ip_input.c,v 1.106
To: "Erik E. Fair" <fair@clock.org>
Delivery-Date: Fri Mar 10 14:39:27 2000
Reply-To: thorpej@shagadelic.org
References: <200003070540.VAA25869@lestat.nas.nasa.gov> <v04220812b4ef25fc7fa6@[216.240.40.194]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: Mutt 1.0.1us
In-Reply-To: <v04220812b4ef25fc7fa6@[216.240.40.194]>; from fair@clock.org on Fri, Mar 10, 2000 at
***02:22:16PM -0800
X-Orcpt: rfc822;fair@clock.org
On Fri, Mar 10, 2000 at 02:22:16PM -0800, Erik E. Fair wrote:
> I tried the attack again. Boom. We need to revisit this one.
Ok, try 1.107 then.
--
-- Jason R. Thorpe <thorpej@shagadelic.org>
MESSAGE netbsd/security:123
Date: Sat, 11 Mar 2000 20:30:34 -0800
From: "Erik E. Fair" <fair@clock.org>
Return-path: fair@clock.org
<fair@clock.org>
Subject: Re: please try that attack against ip_input.c,v 1.106
To: thorpej@shagadelic.org
Delivery-Date: Sat Mar 11 20:30:49 2000
Mime-Version: 1.0
X-Sender: eef-play@pop.mercy.st.clock.org
In-Reply-To: <20000310143510.L1280@dr-evil.nas.nasa.gov>
References: <200003070540.VAA25869@lestat.nas.nasa.gov>
<v04220812b4ef25fc7fa6@[216.240.40.194]>
<20000310143510.L1280@dr-evil.nas.nasa.gov>
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-Orcpt: rfc822;fair@clock.org
At 20:28 -0800 3/11/00, Jason R Thorpe wrote:
>On Fri, Mar 10, 2000 at 02:22:16PM -0800, Erik E. Fair wrote:
>
> > I tried the attack again. Boom. We need to revisit this one.
>
>Ok, try 1.107 then.
# WARNING: mclpool limit reached; increase NMBCLUSTERS
netstat -m
0 mbufs in use:
0/0 mapped pages in use
0 Kbytes allocated to network (0% in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to protocol drain routines
# WARNING: mclpool limit reached; increase NMBCLUSTERS
fatal kernel trap:
trap entry = 0x4 (unaligned access fault)
a0 = 0xfffffc0002d2f02a
a1 = 0x28
a2 = 0x4
pc = 0xfffffc00003c2660
ra = 0xfffffc00003c0c10
curproc = 0x0
panic: trap
Stopped at cpu_Debugger+0x4: ret zero,(ra)
db> tr
cpu_Debugger() at cpu_Debugger+0x4
panic() at panic+0xe4
trap() at trap+0x51c
XentUna() at XentUna+0x20
--- unaligned access fault (from ipl 1) ---
ip_dooptions() at ip_dooptions+0x4c0
ip_input() at ip_input+0x3d0
ipintr() at ipintr+0x94
netintr() at netintr+0x90
do_sir() at do_sir+0x34
esigcode() at esigcode+0x80
prologue botch: displacement 216
--- root of call graph ---
db>
MESSAGE netbsd/security:124
Date: Sat, 11 Mar 2000 22:38:40 -0800
From: Jason R Thorpe <thorpej@shagadelic.org>
Return-path: thorpej@shagadelic.org
<thorpej@shagadelic.org>
Organization: Zembu Labs, Inc.
Subject: Re: please try that attack against ip_input.c,v 1.106
To: "Erik E. Fair" <fair@clock.org>
Delivery-Date: Sat Mar 11 22:38:50 2000
Reply-To: thorpej@shagadelic.org
References: <200003070540.VAA25869@lestat.nas.nasa.gov> <v04220812b4ef25fc7fa6@[216.240.40.194]> <2
***0000310143510.L1280@dr-evil.nas.nasa.gov> <v04220815b4f0cdd03397@[216.240.40.194]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Mailer: Mutt 1.0.1us
In-Reply-To: <v04220815b4f0cdd03397@[216.240.40.194]>; from fair@clock.org on Sat, Mar 11, 2000 at
***08:30:22PM -0800
X-Orcpt: rfc822;fair@clock.org
On Sat, Mar 11, 2000 at 08:30:22PM -0800, Erik E. Fair wrote:
> panic: trap
> Stopped at cpu_Debugger+0x4: ret zero,(ra)
> db> tr
> cpu_Debugger() at cpu_Debugger+0x4
> panic() at panic+0xe4
> trap() at trap+0x51c
> XentUna() at XentUna+0x20
> --- unaligned access fault (from ipl 1) ---
> ip_dooptions() at ip_dooptions+0x4c0
gdb> list *(ip_dooptions + 0x4c0)
Please tell me you build kernels with full debugging symbols :-)
--
-- Jason R. Thorpe <thorpej@shagadelic.org>
MESSAGE netbsd/security:125
Date: Sun, 12 Mar 2000 00:39:25 -0800
From: "Erik E. Fair" <fair@clock.org>
Return-path: fair@clock.org
<fair@clock.org>
Subject: Re: please try that attack against ip_input.c,v 1.106
To: thorpej@shagadelic.org
Delivery-Date: Sun Mar 12 00:39:33 2000
Mime-Version: 1.0
X-Sender: eef-play@pop.mercy.st.clock.org
In-Reply-To: <20000311223444.B1173@dhcp0.wlan.shagadelic.org>
References: <200003070540.VAA25869@lestat.nas.nasa.gov>
<v04220812b4ef25fc7fa6@[216.240.40.194]>
<20000310143510.L1280@dr-evil.nas.nasa.gov>
<v04220815b4f0cdd03397@[216.240.40.194]>
<20000311223444.B1173@dhcp0.wlan.shagadelic.org>
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
X-Orcpt: rfc822;fair@clock.org
I do, now...
# date
Sun Mar 12 00:01:23 PST 2000
# WARNING: mclpool limit reached; increase NMBCLUSTERS
WARNING: mclpool limit reached; increase NMBCLUSTERS
WARNING: mclpool limit reached; increase NMBCLUSTERS
WARNING: mclpool limit reached; increase NMBCLUSTERS
WARNING: mclpool limit reached; increase NMBCLUSTERS
date
Sun Mar 12 00:06:32 PST 2000
# WARNING: mclpool limit reached; increase NMBCLUSTERS
fatal kernel trap:
trap entry = 0x4 (unaligned access fault)
a0 = 0xfffffc00032a502a
a1 = 0x28
a2 = 0x4
pc = 0xfffffc00003c3ec0
ra = 0xfffffc00003c2470
curproc = 0x0
panic: trap
Stopped at cpu_Debugger+0x4: ret zero,(ra)
db> tr
cpu_Debugger() at cpu_Debugger+0x4
panic() at panic+0xe4
trap() at trap+0x528
XentUna() at XentUna+0x20
--- unaligned access fault (from ipl 1) ---
ip_dooptions() at ip_dooptions+0x4c0
ip_input() at ip_input+0x3d0
ipintr() at ipintr+0x94
netintr() at netintr+0x90
do_sir() at do_sir+0x34
esigcode() at esigcode+0x80
prologue botch: displacement 216
--- root of call graph ---
db>
# cd /usr/obj/sys/arch/alpha/compile/PC164
# gdb netbsd.gdb
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "alpha--netbsd"...
(gdb) list *(ip_dooptions + 0x4c0)
0xfffffc00003c3ec0 is in ip_dooptions (/sys/netinet/ip_input.c:1074).
1069 (caddr_t)(cp + off),
sizeof(struct in_addr))
;
1070 cp[IPOPT_OFFSET] += sizeof(struct in_addr);
1071 break;
1072
1073 case IPOPT_TS:
1074 code = cp - (u_char *)ip;
1075 ipt = (struct ip_timestamp *)cp;
1076 if (ipt->ipt_len < 5)
1077 goto bad;
1078 if (ipt->ipt_ptr > ipt->ipt_len -
sizeof (int32_
t)) {
(gdb)
From: Bill Sommerfeld <sommerfeld@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: security/10004: IP options processing bug causes panic on alpha, sparc
Date: Fri, 28 Apr 2000 10:52:33 -0400
[resend of message sent to thorpej and fair]
The specific issue on alpha appears to be that the compiler makes
assumptions about the alignment of struct ip_timestamp because the
component "ipt_timestamp" field (which does not appear to be used by
anything) is aligned based on its "n_time ipt_time[1]" field.
The compiler then combines the byte fetches for the ipt_len, ipt_ptr,
and ipt_oflw fields into a single aligned 32-bit load, which falls
over when the option isn't aligned.
Note that this does not show up if you compile with target options
which select use of the BWX extensions (since the compiler just
generates byte loads in this case instead).
it looks a fix to this problem may be:
RCS file: /cvsroot/syssrc/sys/netinet/ip.h,v
retrieving revision 1.20
diff -u -r1.20 ip.h
--- ip.h 1999/11/20 00:37:59 1.20
+++ ip.h 2000/04/28 12:06:33
@@ -148,7 +148,7 @@
struct in_addr ipt_addr;
n_time ipt_time;
} ipt_ta[1] __attribute__((__packed__));
- } ipt_timestamp /* XXX __attribute__((__packed__)) ??? */;
+ } ipt_timestamp __attribute__((__packed__));
};
/* flag bits for ipt_flg */
As I don't have the time at this instant to set up the test case
myself, any belief that that is correct is based purely on inspecting
compiler output and reading up on byte ops in the alpha architecture
manual (with the patch, the compiler generates ldq_u/extbl pairs).
Erik: can you test this ASAP and get back to
security-officer@netbsd.org? Thanks.
- Bill
State-Changed-From-To: open->feedback
State-Changed-By: fair
State-Changed-When: Fri May 5 02:52:05 PDT 2000
State-Changed-Why:
A fix has been tested and committed, and pulled up to the release branch.
State-Changed-From-To: feedback->closed
State-Changed-By: fair
State-Changed-When: Tue May 16 12:04:21 PDT 2000
State-Changed-Why:
I think we've put this one to bed...
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.