[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3bd7zvejjl6slge277gv2pfktqc45rcgu6fpmmd7zm2lpnq26d@avrdwhy5zpmz>
Date: Wed, 11 Feb 2026 08:06:35 -0600
From: Bjorn Andersson <andersson@...nel.org>
To: Vishnu Santhosh <vishnu.santhosh@....qualcomm.com>
Cc: Manivannan Sadhasivam <mani@...nel.org>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
linux-arm-msm@...r.kernel.org, netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
bjorn.andersson@....qualcomm.com, chris.lew@....qualcomm.com,
Deepak Kumar Singh <deepak.singh@....qualcomm.com>
Subject: Re: [PATCH] net: qrtr: Expand control port access to root
On Thu, Feb 05, 2026 at 01:51:31PM +0530, Vishnu Santhosh wrote:
> When qrtr is loaded as module, qrtr-ns runs from SELinux kmod_t
> domain.
It wasn't clear to me that "qrtr-ns" refers to the net/qrtr/ns.c, not
the deprecated "qrtr-ns" utility, until I spoke with Chris last night.
Perhaps it's just me, but I would appreciate if this was made a bit
clearer. Writing "QRTR NS" instead of "qrtr-ns" would have been
sufficient.
Regards,
Bjorn
> On targets using upstream SELinux policies, this domain
> does not receive CAP_NET_ADMIN, which prevents it from binding
> control port even though qrtr-ns is a trusted system component.
>
> Granting kmod_t the CAP_NET_ADMIN capability in policy is possible,
> but not desirable, as kmod_t is not expected to perform networking
> operations and widening its capability set is discouraged.
>
> To address this in a contained way within qrtr, extend the control
> port permission check to allow binding when either:
>
> - the process has CAP_NET_ADMIN, or
> - the process belongs to GLOBAL_ROOT_GID (root-equivalent tasks)
>
> This permits qrtr-ns to successfully bind its control port in
> kmod_t restricted environments without broadening SELinux capability
> assignments.
>
> Co-developed-by: Deepak Kumar Singh <deepak.singh@....qualcomm.com>
> Signed-off-by: Deepak Kumar Singh <deepak.singh@....qualcomm.com>
> Signed-off-by: Vishnu Santhosh <vishnu.santhosh@....qualcomm.com>
> ---
> net/qrtr/af_qrtr.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c
> index dab839f61ee93b876021d904ae6b8dca8ed43745..b0e252c16f156c05973988fbdf317a149ad9840d 100644
> --- a/net/qrtr/af_qrtr.c
> +++ b/net/qrtr/af_qrtr.c
> @@ -8,6 +8,7 @@
> #include <linux/qrtr.h>
> #include <linux/termios.h> /* For TIOCINQ/OUTQ */
> #include <linux/spinlock.h>
> +#include <linux/uidgid.h>
> #include <linux/wait.h>
>
> #include <net/sock.h>
> @@ -738,7 +739,8 @@ static int qrtr_port_assign(struct qrtr_sock *ipc, int *port)
> if (!*port) {
> rc = xa_alloc(&qrtr_ports, port, ipc, QRTR_EPH_PORT_RANGE,
> GFP_KERNEL);
> - } else if (*port < QRTR_MIN_EPH_SOCKET && !capable(CAP_NET_ADMIN)) {
> + } else if (*port < QRTR_MIN_EPH_SOCKET && !(capable(CAP_NET_ADMIN) ||
> + in_egroup_p(GLOBAL_ROOT_GID))) {
> rc = -EACCES;
> } else if (*port == QRTR_PORT_CTRL) {
> rc = xa_insert(&qrtr_ports, 0, ipc, GFP_KERNEL);
>
> ---
> base-commit: f14faaf3a1fb3b9e4cf2e56269711fb85fba9458
> change-id: 20260205-qrtr-control-port-access-permission-bfea19994a58
>
> Best regards,
> --
> Vishnu Santhosh <vishnu.santhosh@....qualcomm.com>
>
Powered by blists - more mailing lists