Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1388378pxb; Tue, 26 Oct 2021 08:09:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKafNvQc1o1CmIcEajZWAL+x9YMcBHEqQ7Ndb+QBTv6ch1DagSfvBGUsqgGnQJjdSIqYAv X-Received: by 2002:a17:906:c186:: with SMTP id g6mr30716709ejz.259.1635260979433; Tue, 26 Oct 2021 08:09:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635260979; cv=none; d=google.com; s=arc-20160816; b=sNq3AAz5l0NFotI9RdFl4rwcBztiQMEBuZedkKHM/Gml/S0RL8kP8mlT0VFSdv6MB9 +8Ml2v9XUpYxYWPiymvJALMPln5vSQPL1Kmh8pAG1uSbS7BtCZDR+E4SrukOIK54FEGC DXcho2ISLGQ5TOvkDicJcJ5mqHDYywqtPb3t+MbF+DGRPEBRSEmk4KHOu5WnUIXA4Io0 KCviF4UXjYXjk4B9GWQA/lmnONUNIFP0i8P9QydnV8hNLW/iPSBamQYE3hnwXJPxuYeR x2KFof2Ixa20xm8AA/tAUH99F5NZHrrk8MWLnthi33ojDOo0+tgWCGTCHGk/TDbWUGfk lyEw== 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=gM1+OP3lV+p8AGHiQhCemg7WeEVqw72uF3wN2Z65I9w=; b=m76lNerjHbPOGMEKo39qyMxUh9Ti1oE/ZfcAMkQW9jskXL8w4TRuASQClnevusC0xx urWj0lXNA+BikIMRP58LAlIYhxCS2AXtuuhbd7KCV9/xXdTQeHeckLdx6dMUXgrg+97T 0Ci5aRb5+7cIz4FCS3LXYDp0t53fx2bP2pYjONznv7Lhr8SPw4dyp64Pa7Wk2VxSSmwC O+yle3P8lS+KH9knbnKMV5z7MSDZh2t5c+WQutJ8hFv5ejk4jopn0OcgPKlr/eTdR+mM +P2otid4hp+Eh4SqX413rJgP/lS6rOfFBs4Ks32NLjrZA5ftc5v9feIiFiHmb4bTpxH/ GtCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="fHgQ9/zK"; 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 c9si38278050ede.428.2021.10.26.08.08.43; Tue, 26 Oct 2021 08:09:39 -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="fHgQ9/zK"; 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 S233778AbhJZLTS (ORCPT + 99 others); Tue, 26 Oct 2021 07:19:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:36324 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233252AbhJZLTR (ORCPT ); Tue, 26 Oct 2021 07:19:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635247012; 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=gM1+OP3lV+p8AGHiQhCemg7WeEVqw72uF3wN2Z65I9w=; b=fHgQ9/zKHlHatI7P8S4I/9wXakqMMvJc7Th6429mGM7OIQUqM0baFcBq4TZdWWEwP85PRE aO6lX9cYcGReSmt4Hwfj6v9GF5lzd/Qb0yknfSVw+O6pJ/CkEQ9Zi1Y/pyVq0AsVex+BtP TctyEQPuU0lfNbkF5hKAoCqSM6yA8kc= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-82-K8Ng0rjCPTmZ7aPplzSokg-1; Tue, 26 Oct 2021 07:16:51 -0400 X-MC-Unique: K8Ng0rjCPTmZ7aPplzSokg-1 Received: by mail-ed1-f72.google.com with SMTP id x13-20020a05640226cd00b003dd4720703bso6766344edd.8 for ; Tue, 26 Oct 2021 04:16:51 -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=gM1+OP3lV+p8AGHiQhCemg7WeEVqw72uF3wN2Z65I9w=; b=36xvNHyCcnXCiSuZtdpJxcthVpu1/v0pLQGtRGxYIjH+6T23NAfJbtomt3g5ozZbAL ilmztJcgo6sFldP62+fZhtWyGY/0qZb3qixdfhazKspvGUVuFVIQYCoaxQ5GnH8Ll+W1 isrHWuKtE75cQOnDqvDX0bXVZj0DDDg5pCwcauXBA0VkTnhFfYS8mdikrHz0zxzuuNY0 naGaAdtnM9y2C3iJWX/7C9kFKxSGoDvAWYaLu+W4aMcAyD345y6cyNWlw4X2chNNscti kjm6pbARjvQfSeAcFgLP8G6s8NG7sdYitPGfO5Bb006MD7hi3VRv/ejkv2EveGXiZxyq qHSQ== X-Gm-Message-State: AOAM531YVSDcYLsny7sHjDf9gNKWUmhYsQbN898PClqVWNRSLyTBc8tp WiinE6iJ+IAHDCFrNFrjtasBzBK8/XTInhMr5TtXtVWYoaF7P6o18VyVyOxwRSnBxthQk/nruxR cf1ak/qdat4J/5dPrxMoNpMK+ X-Received: by 2002:aa7:cb0a:: with SMTP id s10mr34375701edt.289.1635247010567; Tue, 26 Oct 2021 04:16:50 -0700 (PDT) X-Received: by 2002:aa7:cb0a:: with SMTP id s10mr34375677edt.289.1635247010362; Tue, 26 Oct 2021 04:16:50 -0700 (PDT) Received: from steredhat (host-79-30-88-77.retail.telecomitalia.it. [79.30.88.77]) by smtp.gmail.com with ESMTPSA id ca4sm8979329ejb.1.2021.10.26.04.16.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 04:16:50 -0700 (PDT) Date: Tue, 26 Oct 2021 13:16:47 +0200 From: Stefano Garzarella To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: netdev , kernel list , "David S. Miller" , Jakub Kicinski , Jorgen Hansen Subject: Re: [PATCH 03/10] vsock: owner field is specific to VMCI Message-ID: References: <20211021123714.1125384-1-marcandre.lureau@redhat.com> <20211021123714.1125384-4-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20211021123714.1125384-4-marcandre.lureau@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CCing Jorgen. On Thu, Oct 21, 2021 at 04:37:07PM +0400, Marc-Andr? Lureau wrote: >This field isn't used by other transports. If the field is used only in the VMCI transport, maybe it's better to move the field and the code in that transport. Thanks, Stefano > >Signed-off-by: Marc-Andr? Lureau >--- > include/net/af_vsock.h | 2 ++ > net/vmw_vsock/af_vsock.c | 6 ++++++ > 2 files changed, 8 insertions(+) > >diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h >index ab207677e0a8..e626d9484bc5 100644 >--- a/include/net/af_vsock.h >+++ b/include/net/af_vsock.h >@@ -41,7 +41,9 @@ struct vsock_sock { > * cached peer? > */ > u32 cached_peer; /* Context ID of last dgram destination check. */ >+#if IS_ENABLED(CONFIG_VMWARE_VMCI_VSOCKETS) > const struct cred *owner; >+#endif > /* Rest are SOCK_STREAM only. */ > long connect_timeout; > /* Listening socket that this came from. */ >diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >index e2c0cfb334d2..1925682a942a 100644 >--- a/net/vmw_vsock/af_vsock.c >+++ b/net/vmw_vsock/af_vsock.c >@@ -761,7 +761,9 @@ static struct sock *__vsock_create(struct net *net, > psk = parent ? vsock_sk(parent) : NULL; > if (parent) { > vsk->trusted = psk->trusted; >+#if IS_ENABLED(CONFIG_VMWARE_VMCI_VSOCKETS) > vsk->owner = get_cred(psk->owner); >+#endif > vsk->connect_timeout = psk->connect_timeout; > vsk->buffer_size = psk->buffer_size; > vsk->buffer_min_size = psk->buffer_min_size; >@@ -769,7 +771,9 @@ static struct sock *__vsock_create(struct net *net, > security_sk_clone(parent, sk); > } else { > vsk->trusted = ns_capable_noaudit(&init_user_ns, CAP_NET_ADMIN); >+#if IS_ENABLED(CONFIG_VMWARE_VMCI_VSOCKETS) > vsk->owner = get_current_cred(); >+#endif > vsk->connect_timeout = VSOCK_DEFAULT_CONNECT_TIMEOUT; > vsk->buffer_size = VSOCK_DEFAULT_BUFFER_SIZE; > vsk->buffer_min_size = VSOCK_DEFAULT_BUFFER_MIN_SIZE; >@@ -833,7 +837,9 @@ static void vsock_sk_destruct(struct sock *sk) > vsock_addr_init(&vsk->local_addr, VMADDR_CID_ANY, VMADDR_PORT_ANY); > vsock_addr_init(&vsk->remote_addr, VMADDR_CID_ANY, VMADDR_PORT_ANY); > >+#if IS_ENABLED(CONFIG_VMWARE_VMCI_VSOCKETS) > put_cred(vsk->owner); >+#endif > } > > static int vsock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) >-- >2.33.0.721.g106298f7f9 >