]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
ktls: Disallow transmitting empty frames outside of TLS 1.0/CBC mode
authorMark Johnston <markj@FreeBSD.org>
Tue, 8 Feb 2022 17:36:41 +0000 (12:36 -0500)
committerMark Johnston <markj@FreeBSD.org>
Wed, 16 Feb 2022 16:52:31 +0000 (11:52 -0500)
commite3b852f99bc5f51e99f8fda67e71ab3639f60f4e
tree75ca3179c20c670ccb75e7c0913dbaf4f9ce7653
parent7ac2a6354f35b785f58a9330bcd0496d0f382137
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)
sys/kern/uipc_ktls.c
sys/kern/uipc_socket.c
sys/sys/ktls.h
tests/sys/kern/ktls_test.c