linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Garzarella <sgarzare@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, kuba@kernel.org
Subject: Re: [PATCH 00/10] RFC: SO_PEERCRED for AF_VSOCK
Date: Thu, 21 Oct 2021 15:34:25 +0200	[thread overview]
Message-ID: <20211021133425.tfgntfq6tq6em6up@steredhat> (raw)
In-Reply-To: <20211021123714.1125384-1-marcandre.lureau@redhat.com>

Hi,

On Thu, Oct 21, 2021 at 04:37:04PM +0400, Marc-André Lureau wrote:
>Hi,
>
>This RFC aims to implement some support for SO_PEERCRED with AF_VSOCK,
>so vsock servers & clients can lookup the basic peer credentials.
>(further support for SO_PEERSEC could also be useful)

Thanks for this RFC! Just had a quick look, Monday I hope to give you 
better feedback :-)

>
>This is pretty straightforward for loopback transport, where both ends
>are on the same host.
>
>For vhost transport, the host will set the peer credentials associated with
>the process who called VHOST_SET_OWNER (ex QEMU).
>
>For virtio transport, the credentials are cleared upon connect, as
>providing foreign credentials wouldn't make much sense.
>
>I haven't looked at other transports. What do you think of this 
>approach?

So IIUC, SO_PEERCRED will make sense only in the host and will return 
the credentials of the VMM (e.g. QEMU) that manages the VM of the peer 
to which we are connected.

So the features should be supported by the following type of transports:
- VSOCK_TRANSPORT_F_LOCAL (vsock_loopback)
- VSOCK_TRANSPORT_F_H2G (vhost-vsock, vmci)

>
>Note: I think it would be a better to set the peer credentials when we
>actually can provide them, rather than at creation time, but I haven't
>found a way yet. Help welcome!

Yep, I agree, cleaning credentials after connecting in the guest seems a 
bit strange.
As you also said, would be better to set them only after a successful 
connect(), which should be similar to what AF_UNIX does.

Maybe we can add an helper in af_vsock.c that will be called from the 
transports that support this feature at the end the connection setup.

I'll think better of it and get back to you.

Thanks,
Stefano


      parent reply	other threads:[~2021-10-21 13:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 12:37 [PATCH 00/10] RFC: SO_PEERCRED for AF_VSOCK Marc-André Lureau
2021-10-21 12:37 ` [PATCH 01/10] sock: move sock_init_peercred() from af_unix Marc-André Lureau
2021-10-21 12:37 ` [PATCH 02/10] sock: move sock_copy_peercred() " Marc-André Lureau
2021-10-21 12:37 ` [PATCH 03/10] vsock: owner field is specific to VMCI Marc-André Lureau
2021-10-26 11:16   ` Stefano Garzarella
2021-10-27  8:13     ` Jorgen Hansen
2021-11-05  8:21       ` Marc-André Lureau
2021-10-21 12:37 ` [PATCH 04/10] sock: add sock_swap_peercred Marc-André Lureau
2021-10-21 12:37 ` [PATCH 05/10] virtio/vsock: add copy_peercred() to virtio_transport Marc-André Lureau
2021-10-26 11:17   ` Stefano Garzarella
2021-10-21 12:37 ` [PATCH 06/10] vsock: set socket peercred Marc-André Lureau
2021-10-26 11:18   ` Stefano Garzarella
2021-10-21 12:37 ` [PATCH 07/10] vsock/loopback: implement copy_peercred() Marc-André Lureau
2021-10-26 11:18   ` Stefano Garzarella
2021-10-21 12:37 ` [PATCH 08/10] vhost/vsock: save owner pid & creds Marc-André Lureau
2021-10-21 12:37 ` [PATCH 09/10] vhost/vsock: implement copy_peercred Marc-André Lureau
2021-10-21 12:37 ` [PATCH 10/10] vsock/virtio: clear peer creds on connect Marc-André Lureau
2021-10-21 13:34 ` Stefano Garzarella [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211021133425.tfgntfq6tq6em6up@steredhat \
    --to=sgarzare@redhat.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcandre.lureau@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).