Page MenuHomeFreeBSD

ktls: Add a tunable to disable TLS receive
ClosedPublic

Authored by jhb on Tue, Jun 30, 8:32 PM.
Tags
None
Referenced Files
F161950573: D57974.id181136.diff
Wed, Jul 8, 7:04 AM
F161950437: D57974.id181136.diff
Wed, Jul 8, 7:01 AM
F161912966: D57974.id181112.diff
Tue, Jul 7, 11:28 PM
F161912169: D57974.id181112.diff
Tue, Jul 7, 11:19 PM
F161910255: D57974.diff
Tue, Jul 7, 10:54 PM
Unknown Object (File)
Tue, Jul 7, 5:33 PM
Unknown Object (File)
Tue, Jul 7, 5:23 PM
Unknown Object (File)
Mon, Jul 6, 9:27 PM

Details

Summary

TLS receive offload is really only beneficial for in-kernel use cases
(such as NFS over TLS) or when using a hardware offload. In addition,
several recent SAs have involved the TLS receive path, but the only
current mitigation for those is to disable TLS offload entirely.

Sponsored by: Netflix
Sponsored by: Chelsio Communications
Co-authored-by: John Baldwin <jhb@FreeBSD.org>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Tue, Jun 30, 8:32 PM
markj added inline comments.
tests/sys/kern/ktls_test.c
91

This should probably be ATF_REQUIRE_KTLS()?

This revision is now accepted and ready to land.Tue, Jun 30, 8:35 PM

I verified that with the default (still enabled), all of the current kyua tests still passed. I then disabled the sysctl and ran the stock kyua tests followed by running the updated kyua tests. I verified that all of the failing tests from the old kyua tests became skipped tests in the new run with the exception of the ktls_listening_socket test that is now split into two separate tests. It DTRT where TX passes but RX is skipped in the new test suite when RX is disabled. In the old tests the single test failed when RX was disabled.

From Claude:

Commit fbd2c4f28f82 — ktls: Add a tunable to disable TLS receive
                                                                                                                            
Adds kern.ipc.tls.rx_enable (CTLFLAG_RWTUN) to allow disabling KTLS receive independently of transmit. Motivation is
security — provides a finer-grained mitigation for RX-path vulnerabilities without disabling all KTLS.                      
                
Kernel side:                                                                                                                
- The guard in ktls_enable_rx() is correctly extended: !ktls_offload_enable || !ktls_rx_offload_enable. The RX-specific
check is properly subordinate — if the global enable is off, you stop there.                                                
 
Test changes:                                                                                                               
- ATF_REQUIRE_KTLS_RX() correctly calls both require_ktls() and require_ktls_rx() — the former checks kern.ipc.tls.enable,
the latter checks kern.ipc.tls.rx_enable. So tests skip properly under either condition.                                    
- The old ktls_listening_socket test was testing both TX and RX in one body with duplicate structure. Refactoring it into a
shared helper ktls_listening_socket(tc, optname) and two separate ATF test cases (_tx / _rx) is cleaner and more correct —  
each can now carry its own ATF_REQUIRE_KTLS / ATF_REQUIRE_KTLS_RX check.                                                    
- The ATF_TP_ADD_TC registration at the bottom correctly replaces the single old test with the two new ones.
                                                                                                                            
Man page: ktls.4 is updated appropriately.
tests/sys/kern/ktls_test.c
91

Humm, it feels a bit odd to mix a macro and a function? Another approach would be to call ATF_REQUIRE_KTLS() from the body of require_ktls_rx() which might be cleaner as a "hard" enforcement that you always check the global before the rx knob?

tests/sys/kern/ktls_test.c
91

The approach you suggested sounds fine too.

ziaee added a reviewer: manpages.

I think this would be great for a Relnotes: yes!

Rework ATL_REQUIRE_KTLS_RX

This revision now requires review to proceed.Wed, Jul 1, 12:26 AM
This revision is now accepted and ready to land.Wed, Jul 1, 12:49 AM
This revision was automatically updated to reflect the committed changes.