lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 27 May 2008 15:01:44 +0400
From:	Evgeniy Polyakov <johnpol@....mipt.ru>
To:	Octavian Purdila <opurdila@...acom.com>
Cc:	netdev@...r.kernel.org
Subject: Re: race in skb_splice_bits?

On Tue, May 27, 2008 at 03:25:23AM +0300, Octavian Purdila (opurdila@...acom.com) wrote:
> 
> Hi,
> 
> The following socket lock dropping in skb_splice_bits seems to open a race 
> condition which causes an invalid kernel access:
> 
> >        if (spd.nr_pages) {
> >                int ret;
> >
> >                /*                                                                                                                            
> >                 * Drop the socket lock, otherwise we have reverse                                                                            
> >                 * locking dependencies between sk_lock and i_mutex                                                                           
> >                 * here as compared to sendfile(). We enter here                                                                              
> >                 * with the socket lock held, and splice_to_pipe() will                                                                       
> >                 * grab the pipe inode lock. For sendfile() emulation,                                                                        
> >                 * we call into ->sendpage() with the i_mutex lock held                                                                       
> >                 * and networking will grab the socket lock.                                                                                  
> >                 */

What about sock_hold() here?
It will prevent from socket freeing and read/write to it will
immediately return with error if socket was closed by another thread.

> >                release_sock(__skb->sk);                                                                                                    
> >                ret = splice_to_pipe(pipe, &spd);
> >                lock_sock(__skb->sk);

And appropriate sock_put(sk);

-- 
	Evgeniy Polyakov
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ