lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250610191144.422161-2-konrad.wilk@oracle.com>
Date: Tue, 10 Jun 2025 12:27:25 -0400
From: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
To: allison.henderson@...cle.com, netdev@...r.kernel.org,
        linux-rdma@...r.kernel.org, rds-devel@....oracle.com
Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Subject: [PATCH RFC v1] rds: Expose feature parameters via sysfs and ELF note

We would like to have a programatic way for applications
to query which of the features defined in include/uapi/linux/rds.h
are actually implemented by the kernel.

The problem is that applications can be built against newer
kernel (or older) and they may have the feature implemented or not.

The lack of a certain feature would signify that the kernel
does not support it. The presence of it signifies the existence
of it.

This would provide the application to query the sysfs and figure
out what is supported (and which ones are deprecated) and also
what ioctl number to use for the specific feature (albeit that
is already in include/uapi/linux/rds.h but this is an extra
check if someone messed up).

This patch would expose these extra sysfs values:

/sys/module/rds/parameters/rds_ioctl_get_tos: 35297
/sys/module/rds/parameters/rds_ioctl_set_tos: 35296
/sys/module/rds/parameters/rds_socket_cancel_sent_to: 1
/sys/module/rds/parameters/rds_socket_cong_monitor: 6
/sys/module/rds/parameters/rds_socket_free_mr: 3
/sys/module/rds/parameters/rds_socket_get_mr: 2
/sys/module/rds/parameters/rds_socket_get_mr_for_dest: 7
/sys/module/rds/parameters/rds_socket_recverr: 5
/sys/module/rds/parameters/rds_socket_so_rxpath_latency: 9
/sys/module/rds/parameters/rds_socket_so_transport: 8
/sys/module/rds/parameters/rds_so_transport_ib: 0
/sys/module/rds/parameters/rds_so_transport_tcp: 2

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
---
 Documentation/ABI/stable/sysfs-driver-rds | 92 +++++++++++++++++++++++
 net/rds/af_rds.c                          | 33 ++++++++
 2 files changed, 125 insertions(+)
 create mode 100644 Documentation/ABI/stable/sysfs-driver-rds

diff --git a/Documentation/ABI/stable/sysfs-driver-rds b/Documentation/ABI/stable/sysfs-driver-rds
new file mode 100644
index 000000000000..dcb1a335c5d6
--- /dev/null
+++ b/Documentation/ABI/stable/sysfs-driver-rds
@@ -0,0 +1,92 @@
+What:		/sys/module/rds/parameters/rds_ioctl_set_tos
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The RDS driver supports the mechanism to set on a socket
+		the Quality of Service.
+
+		The returned value is the socket ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_ioctl_get_tos
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The RDS driver supports the mechanism to get on a socket
+		the Quality of Service.
+
+		The returned value is the socket ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_socket_cancel_sent_to
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The RDS driver supports the mechanism to cancel all pending
+		messages to a given destination.
+
+		The returned value is the ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_socket_get_mr
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The RDS driver supports the mechanism to retrieve the memory
+		ranges for the RDMA calls to setsockopt.
+
+		The returned value is the ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_socket_free_mr
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The RDS driver supports the mechanism to release the memory
+		ranges for the RDMA calls to setsockopt.
+
+		The returned value is the ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_socket_recverr
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The RDS driver supports the mechanism to send RDMA notifications
+		for any RDMA operation that fails.
+
+		The returned value is the ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_socket_cong_monitor
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The RDS driver supports mechanism to provide Congestion updates via
+		RDS_CMSG_CONG_UPDATE control messages.
+
+		The returned value is the ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_socket_get_mr_for_dest
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The returned value is the ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_socket_so_transport
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The returned value is the ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_socket_so_rxpath_latency
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The returned value is the ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_so_transport_ib
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The returned value for the IB transport ioctl number and this is read-only.
+
+What:		/sys/module/rds/parameters/rds_so_transport_tcp
+Date:		Jun 2025
+Contact:	rds-devel@....oracle.com
+Description:
+		The returned value is the TCP transport number and this is read-only.
diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
index 8435a20968ef..15c8ded02dfb 100644
--- a/net/rds/af_rds.c
+++ b/net/rds/af_rds.c
@@ -31,6 +31,7 @@
  *
  */
 #include <linux/module.h>
+#include <linux/elfnote.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/gfp.h>
@@ -960,3 +961,35 @@ MODULE_DESCRIPTION("RDS: Reliable Datagram Sockets"
 MODULE_VERSION(DRV_VERSION);
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_ALIAS_NETPROTO(PF_RDS);
+
+#define RDS_IOCTL(feature, val) ELFNOTE64("rds.ioctl_" #feature, 0, val); \
+				unsigned int rds_ioctl_##feature = val; \
+				module_param(rds_ioctl_##feature, int, 0444)
+
+#define RDS_SOCKET(feature, val) ELFNOTE64("rds.socket_" #feature, 0, val); \
+				unsigned int rds_socket_##feature = val; \
+				module_param(rds_socket_##feature, int, 0444)
+
+#define RDS_SO_TRANSPORT(feature, val) ELFNOTE64("rds.so_transport_" #feature, 0, val); \
+				unsigned int rds_so_transport_##feature = val; \
+				module_param(rds_so_transport_##feature, int, 0444)
+
+/* The values used here correspond to include/uapi/linux/rds.h values */
+
+RDS_IOCTL(set_tos, SIOCRDSSETTOS);
+RDS_IOCTL(get_tos, SIOCRDSGETTOS);
+
+/* Advertise setsocket/getsocket options. */
+
+RDS_SOCKET(cancel_sent_to, RDS_CANCEL_SENT_TO);
+RDS_SOCKET(get_mr, RDS_GET_MR);
+RDS_SOCKET(free_mr, RDS_FREE_MR);
+RDS_SOCKET(recverr, RDS_RECVERR);
+RDS_SOCKET(cong_monitor, RDS_CONG_MONITOR);
+RDS_SOCKET(get_mr_for_dest, RDS_GET_MR_FOR_DEST);
+RDS_SOCKET(so_transport, SO_RDS_TRANSPORT);
+RDS_SOCKET(so_rxpath_latency, SO_RDS_MSG_RXPATH_LATENCY);
+
+/* The transport mechanisms. */
+RDS_SO_TRANSPORT(ib, RDS_TRANS_IB);
+RDS_SO_TRANSPORT(tcp, RDS_TRANS_TCP);
-- 
2.43.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ