Article View: linux.kernel.netdev
Article #18670Re: [PATCH net 1/2] nfc: llcp: Clone LSM attributes to newly created child sockets
From: Simon Horman
Date: Wed, 18 Nov 2026 18:16
Date: Wed, 18 Nov 2026 18:16
39 lines
9413 bytes
9413 bytes
On Thu, Nov 12, 2026 at 10:04:48AM +0000, Suyuan Wang via B4 Relay wrote:
> From: Suyuan Wang <stevewong@hust.edu.cn>
>
> nfc_llcp_recv_connect() creates the child socket for an incoming
> CONNECT and queues it for accept(), but never calls security_sk_clone():
>
> new_sk = nfc_llcp_sock_alloc(NULL, parent->sk_type, GFP_ATOMIC, 0);
> ...
> new_sock = nfc_llcp_sock(new_sk);
>
> So the accepted socket doesn't inherit the LSM state of the listening
> socket. With SELinux, its sock keeps the unlabeled SID. The
> sock_has_perm() checks on it (sendmsg, recvmsg and so on) still run,
> but against that SID instead of the server's. Depending on the policy,
> this can deny a confined server on its own accepted sockets, or allow
> something the server's own label wouldn't.
>
> Call security_sk_clone() right after the child is allocated, before it
> is set up and queued for accept(). Bluetooth, iucv and vsock fixed the
> same problem the same way, in commit 6230c9b4f895 ("bluetooth: Properly
> clone LSM attributes to newly created child connections"),
> commit 02f06918156b ("iucv: properly clone LSM attributes to newly
> created child sockets") and commit 1f935e8e72ec ("selinux: vsock: Set
> SID for socket returned by accept()").
>
> Found with a static analysis tool and checked by hand.
>
> Fixes: d646960f7986 ("NFC: Initial LLCP support")
> Cc: stable@vger.kernel.org
> Co-developed-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
> Signed-off-by: Kaixuan Li <kaixuan.li@ntu.edu.sg>
> Signed-off-by: Suyuan Wang <stevewong@hust.edu.cn>
> ---
> Compile tested only, I haven't tried it with an SELinux policy and a
> real LLCP peer.
> ---
Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261118181601.GP860048@horms.kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366324-linux-kernel-netdev=dewy.ruReferences:
<20261112-nfc-v1-0-ab0ef166f382@gmail.com> <20261112-nfc-v1-1-ab0ef166f382@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366324-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 1/2] nfc: llcp: Clone LSM attributes to newly created child sockets Date: Wed, 18 Nov 2026 18:16:01 +0000 Organization: Usenet Network Message-ID: <20261118181601.GP860048@horms.kernel.org> References: <20261112-nfc-v1-0-ab0ef166f382@gmail.com> <20261112-nfc-v1-1-ab0ef166f382@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="2661278"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:BIRQtahw+gIhhAr70W4NuNSgPJo= sha256:ypWbVLnh7mr0EuCWCRWedjyE070ioD6Vysp+lcchm00= sha1:ZCIR8jv0EdGriQy4MLlTxXHHK3E= sha256:OfqTC0Yf+TCPXoEGzKMUX/G4Sc1ydrFr8OIc87iDTvM= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 6BEB5115358; Wed, 18 Nov 2026 21:16:22 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vTMDsUThRGob; Wed, 18 Nov 2026 21:16:19 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366324-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 508BC114CB4; Wed, 18 Nov 2026 21:16:10 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 1C8E6C1A3B; Wed, 18 Nov 2026 18:16:07 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795025767; b=AwDMP1whfffi/oGVvYMSUZZFjpHFJM0N3nHYswQBd7b4x7MqPDn0wXRUxyfX4HqMVEUa F7y5MmNeNWvRJlldGwoZ+Qt7mYJ+iIOXOj62UeBKAHjMxkUTDt5b0+oIEs/DiT5jQBZVj e9NAkPS4HJcmdskdKF4NvGuLEHIywZqZRSREXYrs9566pG67ctw56j6WYVp79ybzaRnLY rZSTpJRoFDs/8YfJErHmk1phwzxZBIMmzP/TXFOPkGKTgPMcPAKVVTJ5sO+5uIDG+pTKM qvlfGhOY2FC/tTM4FLEksnekFQBjxiKdNKpxaFmsM8FRts4Q8hKg05XSPe/wBkwA5/g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795025767; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=0KF5QjmWSZPXGNjK01zWAmECY5pEE5v1nBtkNw+Vomo=; b=WQRy6WuaSeaKTlq+lJWFE/FUYgVCQUSpt36itBa1H5Zf1T4FSnJVRIfL0kxj0k5JMVeB pFpZ29lGRg0njx+MQuegnv1UUpsJbez9ec/nBBoZq1xqN9l253ECPU5q6gSJAJposT1O8 GEt/+72inZgRKcpl+Fv0AStZ41DdCvjtkdgZmXqRz1QKzNw+n5Bsi3aj1plM3tV5JHKnn fx5LQQdRX3EIVaFAMYclaQqLZH5qKBrxqTvsPRg/A/OEWTlkZjbqdA6Xvq54nCQNkT9BQ 1ZarCbMrVszB5AkUs+lHpplIkwoP5licHu4U8ggFYTHkiyXnDAHvZiI9lGPqBGqVrJA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="dg+/agY9"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E86DB606A32F; Wed, 18 Nov 2026 18:16:06 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dg+/agY9 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795025766; b=uZXSywXTJpbzt5tYLDnhgr+u1HHwHQdO+LiOoe5tLZRYOWX8XQkSFkV9f71CFiS1fmB+ L74ZX19L4At+RksYf/zjFr2enNx91RFTHgiYSVa/P2ceVfH9OgdEhft1DyrPUspv+GeXL EoMSGyDQUZXoytbDARraTOEQ1tU0MzjZLYmS5FNwSsgIOhyl3FefzJY5XypwF82gHgh6u ynMqTPSIcKOMhMSJrCGSSa6xdJk666l21PDqNSSzURj1DKInEH+nsQgY2kn4Z5f1C/Tmj kQOnh55M8bW2al4Ca7XeVnJ0Rw3LTwGkpCBEGYxMGcgCtd/oE3xxqsSu+Zwi+OGzTnw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795025766; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=0KF5QjmWSZPXGNjK01zWAmECY5pEE5v1nBtkNw+Vomo=; b=sQI+/vjZIQ1zbnbJHE3DVNUD9gfuH2kwcMMCgaXltMubpGsBucBLZioJcfVZzHMNtMqr zlGzyyYlePGxOvKTKu1EUNCsyDu+lWiAD8zTQ2F0aWX8/866DC0Kg94XVBThAkcv7V/1D x5D+4qI2oO+xbo2AhUPcIRTGwEuTvMrxlmH/OXLQ8DrErJ5ULyEFSY22xPetJk9Q7bAP/ ZmYYiwqZv/AbWp2w8VMPZgiczrO0TClLFysBfzmB8MfT6Up2kB3cN6uOEKGlBIdRTi9+3 uLl1QGqyX5NWvenClvr/0w6Rg5wCNpoNkCsb9anPdNfFImssGPjRGolrovogll0yV6A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="dg+/agY9"; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1357F606A31C; Wed, 18 Nov 2026 18:16:05 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8D291F000C5; Wed, 18 Nov 2026 18:16:03 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795025765; bh=0KF5QjmWSZPXGNjK01zWAmECY5pEE5v1nBtkNw+Vomo=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=dg+/agY9UAQahmtjzpcKJAaubbNHB1YQySLE0XaWfeAV+XMRzZKhCbDwUS/8heu+R v6we9498lFrciXp62RPzCr4R6q9kb+gr/1l6w2p04ZKwPgCyWx++4CGXajABDxqxfF qRoSh2vjGb6CTj/TYbbIGw1wiKHAcUOVakLQNcXY/eoIaplpiwZAzf14id1MWNyCGv caAViU6QM4Tg7TONkNKKz5vxNUK2iZ3FVadLGJe8wvMx9/wBRm1yQqiEc74LB4cUzW Se53EPI53eDdlziaQlX3CU32K4Gs7ZozGWJb15+4duprkaqM+42RqWVJYAOinpmwsH eRsbL8brqWhEA== X-Cc: netdev@vger.kernel.org, david@ixit.cz, edumazet@kernel.org, kuba@kernel.org, oe-linux-nfc@lists.linux.dev, linux-kernel@vger.kernel.org, pabeni@redhat.com, davem@davemloft.net X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261112-nfc-v1-1-ab0ef166f382@gmail.com> X-Received-Bytes: 9128