From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 30 Nov 2017 10:41:29 +1100 (AEDT) From: James Morris To: Eric Dumazet cc: Eric Dumazet , Stephen Smalley , Paul Moore , netdev , selinux@tycho.nsa.gov In-Reply-To: <1511995754.16595.27.camel@gmail.com> Message-ID: References: <1511976706.10464.19.camel@tycho.nsa.gov> <1511985547.10464.22.camel@tycho.nsa.gov> <1511995754.16595.27.camel@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323328-1073903225-1511998893=:16533" Subject: Re: [BUG] kernel stack corruption during/after Netlabel error List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: --8323328-1073903225-1511998893=:16533 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 29 Nov 2017, Eric Dumazet wrote: > On Wed, 2017-11-29 at 12:23 -0800, Eric Dumazet wrote: > >=20 > > I suspect this exposes an ancient bug, caused by fact that TCP moves > > IP[6]CB in skb->cb[] > >=20 > > Basically the 2nd tcp_filter() added in commit > > 8fac365f63c866a00015fa13932d8ffc584518b8 > > ("tcp: Add a tcp_filter hook before handle ack packet") was not > > expecting selinux code being called a 2nd time, > > while skb->cb[] has been mangled [1] > >=20 > > [1] > > memmove(&TCP_SKB_CB(skb)->header.h4, IPCB(skb), > > =C2=A0=C2=A0=C2=A0=C2=A0sizeof(struct inet_skb_parm)); >=20 > Please try this fix for IPv4 (a similar patch will be needed for IPv6) >=20 > net/ipv4/tcp_ipv4.c | 51 ++++++++++++++++++++++++++---------------- > 1 file changed, 32 insertions(+), 19 deletions(-) Works for me, no crashes with the testsuite running in a loop. Tested-by: James Morris --=20 James Morris --8323328-1073903225-1511998893=:16533--