FAILED: patch "[PATCH] smb: client: require net admin for CIFS SWN netlink" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.15-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 <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x d1ebfce2c1d161186a82e77590bf7da2ea1bce91
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026052852-envelope-curly-7d36@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d1ebfce2c1d161186a82e77590bf7da2ea1bce91 Mon Sep 17 00:00:00 2001
From: Michael Bommarito <[email protected]>
Date: Sun, 17 May 2026 20:11:50 -0400
Subject: [PATCH] smb: client: require net admin for CIFS SWN netlink
CIFS_GENL_CMD_SWN_NOTIFY is the userspace witness-notify command. The intended sender is the cifs.witness helper, but the generic-netlink operation currently has no capability flag, so any local process can send RESOURCE_CHANGE or CLIENT_MOVE notifications to the in-kernel witness handler.
The same family exposes CIFS_GENL_MCGRP_SWN without multicast-group capability flags. Register messages sent to that group include the witness registration id and, for NTLM-authenticated mounts, the username, domain, and password attributes copied from the CIFS session. An unprivileged local process should not be able to join that group and receive those messages.
Require CAP_NET_ADMIN for incoming SWN_NOTIFY commands with GENL_ADMIN_PERM, and require CAP_NET_ADMIN over the network namespace for joining the SWN multicast group with GENL_MCAST_CAP_NET_ADMIN. The cifs.witness service runs with the privileges needed for both operations.
fs/smb/client/netlink.c +5 -1
@@ -33,13 +33,17 @@ static const struct nla_policy cifs_genl_policy[CIFS_GENL_ATTR_MAX + 1] = {static const struct genl_ops cifs_genl_ops[] = { { .cmd =CIFS_GENL_CMD_SWN_NOTIFY , + .flags =GENL_ADMIN_PERM , .validate =GENL_DONT_VALIDATE_STRICT |GENL_DONT_VALIDATE_DUMP , .doit = cifs_swn_notify, }, };static const struct genl_multicast_group cifs_genl_mcgrps[] = { - [CIFS_GENL_MCGRP_SWN ] = { .name =CIFS_GENL_MCGRP_SWN_NAME }, + [CIFS_GENL_MCGRP_SWN ] = { + .name =CIFS_GENL_MCGRP_SWN_NAME , + .flags =GENL_MCAST_CAP_NET_ADMIN , + }, };struct genl_family cifs_genl_family = {
Sasha Levin
maintainerPATCH 1/2 genetlink: Use internal flags for multicast groups
From: Ido Schimmel <[email protected]>
[ Upstream commit cd4d7263d58ab98fd4dee876776e4da6c328faa3 ]
As explained in commit e03781879a0d ("drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group"), the "flags" field in the multicast group structure reuses uAPI flags despite the field not being exposed to user space. This makes it impossible to extend its use without adding new uAPI flags, which is inappropriate for internal kernel checks.
Solve this by adding internal flags (i.e., "GENL_MCAST_*") and convert the existing users to use them instead of the uAPI flags.
Tested using the reproducers in commit 44ec98ea5ea9 ("psample: Require 'CAP_NET_ADMIN' when joining "packets" group") and commit e03781879a0d ("drop_monitor: Require 'CAP_SYS_ADMIN' when joining "events" group").
No functional changes intended.
Stable-dep-of: d1ebfce2c1d1 ("smb: client: require net admin for CIFS SWN netlink")
--- include/net/genetlink.h | 9 ++++++--- net/core/drop_monitor.c | 2 +- net/mptcp/pm_netlink.c | 2 +- net/netlink/genetlink.c | 4 ++-- net/psample/psample.c | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-)
include/net/genetlink.h +6 -3
@@ -8,16 +8,19 @@#define GENLMSG_DEFAULT_SIZE (NLMSG_DEFAULT_SIZE - GENL_HDRLEN) +/* Binding to multicast group requires %CAP_NET_ADMIN */ +#define GENL_MCAST_CAP_NET_ADMIN BIT(0) +/* Binding to multicast group requires %CAP_SYS_ADMIN */ +#define GENL_MCAST_CAP_SYS_ADMIN BIT(1) +/** * struct genl_multicast_group - generic netlink multicast group * @name: name of the multicast group, names are per-family -* @flags: GENL_* flags (%GENL_ADMIN_PERM or %GENL_UNS_ADMIN_PERM) -* @cap_sys_admin: whether %CAP_SYS_ADMIN is required for binding +* @flags: GENL_MCAST_* flags */ struct genl_multicast_group {char name[GENL_NAMSIZ ];u8 flags; -u8 cap_sys_admin:1 ; };struct genl_ops ;
net/core/drop_monitor.c +1 -1
@@ -184,7 +184,7 @@ static struct sk_buff *reset_per_cpu_data(struct per_cpu_dm_data *data) }static const struct genl_multicast_group dropmon_mcgrps[] = { - { .name ="events" , .cap_sys_admin =1 }, + { .name ="events" , .flags =GENL_MCAST_CAP_SYS_ADMIN , }, };static void send_dm_alert (struct work_struct *work)
net/mptcp/pm_netlink.c +1 -1
@@ -1196,7 +1196,7 @@ void mptcp_pm_nl_data_init(struct mptcp_sock *msk)static const struct genl_multicast_group mptcp_pm_mcgrps[] = { [MPTCP_PM_CMD_GRP_OFFSET ] = { .name =MPTCP_PM_CMD_GRP_NAME , }, [MPTCP_PM_EV_GRP_OFFSET ] = { .name =MPTCP_PM_EV_GRP_NAME , - .flags =GENL_UNS_ADMIN_PERM , + .flags =GENL_MCAST_CAP_NET_ADMIN , }, };
net/netlink/genetlink.c +2 -2
@@ -1372,10 +1372,10 @@ static int genl_bind(struct net *net, int group)continue ; grp = &family->mcgrps[i]; -if ((grp->flags &GENL_UNS_ADMIN_PERM ) && +if ((grp->flags &GENL_MCAST_CAP_NET_ADMIN ) && !ns_capable (net->user_ns,CAP_NET_ADMIN )) ret = -EPERM ; -if (grp->cap_sys_admin && +if ((grp->flags &GENL_MCAST_CAP_SYS_ADMIN ) && !ns_capable (net->user_ns,CAP_SYS_ADMIN )) ret = -EPERM ;
net/psample/psample.c +1 -1
@@ -32,7 +32,7 @@ enum psample_nl_multicast_groups {static const struct genl_multicast_group psample_nl_mcgrps[] = { [PSAMPLE_NL_MCGRP_CONFIG ] = { .name =PSAMPLE_NL_MCGRP_CONFIG_NAME }, [PSAMPLE_NL_MCGRP_SAMPLE ] = { .name =PSAMPLE_NL_MCGRP_SAMPLE_NAME , - .flags =GENL_UNS_ADMIN_PERM }, + .flags =GENL_MCAST_CAP_NET_ADMIN , }, };static struct genl_family psample_nl_family__ro_after_init ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 smb: client: require net admin for CIFS SWN netlink
From: Michael Bommarito <[email protected]>
[ Upstream commit d1ebfce2c1d161186a82e77590bf7da2ea1bce91 ]
CIFS_GENL_CMD_SWN_NOTIFY is the userspace witness-notify command. The intended sender is the cifs.witness helper, but the generic-netlink operation currently has no capability flag, so any local process can send RESOURCE_CHANGE or CLIENT_MOVE notifications to the in-kernel witness handler.
The same family exposes CIFS_GENL_MCGRP_SWN without multicast-group capability flags. Register messages sent to that group include the witness registration id and, for NTLM-authenticated mounts, the username, domain, and password attributes copied from the CIFS session. An unprivileged local process should not be able to join that group and receive those messages.
Require CAP_NET_ADMIN for incoming SWN_NOTIFY commands with GENL_ADMIN_PERM, and require CAP_NET_ADMIN over the network namespace for joining the SWN multicast group with GENL_MCAST_CAP_NET_ADMIN. The cifs.witness service runs with the privileges needed for both operations.
--- fs/cifs/netlink.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/cifs/netlink.c +5 -1
@@ -33,13 +33,17 @@ static const struct nla_policy cifs_genl_policy[CIFS_GENL_ATTR_MAX + 1] = {static const struct genl_ops cifs_genl_ops[] = { { .cmd =CIFS_GENL_CMD_SWN_NOTIFY , + .flags =GENL_ADMIN_PERM , .validate =GENL_DONT_VALIDATE_STRICT |GENL_DONT_VALIDATE_DUMP , .doit = cifs_swn_notify, }, };static const struct genl_multicast_group cifs_genl_mcgrps[] = { - [CIFS_GENL_MCGRP_SWN ] = { .name =CIFS_GENL_MCGRP_SWN_NAME }, + [CIFS_GENL_MCGRP_SWN ] = { + .name =CIFS_GENL_MCGRP_SWN_NAME , + .flags =GENL_MCAST_CAP_NET_ADMIN , + }, };struct genl_family cifs_genl_family = {
Signature · 1 line
2.53.0