Thread (18 messages) flat view 18 messages, 4 authors, 2011-05-06

Re: [RFC v3 01/10] lsm: add security_socket_closed()

From: Samir Bellabes <hidden>
Date: 2011-05-06 13:45:27

Tetsuo Handa [off-list ref] writes:
Samir Bellabes wrote:
quoted
Allow a module to update security informations when a socket is closed.
Is security_inode_free() too late for doing it?

static void ccs_inode_free_security(struct inode *inode)
{
        if (inode->i_sb && inode->i_sb->s_magic == SOCKFS_MAGIC)
                ccs_update_socket_tag(inode, 0);
}
this point won't be possible.
security_inode_free() is occuring too late :

static int sock_close(struct inode *inode, struct file *filp)
{
        security_socket_close(SOCKET_I(inode)); 
           ... ->  acces sock->sk infos in this hook

        sock_release(SOCKET_I(inode));
        {
                sock->ops->release(sock);
                {
                        int inet_release(struct socket *sock)
                        {
                                struct sock *sk = sock->sk;

                                if (sk) {
                                sock_rps_reset_flow(sk);
                                sock->sk = NULL;
                                sk->sk_prot->close(sk, timeout);
                                 --> here sk infos are now removed
                        }
                }
                if (!sock->file) {
                   iput(SOCK_INODE(sock));
                --> here we are removing the inode, so
                    security_inode_free is called now, but too late.
                }
        }
}

        return 0;
}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help