From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Paolo Abeni <pabeni@redhat.com>,
"David S. Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 02/98] net: use indirect calls helpers at the socket layer
Date: Mon, 23 Oct 2023 12:55:51 +0200 [thread overview]
Message-ID: <20231023104813.672778736@linuxfoundation.org> (raw)
In-Reply-To: <20231023104813.580375891@linuxfoundation.org>
4.19-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <pabeni@redhat.com>
[ Upstream commit 8c3c447b3cec27cf6f77080f4d157d53b64e9555 ]
This avoids an indirect call per {send,recv}msg syscall in
the common (IPv6 or IPv4 socket) case.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Stable-dep-of: 86a7e0b69bd5 ("net: prevent rewrite of msg_name in sock_sendmsg()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/socket.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/net/socket.c b/net/socket.c
index db9d908198f21..dc4d4ecd6cea2 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -90,6 +90,7 @@
#include <linux/slab.h>
#include <linux/xattr.h>
#include <linux/nospec.h>
+#include <linux/indirect_call_wrapper.h>
#include <linux/uaccess.h>
#include <asm/unistd.h>
@@ -108,6 +109,13 @@
#include <net/busy_poll.h>
#include <linux/errqueue.h>
+/* proto_ops for ipv4 and ipv6 use the same {recv,send}msg function */
+#if IS_ENABLED(CONFIG_INET)
+#define INDIRECT_CALL_INET4(f, f1, ...) INDIRECT_CALL_1(f, f1, __VA_ARGS__)
+#else
+#define INDIRECT_CALL_INET4(f, f1, ...) f(__VA_ARGS__)
+#endif
+
#ifdef CONFIG_NET_RX_BUSY_POLL
unsigned int sysctl_net_busy_read __read_mostly;
unsigned int sysctl_net_busy_poll __read_mostly;
@@ -645,10 +653,12 @@ EXPORT_SYMBOL(__sock_tx_timestamp);
* Sends @msg through @sock, passing through LSM.
* Returns the number of bytes sent, or an error code.
*/
-
+INDIRECT_CALLABLE_DECLARE(int inet_sendmsg(struct socket *, struct msghdr *,
+ size_t));
static inline int sock_sendmsg_nosec(struct socket *sock, struct msghdr *msg)
{
- int ret = sock->ops->sendmsg(sock, msg, msg_data_left(msg));
+ int ret = INDIRECT_CALL_INET4(sock->ops->sendmsg, inet_sendmsg, sock,
+ msg, msg_data_left(msg));
BUG_ON(ret == -EIOCBQUEUED);
return ret;
}
@@ -852,11 +862,13 @@ EXPORT_SYMBOL_GPL(__sock_recv_ts_and_drops);
* Receives @msg from @sock, passing through LSM. Returns the total number
* of bytes received, or an error.
*/
-
+INDIRECT_CALLABLE_DECLARE(int inet_recvmsg(struct socket *, struct msghdr *,
+ size_t , int ));
static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg,
int flags)
{
- return sock->ops->recvmsg(sock, msg, msg_data_left(msg), flags);
+ return INDIRECT_CALL_INET4(sock->ops->recvmsg, inet_recvmsg, sock, msg,
+ msg_data_left(msg), flags);
}
int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags)
--
2.40.1
next prev parent reply other threads:[~2023-10-23 11:14 UTC|newest]
Thread overview: 106+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 10:55 [PATCH 4.19 00/98] 4.19.297-rc1 review Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 01/98] indirect call wrappers: helpers to speed-up indirect calls of builtin Greg Kroah-Hartman
2023-10-23 10:55 ` Greg Kroah-Hartman [this message]
2023-10-23 10:55 ` [PATCH 4.19 03/98] net: fix kernel-doc warnings for socket.c Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 04/98] net: prevent rewrite of msg_name in sock_sendmsg() Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 05/98] RDMA/cxgb4: Check skb value for failure to allocate Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 06/98] platform/x86: hp-wmi:: Mark driver struct with __refdata to prevent section mismatch warning Greg Kroah-Hartman
2023-10-23 16:40 ` Uwe Kleine-König
2023-10-24 7:50 ` Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 07/98] HID: logitech-hidpp: Fix kernel crash on receiver USB disconnect Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 08/98] quota: Fix slow quotaoff Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 09/98] net: prevent address rewrite in kernel_bind() Greg Kroah-Hartman
2023-10-23 10:55 ` [PATCH 4.19 10/98] drm: etvnaviv: fix bad backport leading to warning Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 11/98] drm/msm/dsi: skip the wait for video mode done if not applicable Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 12/98] ieee802154: ca8210: Fix a potential UAF in ca8210_probe Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 13/98] xen-netback: use default TX queue size for vifs Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 14/98] drm/vmwgfx: fix typo of sizeof argument Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 15/98] ixgbe: fix crash with empty VF macvlan list Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 16/98] net: nfc: fix races in nfc_llcp_sock_get() and nfc_llcp_sock_get_sn() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 17/98] nfc: nci: assert requested protocol is valid Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 18/98] workqueue: Override implicit ordered attribute in workqueue_apply_unbound_cpumask() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 19/98] sched,idle,rcu: Push rcu_idle deeper into the idle path Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 20/98] dmaengine: stm32-mdma: abort resume if no ongoing transfer Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 21/98] usb: xhci: xhci-ring: Use sysdev for mapping bounce buffer Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 22/98] net: usb: dm9601: fix uninitialized variable use in dm9601_mdio_read Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 23/98] usb: dwc3: Soft reset phy on probe for host Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 24/98] usb: musb: Get the musb_qh poniter after musb_giveback Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 25/98] usb: musb: Modify the "HWVers" register address Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 26/98] iio: pressure: bmp280: Fix NULL pointer exception Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 27/98] iio: pressure: ms5611: ms5611_prom_is_valid false negative bug Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 28/98] mcb: remove is_added flag from mcb_device struct Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 29/98] ceph: fix incorrect revoked caps assert in ceph_fill_file_size() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 30/98] Input: powermate - fix use-after-free in powermate_config_complete Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 31/98] Input: psmouse - fix fast_reconnect function for PS/2 mode Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 32/98] Input: xpad - add PXN V900 support Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 33/98] cgroup: Remove duplicates in cgroup v1 tasks file Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 34/98] pinctrl: avoid unsafe code pattern in find_pinctrl() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 35/98] x86/cpu: Fix AMD erratum #1485 on Zen4-based CPUs Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 36/98] usb: gadget: udc-xilinx: replace memcpy with memcpy_toio Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 37/98] usb: gadget: ncm: Handle decoding of multiple NTBs in unwrap call Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 38/98] powerpc/64e: Fix wrong test in __ptep_test_and_clear_young() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 39/98] x86/alternatives: Disable KASAN in apply_alternatives() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 40/98] dev_forward_skb: do not scrub skb mark within the same name space Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 41/98] usb: hub: Guard against accesses to uninitialized BOS descriptors Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 42/98] Bluetooth: hci_event: Ignore NULL link key Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 43/98] Bluetooth: Reject connection with the device which has same BD_ADDR Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 44/98] Bluetooth: Fix a refcnt underflow problem for hci_conn Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 45/98] Bluetooth: vhci: Fix race when opening vhci device Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 46/98] Bluetooth: hci_event: Fix coding style Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 47/98] Bluetooth: avoid memcmp() out of bounds warning Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 48/98] nfc: nci: fix possible NULL pointer dereference in send_acknowledge() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 49/98] regmap: fix NULL deref on lookup Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 50/98] KVM: x86: Mask LVTPC when handling a PMI Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 51/98] netfilter: nft_payload: fix wrong mac header matching Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 52/98] xfrm: fix a data-race in xfrm_gen_index() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 53/98] xfrm: interface: use DEV_STATS_INC() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 54/98] net: ipv4: fix return value check in esp_remove_trailer Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 55/98] net: ipv6: " Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 56/98] net: rfkill: gpio: prevent value glitch during probe Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 57/98] tcp: fix excessive TLP and RACK timeouts from HZ rounding Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 58/98] tcp: tsq: relax tcp_small_queue_check() when rtx queue contains a single skb Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 59/98] net: usb: smsc95xx: Fix an error code in smsc95xx_reset() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 60/98] i40e: prevent crash on probe if hw registers have invalid values Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 61/98] net/sched: sch_hfsc: upgrade rt to sc when it becomes a inner curve Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 62/98] netfilter: nft_set_rbtree: .deactivate fails if element has expired Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 63/98] net: pktgen: Fix interface flags printing Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 64/98] libceph: fix unaligned accesses in ceph_entity_addr handling Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 65/98] libceph: use kernel_connect() Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 66/98] ARM: dts: ti: omap: Fix noisy serial with overrun-throttle-ms for mapphone Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 67/98] btrfs: return -EUCLEAN for delayed tree ref with a ref count not equals to 1 Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 68/98] btrfs: initialize start_slot in btrfs_log_prealloc_extents Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 69/98] i2c: mux: Avoid potential false error message in i2c_mux_add_adapter Greg Kroah-Hartman
2023-10-23 10:56 ` [PATCH 4.19 70/98] overlayfs: set ctime when setting mtime and atime Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 71/98] gpio: timberdale: Fix potential deadlock on &tgpio->lock Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 72/98] ata: libata-eh: Fix compilation warning in ata_eh_link_report() Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 73/98] tracing: relax trace_event_eval_update() execution with cond_resched() Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 74/98] HID: holtek: fix slab-out-of-bounds Write in holtek_kbd_input_event Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 75/98] Bluetooth: Avoid redundant authentication Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 76/98] Bluetooth: hci_core: Fix build warnings Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 77/98] wifi: mac80211: allow transmitting EAPOL frames with tainted key Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 78/98] wifi: cfg80211: avoid leaking stack data into trace Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 79/98] sky2: Make sure there is at least one frag_addr available Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 80/98] drm: panel-orientation-quirks: Add quirk for One Mix 2S Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 81/98] btrfs: fix some -Wmaybe-uninitialized warnings in ioctl.c Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 82/98] Bluetooth: hci_event: Fix using memcmp when comparing keys Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 83/98] mtd: rawnand: qcom: Unmap the right resource upon probe failure Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 84/98] mtd: spinand: micron: correct bitmask for ecc status Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 85/98] mmc: core: Capture correct oemid-bits for eMMC cards Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 86/98] Revert "pinctrl: avoid unsafe code pattern in find_pinctrl()" Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 87/98] ACPI: irq: Fix incorrect return value in acpi_register_gsi() Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 88/98] USB: serial: option: add Telit LE910C4-WWX 0x1035 composition Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 89/98] USB: serial: option: add entry for Sierra EM9191 with new firmware Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 90/98] USB: serial: option: add Fibocom to DELL custom modem FM101R-GL Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 91/98] perf: Disallow mis-matched inherited group reads Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 92/98] s390/pci: fix iommu bitmap allocation Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 93/98] gpio: vf610: set value before the direction to avoid a glitch Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 94/98] ASoC: pxa: fix a memory leak in probe() Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 95/98] phy: mapphone-mdm6600: Fix runtime PM for remove Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 96/98] Bluetooth: hci_sock: fix slab oob read in create_monitor_event Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 97/98] Bluetooth: hci_sock: Correctly bounds check and pad HCI_MON_NEW_INDEX name Greg Kroah-Hartman
2023-10-23 10:57 ` [PATCH 4.19 98/98] xfrm6: fix inet6_dev refcount underflow problem Greg Kroah-Hartman
2023-10-23 20:42 ` [PATCH 4.19 00/98] 4.19.297-rc1 review Pavel Machek
2023-10-24 8:34 ` Daniel Díaz
2023-10-24 8:58 ` Sudip Mukherjee (Codethink)
2023-10-24 18:11 ` Guenter Roeck
2023-10-25 18:57 ` Jon Hunter
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=20231023104813.672778736@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=davem@davemloft.net \
--cc=pabeni@redhat.com \
--cc=patches@lists.linux.dev \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
/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