HomeFreeBSD

ktls: Disallow transmitting empty frames outside of TLS 1.0/CBC mode

Description

ktls: Disallow transmitting empty frames outside of TLS 1.0/CBC mode

There was nothing preventing one from sending an empty fragment on an
arbitrary KTLS TX-enabled socket, but ktls_frame() asserts that this
could not happen. Though the transmit path handles this case for TLS
1.0 with AES-CBC, we should be strict and allow empty fragments only in
modes where it is explicitly allowed.

Modify sosend_generic() to reject writes to a KTLS-enabled socket if the
number of data bytes is zero, so that userspace cannot trigger the
aforementioned assertion.

Add regression tests to exercise this case.

Reported by: syzkaller
Reviewed by: gallatin, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5de79eeddb9de079d108d1312148bcbefce45c27)

Details

Provenance
markjAuthored on Feb 8 2022, 5:36 PM
Parents
rG7ac2a6354f35: file: Make fget*() and getvnode*() consistent about initializing *fpp
Branches
Unknown
Tags
Unknown