HomeFreeBSD

so_splice: Disallow splicing with KTLS-enabled sockets

Description

so_splice: Disallow splicing with KTLS-enabled sockets

Suppose the sink socket in a splice has KTLS enabled. When data is
transmitted from the source socket, sosend_generic_locked() receives an
mbuf rather than a UIO as it would if userspace were transferring data.
In this case, ktls_frame() expects the mbuf to be unmapped, but in
general this won't be the case.

Simply disallow the combination for now. Modify so_unsplice() to handle
dismantling a partially initialized splice, in order to simplify error
handling in so_splice(). Make sure that one can't enable KTLS on a
spliced socket, or more specifically, that one can't enable RXTLS on the
source side of a splice, or TXTLS on the sink side of a splice.

Reported by: syzbot+9cc248c4b0ca9b931ab4@syzkaller.appspotmail.com
Reviewed by: gallatin
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D49920

(cherry picked from commit 1000cc4a0d39faeb3e681bb167ed38f164c56604)

Details

Provenance
markjAuthored on Apr 22 2025, 2:53 PM
Reviewer
gallatin
Differential Revision
D49920: so_splice: Disallow splicing with KTLS-enabled sockets
Parents
rG4f3ce62ff7ef: sysctl: Panic on OID reuse
Branches
Unknown
Tags
Unknown