Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96E81C433DB for ; Mon, 29 Mar 2021 16:52:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A24361927 for ; Mon, 29 Mar 2021 16:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230362AbhC2Qvp (ORCPT ); Mon, 29 Mar 2021 12:51:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:45130 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231366AbhC2QvO (ORCPT ); Mon, 29 Mar 2021 12:51:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A465161927; Mon, 29 Mar 2021 16:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1617036674; bh=ZPiGnDzRD1/rsUG1OFoaYSH6jCBRzYdwtfQdVeDgXN4=; h=From:To:Cc:Subject:Date:From; b=JSeG7I63rWuMobMqNmRbJJugFocWPCYo8VrOhI12D4GsQKRxZYt7cY6RHtPAlV+Dl dFDkCrRo7lvQ8bKuKW/582u3s1Nwo42CpIqJSqGoNJSaCKLWOfRZK257TgT9fNYT++ Dc7JPuqH7uK+/rQtw/fh+VxYFFG6bI6HUcjqwY1GbbxM5q0Qr/DmSbv15mLcH9/yTh MgX5j605C1A+XbflOuCBWq66JEhQG92OWNbNL9up0bwR5pHFae0+jfuaEy7p87FjoV zaAM2a5sy5YP8fWLRYO1g+1/rLtUMdbEy49Av+EHvgh51AXv7wvtcMuPV3HdsEc+aw BB/23jBf4JFdw== From: Sasha Levin To: stable@vger.kernel.org, dbrazdil@google.com Cc: "David S . Miller" Subject: FAILED: Patch "selinux: vsock: Set SID for socket returned by accept()" failed to apply to 4.9-stable tree Date: Mon, 29 Mar 2021 12:51:12 -0400 Message-Id: <20210329165112.2359542-1-sashal@kernel.org> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 X-Patchwork-Hint: ignore X-stable: review Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.9-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . Thanks, Sasha ------------------ original commit in Linus's tree ------------------ From 1f935e8e72ec28dddb2dc0650b3b6626a293d94b Mon Sep 17 00:00:00 2001 From: David Brazdil Date: Fri, 19 Mar 2021 13:05:41 +0000 Subject: [PATCH] selinux: vsock: Set SID for socket returned by accept() For AF_VSOCK, accept() currently returns sockets that are unlabelled. Other socket families derive the child's SID from the SID of the parent and the SID of the incoming packet. This is typically done as the connected socket is placed in the queue that accept() removes from. Reuse the existing 'security_sk_clone' hook to copy the SID from the parent (server) socket to the child. There is no packet SID in this case. Fixes: d021c344051a ("VSOCK: Introduce VM Sockets") Signed-off-by: David Brazdil Signed-off-by: David S. Miller --- net/vmw_vsock/af_vsock.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 5546710d8ac1..bc7fb9bf3351 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -755,6 +755,7 @@ static struct sock *__vsock_create(struct net *net, vsk->buffer_size = psk->buffer_size; vsk->buffer_min_size = psk->buffer_min_size; vsk->buffer_max_size = psk->buffer_max_size; + security_sk_clone(parent, sk); } else { vsk->trusted = ns_capable_noaudit(&init_user_ns, CAP_NET_ADMIN); vsk->owner = get_current_cred(); -- 2.30.1