[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1290761951.2855.33.camel@edumazet-laptop>
Date: Fri, 26 Nov 2010 09:59:11 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: Shan Wei <shanwei@...fujitsu.com>
Cc: Марк Коренберг
<socketpair@...il.com>, David Miller <davem@...emloft.net>,
netdev@...r.kernel.org
Subject: Re: Fwd: Simple kernel attack using socketpair. easy, 100%
reproductiblle, works under guest. no way to protect :(
Le vendredi 26 novembre 2010 à 09:22 +0100, Eric Dumazet a écrit :
> Le vendredi 26 novembre 2010 à 15:41 +0800, Shan Wei a écrit :
> > Eric Dumazet wrote, at 11/25/2010 10:11 PM:
> > > @@ -1845,6 +1871,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
> > > unix_state_lock(sk);
> > > skb = skb_dequeue(&sk->sk_receive_queue);
> > > if (skb == NULL) {
> > > + unix_sk(sk)->recursion_level = 0;
> >
> > For SOCK_SEQPACKET type, no need to clear recursion_level counter?
> >
> >
>
> There is no need actually to clear it at all.
>
> If an application has a complex setup with a dependence tree of unix
> sockets, it will break if messages are not read fast enough.
>
> So, maybe I should remove this line so that underlying problem comes
> into surface immediately, rather than while in stress load.
>
>
The whole sendfd feature is fundamentally flawed, since its not a "give
this file to another user", but "give a pointer to file structure"
As soon as you can pass af_unix sockets, you cannot know if the
intransit "refs to file structure" are going to be consumed by one or
other user. So a per user limit is not possible.
I am not sure it is fixable at all, unless adding a complete graph
structure between af_unix sockets that used the sendfd() mechanism.
(Its a NxN relationship... pretty hard to track)
Yes, we can add limits (global wide), but they could break legacy apps,
and a single user could lock in one fd all the tokens.
--
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