[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT/LWIP PATCH 7/8] sockets.c: Refuse to deal with non-sockets



Hi Florian,

Looks good, thanks.

-- Felipe

Reviewed-by: Felipe Huici <felipe.huici@xxxxxxxxx>

============================================================
Dr. Felipe Huici
Chief Researcher, Systems and Machine Learning Group
NEC Laboratories Europe GmbH
Kurfuerstenanlage 36, D-69115 Heidelberg
Tel.  +49
(0)6221 4342-241
Fax:  +49
(0)6221 4342-155
 
e-mail:
felipe.huici@xxxxxxxxx
============================================================
Registered at Amtsgericht Mannheim, Germany, HRB728558

On 20.05.19, 13:30, "Minios-devel on behalf of Florian Schmidt" 
<minios-devel-bounces@xxxxxxxxxxxxxxxxxxxx on behalf of 
florian.schmidt@xxxxxxxxx> wrote:

    Otherwise, socket_net_file_get() will try to look up lwip's file
    descriptors for file objects not created by lwip, reading garbage from
    where it expects sock_fd in sock_net_file.
    
    Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
    ---
     sockets.c | 7 +++++++
     1 file changed, 7 insertions(+)
    
    diff --git a/sockets.c b/sockets.c
    index 0cf22de..7f4b6f3 100644
    --- a/sockets.c
    +++ b/sockets.c
    @@ -65,6 +65,12 @@ static inline struct sock_net_file 
*sock_net_file_get(int fd)
                file = ERR2PTR(-EINVAL);
                goto EXIT;
        }
    +   if (fos->f_dentry->d_vnode->v_type != VSOCK) {
    +           LWIP_DEBUGF(SOCKETS_DEBUG,
    +                       ("file descriptor is not a socket\n"));
    +           file = ERR2PTR(-EBADF);
    +           goto EXIT;
    +   }
        file = __containerof(fos, struct sock_net_file, vfscore_file);
     EXIT:
        return file;
    @@ -122,6 +128,7 @@ static int sock_fd_alloc(struct vnops *v_op, int 
sock_fd)
        uk_mutex_init(&s_vnode->v_lock);
        s_vnode->v_refcnt = 1;
        s_vnode->v_data = file;
    +   s_vnode->v_type = VSOCK;
     
        file->sock_fd = sock_fd;
        LWIP_DEBUGF(SOCKETS_DEBUG, ("Allocated socket %d (%x)\n",
    -- 
    2.21.0
    
    
    _______________________________________________
    Minios-devel mailing list
    Minios-devel@xxxxxxxxxxxxxxxxxxxx
    https://lists.xenproject.org/mailman/listinfo/minios-devel

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.