* [PATCH rdma-next] RDMA/uverbs: Add empty rdma_uattrs_has_raw_cap() declaration
@ 2025-07-08 9:31 Leon Romanovsky
2025-07-08 9:40 ` Parav Pandit
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Leon Romanovsky @ 2025-07-08 9:31 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Leon Romanovsky, kernel test robot, linux-rdma, Parav Pandit
From: Leon Romanovsky <leonro@nvidia.com>
The call to rdma_uattrs_has_raw_cap() is placed in mlx5 fs.c file,
which is compiled without relation to CONFIG_INFINIBAND_USER_ACCESS.
Despite the check is used only in flows with CONFIG_INFINIBAND_USER_ACCESS=y|m,
the compilers generate the following error for CONFIG_INFINIBAND_USER_ACCESS=n
builds.
>> ERROR: modpost: "rdma_uattrs_has_raw_cap" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
Fixes: f458ccd2aa2c ("RDMA/uverbs: Check CAP_NET_RAW in user namespace for flow create")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202507080725.bh7xrhpg-lkp@intel.com/
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
---
include/rdma/ib_verbs.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index c263327a0205..ce4180c4db14 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -4841,15 +4841,19 @@ struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile);
#if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
int uverbs_destroy_def_handler(struct uverbs_attr_bundle *attrs);
+bool rdma_uattrs_has_raw_cap(const struct uverbs_attr_bundle *attrs);
#else
static inline int uverbs_destroy_def_handler(struct uverbs_attr_bundle *attrs)
{
return 0;
}
+static inline bool
+rdma_uattrs_has_raw_cap(const struct uverbs_attr_bundle *attrs)
+{
+ return false;
+}
#endif
-bool rdma_uattrs_has_raw_cap(const struct uverbs_attr_bundle *attrs);
-
struct net_device *rdma_alloc_netdev(struct ib_device *device, u32 port_num,
enum rdma_netdev_t type, const char *name,
unsigned char name_assign_type,
--
2.50.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* RE: [PATCH rdma-next] RDMA/uverbs: Add empty rdma_uattrs_has_raw_cap() declaration
2025-07-08 9:31 [PATCH rdma-next] RDMA/uverbs: Add empty rdma_uattrs_has_raw_cap() declaration Leon Romanovsky
@ 2025-07-08 9:40 ` Parav Pandit
2025-07-08 23:57 ` yanjun.zhu
2025-07-09 7:41 ` Leon Romanovsky
2 siblings, 0 replies; 4+ messages in thread
From: Parav Pandit @ 2025-07-08 9:40 UTC (permalink / raw)
To: Leon Romanovsky, Jason Gunthorpe
Cc: Leon Romanovsky, kernel test robot, linux-rdma@vger.kernel.org
> From: Leon Romanovsky <leon@kernel.org>
> Sent: 08 July 2025 03:02 PM
> From: Leon Romanovsky <leonro@nvidia.com>
>
> The call to rdma_uattrs_has_raw_cap() is placed in mlx5 fs.c file, which is
> compiled without relation to CONFIG_INFINIBAND_USER_ACCESS.
>
> Despite the check is used only in flows with
> CONFIG_INFINIBAND_USER_ACCESS=y|m,
> the compilers generate the following error for
> CONFIG_INFINIBAND_USER_ACCESS=n builds.
>
> >> ERROR: modpost: "rdma_uattrs_has_raw_cap"
> [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
>
> Fixes: f458ccd2aa2c ("RDMA/uverbs: Check CAP_NET_RAW in user namespace
> for flow create")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202507080725.bh7xrhpg-
> lkp@intel.com/
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> include/rdma/ib_verbs.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index
> c263327a0205..ce4180c4db14 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -4841,15 +4841,19 @@ struct ib_ucontext
> *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile);
>
> #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
> int uverbs_destroy_def_handler(struct uverbs_attr_bundle *attrs);
> +bool rdma_uattrs_has_raw_cap(const struct uverbs_attr_bundle *attrs);
> #else
> static inline int uverbs_destroy_def_handler(struct uverbs_attr_bundle *attrs)
> {
> return 0;
> }
> +static inline bool
> +rdma_uattrs_has_raw_cap(const struct uverbs_attr_bundle *attrs) {
> + return false;
> +}
> #endif
>
> -bool rdma_uattrs_has_raw_cap(const struct uverbs_attr_bundle *attrs);
> -
> struct net_device *rdma_alloc_netdev(struct ib_device *device, u32
> port_num,
> enum rdma_netdev_t type, const char
> *name,
> unsigned char name_assign_type,
> --
> 2.50.0
Reviewed-by: Parav Pandit <parav@nvidia.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH rdma-next] RDMA/uverbs: Add empty rdma_uattrs_has_raw_cap() declaration
2025-07-08 9:31 [PATCH rdma-next] RDMA/uverbs: Add empty rdma_uattrs_has_raw_cap() declaration Leon Romanovsky
2025-07-08 9:40 ` Parav Pandit
@ 2025-07-08 23:57 ` yanjun.zhu
2025-07-09 7:41 ` Leon Romanovsky
2 siblings, 0 replies; 4+ messages in thread
From: yanjun.zhu @ 2025-07-08 23:57 UTC (permalink / raw)
To: Leon Romanovsky, Jason Gunthorpe
Cc: Leon Romanovsky, kernel test robot, linux-rdma, Parav Pandit
On 7/8/25 2:31 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@nvidia.com>
>
> The call to rdma_uattrs_has_raw_cap() is placed in mlx5 fs.c file,
> which is compiled without relation to CONFIG_INFINIBAND_USER_ACCESS.
>
> Despite the check is used only in flows with CONFIG_INFINIBAND_USER_ACCESS=y|m,
> the compilers generate the following error for CONFIG_INFINIBAND_USER_ACCESS=n
> builds.
>
>>> ERROR: modpost: "rdma_uattrs_has_raw_cap" [drivers/infiniband/hw/mlx5/mlx5_ib.ko] undefined!
>
> Fixes: f458ccd2aa2c ("RDMA/uverbs: Check CAP_NET_RAW in user namespace for flow create")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202507080725.bh7xrhpg-lkp@intel.com/
> Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> include/rdma/ib_verbs.h | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index c263327a0205..ce4180c4db14 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -4841,15 +4841,19 @@ struct ib_ucontext *ib_uverbs_get_ucontext_file(struct ib_uverbs_file *ufile);
>
> #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
> int uverbs_destroy_def_handler(struct uverbs_attr_bundle *attrs);
> +bool rdma_uattrs_has_raw_cap(const struct uverbs_attr_bundle *attrs);
> #else
> static inline int uverbs_destroy_def_handler(struct uverbs_attr_bundle *attrs)
> {
> return 0;
> }
> +static inline bool
> +rdma_uattrs_has_raw_cap(const struct uverbs_attr_bundle *attrs)
> +{
> + return false;
> +}
> #endif
The function rdma_uattrs_has_raw_cap is implemented in the file
rdma_core.c. This file is included in the build via the Makefile:
"
...
ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_marshall.o \
rdma_core.o uverbs_std_types.o uverbs_ioctl.o \
...
"
As a result, rdma_core.o is compiled only when
CONFIG_INFINIBAND_USER_ACCESS is enabled.
In other words, the implementation of the rdma_uattrs_has_raw_cap
function is guarded by CONFIG_INFINIBAND_USER_ACCESS.
Given this, it is reasonable to move the declaration of
rdma_uattrs_has_raw_cap into the scope of CONFIG_INFINIBAND_USER_ACCESS
in ib_verbs.h.
Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev>
Zhu Yanjun
>
> -bool rdma_uattrs_has_raw_cap(const struct uverbs_attr_bundle *attrs);
> -
> struct net_device *rdma_alloc_netdev(struct ib_device *device, u32 port_num,
> enum rdma_netdev_t type, const char *name,
> unsigned char name_assign_type,
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH rdma-next] RDMA/uverbs: Add empty rdma_uattrs_has_raw_cap() declaration
2025-07-08 9:31 [PATCH rdma-next] RDMA/uverbs: Add empty rdma_uattrs_has_raw_cap() declaration Leon Romanovsky
2025-07-08 9:40 ` Parav Pandit
2025-07-08 23:57 ` yanjun.zhu
@ 2025-07-09 7:41 ` Leon Romanovsky
2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2025-07-09 7:41 UTC (permalink / raw)
To: Jason Gunthorpe, Leon Romanovsky
Cc: kernel test robot, linux-rdma, Parav Pandit, Leon Romanovsky
On Tue, 08 Jul 2025 12:31:39 +0300, Leon Romanovsky wrote:
> The call to rdma_uattrs_has_raw_cap() is placed in mlx5 fs.c file,
> which is compiled without relation to CONFIG_INFINIBAND_USER_ACCESS.
>
> Despite the check is used only in flows with CONFIG_INFINIBAND_USER_ACCESS=y|m,
> the compilers generate the following error for CONFIG_INFINIBAND_USER_ACCESS=n
> builds.
>
> [...]
Applied, thanks!
[1/1] RDMA/uverbs: Add empty rdma_uattrs_has_raw_cap() declaration
https://git.kernel.org/rdma/rdma/c/98269398c02ab2
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-09 7:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08 9:31 [PATCH rdma-next] RDMA/uverbs: Add empty rdma_uattrs_has_raw_cap() declaration Leon Romanovsky
2025-07-08 9:40 ` Parav Pandit
2025-07-08 23:57 ` yanjun.zhu
2025-07-09 7:41 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox