From: Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
To: davem@davemloft.net
Cc: edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
zbr@ioremap.net, brauner@kernel.org, johannes@sipsolutions.net,
ecree.xilinx@gmail.com, leon@kernel.org, keescook@chromium.org,
socketcan@hartkopp.net, petrm@nvidia.com,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
anjali.k.kulkarni@oracle.com
Subject: [PATCH 4/5] connector/cn_proc: Allow non-root users access
Date: Wed, 8 Mar 2023 19:19:52 -0800 [thread overview]
Message-ID: <20230309031953.2350213-5-anjali.k.kulkarni@oracle.com> (raw)
In-Reply-To: <20230309031953.2350213-1-anjali.k.kulkarni@oracle.com>
The patch allows non-root users to receive cn proc connector
notifications, as anyone can normally get process start/exit status from
/proc. The reason for not allowing non-root users to receive multicast
messages is long gone, as described in this thread:
https://linux-kernel.vger.kernel.narkive.com/CpJFcnra/multicast-netlink-for-non-root-process
Also, many other netlink protocols allow non-root users to receive multicast
messages, and there is no reason to discriminate against CONNECTOR.
Reason we need this change is we need to run our DB application as a
non-root user.
Signed-off-by: Anjali Kulkarni <anjali.k.kulkarni@oracle.com>
---
drivers/connector/cn_proc.c | 7 -------
drivers/connector/connector.c | 1 +
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index ef3820b43b5c..03ba70f07113 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -376,12 +376,6 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
!task_is_in_init_pid_ns(current))
return;
- /* Can only change if privileged. */
- if (!__netlink_ns_capable(nsp, &init_user_ns, CAP_NET_ADMIN)) {
- err = EPERM;
- goto out;
- }
-
if (msg->len == sizeof(mc_op))
mc_op = *((enum proc_cn_mcast_op *)msg->data);
else
@@ -414,7 +408,6 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg,
break;
}
-out:
cn_proc_ack(err, msg->seq, msg->ack);
}
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 1b7851b1aa0f..136a9f38a063 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -251,6 +251,7 @@ static int cn_init(void)
{
struct cn_dev *dev = &cdev;
struct netlink_kernel_cfg cfg = {
+ .flags = NL_CFG_F_NONROOT_RECV,
.groups = CN_NETLINK_USERS + 0xf,
.input = cn_rx_skb,
};
--
2.39.2
next prev parent reply other threads:[~2023-03-09 3:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-09 3:19 [PATCH 0/5] Process connector bug fixes & enhancements Anjali Kulkarni
2023-03-09 3:19 ` [PATCH 1/5] netlink: Reverse the patch which removed filtering Anjali Kulkarni
2023-03-09 3:19 ` [PATCH 2/5] connector/cn_proc: Add filtering to fix some bugs Anjali Kulkarni
2023-03-09 7:15 ` kernel test robot
2023-03-09 3:19 ` [PATCH 3/5] connector/cn_proc: Test code for proc connector Anjali Kulkarni
2023-03-09 3:19 ` Anjali Kulkarni [this message]
2023-03-09 17:09 ` [PATCH 4/5] connector/cn_proc: Allow non-root users access Christian Brauner
2023-03-09 21:57 ` Anjali Kulkarni
2023-03-10 20:47 ` Anjali Kulkarni
2023-03-09 3:19 ` [PATCH 5/5] connector/cn_proc: Performance improvements Anjali Kulkarni
2023-03-09 17:05 ` [PATCH 0/5] Process connector bug fixes & enhancements Christian Brauner
2023-03-09 21:04 ` Anjali Kulkarni
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=20230309031953.2350213-5-anjali.k.kulkarni@oracle.com \
--to=anjali.k.kulkarni@oracle.com \
--cc=brauner@kernel.org \
--cc=davem@davemloft.net \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=johannes@sipsolutions.net \
--cc=keescook@chromium.org \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=socketcan@hartkopp.net \
--cc=zbr@ioremap.net \
/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