Hardening in the spirit of commit 56130915bbe3 ("VSOCK: constify
vsock_transport structure"), which constified the only vsock transport of
its time, but then effectively got reverted in commit c0cfa2d8a788 ("vsock:
add multi-transports support").
virtio_transport structs are immutable, move them to RO memory. No
functional change. Value added: less .data, fewer options to take over
function pointers [1].
File sizes are essentially unchanged (deltas -8 to +64 bytes, <= +0.01%).
Sizes of .text and .bss are unchanged, only movement being few hundred
bytes of the transport structs relocating from .data to .rodata:
.rodata .data
vsock.ko 0 0
vsock_loopback.ko +384 -384
vmw_vsock_virtio_transport.ko +384 -384
vmw_vsock_virtio_transport_common.ko 0 0
vmw_vsock_vmci_transport.ko +352 -352
hv_sock.ko +352 -352
vhost_vsock.ko +384 -384
[1] https://www.kernel.org/doc/html/v7.4-rc5/security/self-protection.html#function-pointers-and-sensitive-variables-must-not-be-writable
---
Michal Luczaj (5):
vsock/virtio: constify loopback_transport
vsock/virtio: constify virtio_transport
vsock/virtio: constify vhost_transport
vsock/vmci: constify vmci_transport
vsock/hyperv: constify hvs_transport
drivers/vhost/vsock.c | 2 +-
include/linux/virtio_vsock.h | 2 +-
include/net/af_vsock.h | 2 +-
net/vmw_vsock/af_vsock.c | 2 +-
net/vmw_vsock/hyperv_transport.c | 2 +-
net/vmw_vsock/virtio_transport.c | 4 ++--
net/vmw_vsock/virtio_transport_common.c | 4 ++--
net/vmw_vsock/vmci_transport.c | 4 ++--
net/vmw_vsock/vsock_loopback.c | 2 +-
9 files changed, 12 insertions(+), 12 deletions(-)
---
base-commit: ed3135d0881a926de56a7f490dea3d51698ba118
change-id: 20260116-vsock-constify-transports-16f3f5e28bab
Best regards,
--
Michal Luczaj <mh…@rbox.co>
[PATCH net-next RFC 0/5] vsock: constify transports
- From
- mh…@rbox.co (Michal Luczaj)
- Organization
- Usenet Network
- Message-ID
- <2026…@rbox.co>
- Date
- Newsgroups
- linux.kernel.netdev