Subject: Re: [RFC 0/9] snet: Security for NETwork syscalls

From: "Serge E. Hallyn" <[email-masked]>
Date: Tue, 5 Jan 2010 08:09:17 -0600

Quoting Tetsuo Handa ([email-masked]):
> Samir Bellabes wrote:
> > I'm currently testing security_sock_rcv_skb() hook - which is inside
> > sk_filter() - to get skbuffs when then are arriving, and so trying to
> > push the buffer to userspace. In case this is not userfull, userspace
> > is able to use the NFQUEUE of netfilter to get skbuff, and deal
> > with incoming datas.
> 
> Pushing buffer to userspace and wait for userspace's decision will sleep.
> sk_filter() which calls security_sock_rcv_skb() hook is called from
> (e.g.) tcp_v6_do_rcv() and comment of tcp_v6_do_rcv() says that
> "The socket must have it's spinlock held when we get here." 
> Also, comment of rxrpc_queue_rcv_skb() says that
> "the caller must hold a lock on call->lock".
> I think it is not permitted to do sleeping operation inside
> security_sock_rcv_skb().

Ah, there it is, thanks for finding a specific instance.  I'd looked
a bit yesterday but couldn't find it.

Tetsuo, would you mind sending a patch to add a note to security.h's
comment for socket_sock_rcv_skb: that it can't sleep?  It also used
to be the case for security_task_free() which presumably would be
hooked by the ssyscall or whatever was mentioned.

thanks,
-serge