Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1402767pxb; Tue, 26 Oct 2021 08:24:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNjT2wHJJlP39h7+gpqdvnjuOD+KejVVMhSx8Y0cw2LcLtANRxC37u7DCOB8VBaIoB5R5u X-Received: by 2002:a62:be18:0:b0:47b:baa6:fcfc with SMTP id l24-20020a62be18000000b0047bbaa6fcfcmr25834527pff.35.1635261871533; Tue, 26 Oct 2021 08:24:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635261871; cv=none; d=google.com; s=arc-20160816; b=QeTJWAo10NPqsVrmF9mrXAdtuAM4GLJ/z2legLreUm46bCVMpCcYVtS5Ig/KTyX0fs XNL7s4IZNuexLjcmhOPJEYMnGajhA4EIr+wdaUnctd1FJDN7pibiCDbUN1BOaOcXmyrt 3twYym9BjX2O1vC2G8fTnQSdJ7HBHhJ+zC/1QP/N1OVifqbMMrIq7C+R/Ut2FGPVWlu9 nZcT5gNpNMycWE8h+9lLkK7M/Ud319zh/760AwXGg6lA0DwQpnGKRAQ+2OHbB/qNuP8N lLmavGCiCQhD0V1qa8X2gGkjz1/Wy8yR6vxHWlp6CRT56ilS8QCkn2mFPDkouSx2di+r xm8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6TpfncIbRN2wIiXvPAEkb8bm0utZs2Zbi5cSQ14Wg50=; b=BjuevooyM09j51NU8B1jOPvbLrA9WphikSjzH6nEZSCVHpCZMUTun5QuIdLmgTl2qS R1NlcD0E7Hp8QpK96J2lCPN00VC6Sd12ypr+hPd+es4CD5fcu7DRuOWrKyBMn1yqVzt9 RpViG0Qz5dNywuEaFtSH2goKbb9H5kIomZ7HLxJRKkscO0utDZWqF016XxbVniWoF6KW PWd9g3amX1tdnQRu4D+KPNHFfIaM7M27MIFkNrAD9vrwhnj2jWJLzrm/SonVrf67ipin wpZbanhu/7l1xlW4/SIupSpoMn7zTjzZ3kdn9Y4wx97upOJlQPBaX84DTGDCu5m1FVMx 5Dhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c4qL+8cD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pi11si1578238pjb.76.2021.10.26.08.23.54; Tue, 26 Oct 2021 08:24:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=c4qL+8cD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235488AbhJZLUH (ORCPT + 99 others); Tue, 26 Oct 2021 07:20:07 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:59892 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235470AbhJZLUG (ORCPT ); Tue, 26 Oct 2021 07:20:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635247062; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6TpfncIbRN2wIiXvPAEkb8bm0utZs2Zbi5cSQ14Wg50=; b=c4qL+8cDE+a+2ZFwRH8D0uluY1IsZ5AqA0aofw0AUb5Kp/rxIHRvgQmAzhQAb8FVICv3pd iM5ScFgAMBZZMUVIbcYvQdycDc+VEMONqgxwH8ZNOlaiIT+mnntHeG+Z4uqLAReAtGO1m3 K65hzH4AJyJqUX0brXi1T5Nj8deHRAs= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-428-nTAy5oKiPQGjVHKMyw2x4g-1; Tue, 26 Oct 2021 07:17:41 -0400 X-MC-Unique: nTAy5oKiPQGjVHKMyw2x4g-1 Received: by mail-ed1-f69.google.com with SMTP id m16-20020a056402431000b003dd2005af01so622894edc.5 for ; Tue, 26 Oct 2021 04:17:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=6TpfncIbRN2wIiXvPAEkb8bm0utZs2Zbi5cSQ14Wg50=; b=AnDqy40jCdRadvXny9UR2JFJkkllQq3u9u53MkazBfhSSrwf/UegPiepV6zA0LdHlP vI1BbPZwN9bCwNplomApLjwIz4y3yfhSNzOfUonwMeypWVNJNjIwN3V3RGv5rYCzBvdv vZIRSxR5JG164ci6PiPuFvho1EqNf74kf6v8/ZBT/UEFT5rT2ASTpXBhSUTWlRyLT0/7 h1yJccyxgw/0gcqqforpy+ND920+tz3J/4lJJ2a/D0Y8ZFKaP1lVpa/+wBdzAWs0ryLS b9Cn8PH/NbPfO0QFnx/ZjDzKiurS42LeLQZ522ZloCqohd/M9schsSKZlgX3YS+YK3kP ggRA== X-Gm-Message-State: AOAM533a/tiIz4Cx0t4V+L4fRxdxiavqoVtIkDqdKaHa/BT+Da0tO6A5 R4xWsq6bL//t89RHq6NmteHmwHoOBaiSEDTmlRK5giTL9QI7DsmwCezv27I7GY9pzKjDclCw5uT is6ryY/S2S5TTlOL4uoEJyv1X X-Received: by 2002:a17:906:a08d:: with SMTP id q13mr29939026ejy.465.1635247060106; Tue, 26 Oct 2021 04:17:40 -0700 (PDT) X-Received: by 2002:a17:906:a08d:: with SMTP id q13mr29939009ejy.465.1635247059966; Tue, 26 Oct 2021 04:17:39 -0700 (PDT) Received: from steredhat (host-79-30-88-77.retail.telecomitalia.it. [79.30.88.77]) by smtp.gmail.com with ESMTPSA id p23sm11379803edw.94.2021.10.26.04.17.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 04:17:39 -0700 (PDT) Date: Tue, 26 Oct 2021 13:17:37 +0200 From: Stefano Garzarella To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, kuba@kernel.org Subject: Re: [PATCH 05/10] virtio/vsock: add copy_peercred() to virtio_transport Message-ID: <20211026111737.eyzvbthmc7h3em5z@steredhat> References: <20211021123714.1125384-1-marcandre.lureau@redhat.com> <20211021123714.1125384-6-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211021123714.1125384-6-marcandre.lureau@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 04:37:09PM +0400, Marc-Andr? Lureau wrote: >Signed-off-by: Marc-Andr? Lureau >--- > include/linux/virtio_vsock.h | 2 ++ > net/vmw_vsock/virtio_transport_common.c | 9 +++++++++ > 2 files changed, 11 insertions(+) > >diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h >index 35d7eedb5e8e..2445bece9216 100644 >--- a/include/linux/virtio_vsock.h >+++ b/include/linux/virtio_vsock.h >@@ -69,6 +69,8 @@ struct virtio_transport { > > /* Takes ownership of the packet */ > int (*send_pkt)(struct virtio_vsock_pkt *pkt); >+ /* Set peercreds on socket created after listen recv */ >+ void (*copy_peercred)(struct sock *sk, struct virtio_vsock_pkt *pkt); > }; > > ssize_t >diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c >index 59ee1be5a6dd..611d25e80723 100644 >--- a/net/vmw_vsock/virtio_transport_common.c >+++ b/net/vmw_vsock/virtio_transport_common.c >@@ -1194,6 +1194,15 @@ virtio_transport_recv_listen(struct sock *sk, struct virtio_vsock_pkt *pkt, > return -ENOMEM; > } > >+ if (t->copy_peercred) { >+ t->copy_peercred(child, pkt); >+ } else { >+ put_pid(child->sk_peer_pid); >+ child->sk_peer_pid = NULL; >+ put_cred(child->sk_peer_cred); >+ child->sk_peer_cred = NULL; >+ } >+ Should we do the same also on the other side? I mean in virtio_transport_recv_connecting() when VIRTIO_VSOCK_OP_RESPONSE is received. I think we can add an helper and call it every time we call vsock_insert_connected(). Even better if we can do it in the core, but maybe this can be a next step. Thanks, Stefano