All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sung Byeongchan" <tjdqudcks0424@naver.com>
Cc: linux-rdma@vger.kernel.org
Subject: Re: [PATCH] RDMA/iwcm: restrict MAPINFO to administrators
Date: Sat, 07 Nov 2026 09:45:12 +0000	[thread overview]
Message-ID: <sashiko-outbox-202782@kernel.org> (raw)
In-Reply-To: <20261107093338.618394-1-tjdqudcks0424@naver.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] RDMA/iwcm: missing RDMA_NL_ADMIN_PERM on remaining
  iwcm_nl_cb_table ops
--

commit 0d21801da4ca7ad844070c844f5a41cee7373664f5
Author: Sung Byeongchan <tjdqudcks0424@naver.com>

RDMA/iwcm: restrict MAPINFO to administrators

This commit sets RDMA_NL_ADMIN_PERM on the RDMA_NL_IWPM_MAPINFO callback
in iwcm_nl_cb_table so that CAP_NET_ADMIN is required before handling port
mapper MAPINFO requests.

> diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
> index 4b05867dad895..8a3b5aa2dc5f7 100644
> --- a/drivers/infiniband/core/iwcm.c
> +++ b/drivers/infiniband/core/iwcm.c
> @@ -86,7 +86,10 @@ static struct rdma_nl_cbs iwcm_nl_cb_table[RDMA_NL_IWPM_NUM_OPS] = {
>  	[RDMA_NL_IWPM_QUERY_MAPPING] = {.dump = iwpm_add_and_query_mapping_cb},
>  	[RDMA_NL_IWPM_REMOTE_INFO] = {.dump = iwpm_remote_info_cb},
>  	[RDMA_NL_IWPM_HANDLE_ERR] = {.dump = iwpm_mapping_error_cb},
> -	[RDMA_NL_IWPM_MAPINFO] = {.dump = iwpm_mapping_info_cb},
> +	[RDMA_NL_IWPM_MAPINFO] = {
> +		.dump = iwpm_mapping_info_cb,
> +		.flags = RDMA_NL_ADMIN_PERM,
> +	},
>  	[RDMA_NL_IWPM_MAPINFO_NUM] = {.dump = iwpm_ack_mapping_info_cb},
>  	[RDMA_NL_IWPM_HELLO] = {.dump = iwpm_hello_cb}
>  };

[Severity: High]
Should the remaining callbacks in iwcm_nl_cb_table also set
RDMA_NL_ADMIN_PERM?

Leaving RDMA_NL_IWPM_HELLO without RDMA_NL_ADMIN_PERM still lets an
unprivileged NETLINK_RDMA sender invoke iwpm_hello_cb() to overwrite
iwpm_user_pid, reset client registration to IWPM_REG_INCOMPL, and
downgrade iwpm_ulib_version:

drivers/infiniband/core/iwpm_msg.c:iwpm_hello_cb() {
	...
	iwpm_set_registration(nl_client, IWPM_REG_INCOMPL);
	atomic_set(&echo_nlmsg_seq, cb->nlh->nlmsg_seq);
	iwpm_ulib_version = min_t(u16, IWPM_UABI_VERSION, abi_version);
	pr_debug("Using ABI version %u\n", iwpm_ulib_version);
	iwpm_user_pid = cb->nlh->nlmsg_pid;
	ret = iwpm_send_hello(nl_client, iwpm_user_pid, iwpm_ulib_version);
	...
}

Because rdma_nl_net_init() creates the netlink socket with
NL_CFG_F_NONROOT_RECV, an unprivileged process can also subscribe to
RDMA_NL_GROUP_IWPM and answer the kernel's RDMA_NL_IWPM_REG_PID multicast
query via iwpm_register_pid_cb() to claim iwpm_user_pid and set
IWPM_REG_VALID, redirecting subsequent mapping unicasts to itself.
In addition, iwpm_remote_info_cb() accepts unauthenticated
RDMA_NL_IWPM_REMOTE_INFO messages and inserts GFP_ATOMIC iwpm_remote_info
records into iwpm_reminfo_bucket, and the remaining callbacks in
iwcm_nl_cb_table are likewise privileged iwpmd daemon operations.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261107093338.618394-1-tjdqudcks0424@naver.com?part=1

  reply	other threads:[~2026-11-07  9:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-07  9:33 [PATCH] RDMA/iwcm: restrict MAPINFO to administrators Sung Byeongchan
2026-11-07  9:45 ` sashiko-bot [this message]
2026-11-09  8:23 ` Leon Romanovsky

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=sashiko-outbox-202782@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tjdqudcks0424@naver.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.