[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 09 Sep 2011 08:51:40 +0200
From: Eric Dumazet <eric.dumazet@...il.com>
To: Tim Chen <tim.c.chen@...ux.intel.com>
Cc: sedat.dilek@...il.com, "Yan, Zheng" <zheng.z.yan@...el.com>,
"Yan, Zheng" <yanzheng@...n.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"davem@...emloft.net" <davem@...emloft.net>,
"sfr@...b.auug.org.au" <sfr@...b.auug.org.au>,
"jirislaby@...il.com" <jirislaby@...il.com>,
"Shi, Alex" <alex.shi@...el.com>,
Valdis Kletnieks <Valdis.Kletnieks@...edu>
Subject: Re: [PATCH net-next v3] af_unix: Fix use-after-free crashes
Le jeudi 08 septembre 2011 à 01:37 -0700, Tim Chen a écrit :
> On Thu, 2011-09-08 at 15:21 +0200, Eric Dumazet wrote:
> > Le jeudi 08 septembre 2011 à 11:59 +0200, Sedat Dilek a écrit :
> >
> > > I have tested this fixup patch on i386.
> > > Can we have a separate patch with corrected descriptive text?
> > >
> > > Thanks to all involved people.
> >
> > Here it is :
> >
> > [PATCH net-next v3] af_unix: Fix use-after-free crashes
> >
> > Commit 0856a30409 (Scm: Remove unnecessary pid & credential references
> > in Unix socket's send and receive path) introduced an use-after-free
> > bug.
> >
> > We are allowed to steal the references to pid/cred only in the last skb
> > sent from unix_stream_sendmsg(), because first skbs might be consumed by
> > the receiver before we finish our sendmsg() call.
> >
> > Remove scm_release() helper, since its cleaner to clear pid/cred fields
> > in unix_scm_to_skb() when we steal them.
> >
> > Based on prior patches from Yan Zheng and Tim Chen
> >
> > Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
> > Reported-by: Jiri Slaby <jirislaby@...il.com>
> > Tested-by: Sedat Dilek <sedat.dilek@...glemail.com>
> > Tested-by: Valdis Kletnieks <Valdis.Kletnieks@...edu>
> > ---
>
> Thanks.
>
> Acked-by: Tim Chen <tim.c.chen@...ux.intel.com>
>
Now we have to fix a bug in unix_stream_recvmsg() as well.
consume_skb() call actually releases pid/cred references, and we can use
them after their eventual freeing.
Keep also in mind that receiver can provides a too short user buffer,
and skb can be put back to head of sk_receive_queue
Tim, your 0856a304091b33 commit introduced a lot of bugs, I was right
asking a revert.
If we revert your patch, my litle patch (af_unix: dont send
SCM_CREDENTIALS by default) is enough to solve performance problems.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists