[PATCH net 0/5] tls: fixes for record type handling with PEEK

2024-02-15 Thread Sabrina Dubroca
he main loop) - records of the same type (even DATA) shouldn't be merged if one record of a different type comes in between Sabrina Dubroca (5): tls: break out of main loop when PEEK gets a non-data record tls: stop recv() if initial process_rx_list gave us non-DATA tls: don't

[PATCH net 5/5] selftests: tls: add test for peeking past a record of a different type

2024-02-15 Thread Sabrina Dubroca
If we queue 3 records: - record 1, type DATA - record 2, some other type - record 3, type DATA the current code can look past the 2nd record and merge the 2 data records. Signed-off-by: Sabrina Dubroca --- tools/testing/selftests/net/tls.c | 19 +++ 1 file changed, 19

[PATCH net 2/5] tls: stop recv() if initial process_rx_list gave us non-DATA

2024-02-15 Thread Sabrina Dubroca
loop since the record was not DATA Just check the record type and jump to the end in case process_rx_list did some work. Fixes: 692d7b5d1f91 ("tls: Fix recvmsg() to be able to peek across multiple records") Signed-off-by: Sabrina Dubroca --- net/tls/tls_sw.c | 2 +- 1 file changed, 1

[PATCH net 3/5] tls: don't skip over different type records from the rx_list

2024-02-15 Thread Sabrina Dubroca
t had more data available. Fixes: 692d7b5d1f91 ("tls: Fix recvmsg() to be able to peek across multiple records") Signed-off-by: Sabrina Dubroca --- net/tls/tls_sw.c | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/net/tls/tls_sw.c b/net/tls/tl

[PATCH net 4/5] selftests: tls: add test for merging of same-type control messages

2024-02-15 Thread Sabrina Dubroca
Two consecutive control messages of the same type should never be merged into one large received blob of data. Signed-off-by: Sabrina Dubroca --- tools/testing/selftests/net/tls.c | 26 ++ 1 file changed, 26 insertions(+) diff --git a/tools/testing/selftests/net/tls.c

[PATCH net 1/5] tls: break out of main loop when PEEK gets a non-data record

2024-02-15 Thread Sabrina Dubroca
le to peek across multiple records") Signed-off-by: Sabrina Dubroca --- net/tls/tls_sw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tls/tls_sw.c b/net/tls/tls_sw.c index 9fbc70200cd0..78aedfc682ba 100644 --- a/net/tls/tls_sw.c +++ b/net/tls/tls_sw.c @@ -2064,6 +206

Re: [PATCH net 3/5] tls: don't skip over different type records from the rx_list

2024-02-19 Thread Sabrina Dubroca
2024-02-19, 12:07:03 -0800, Jakub Kicinski wrote: > On Thu, 15 Feb 2024 17:17:31 +0100 Sabrina Dubroca wrote: > > @@ -1772,7 +1772,8 @@ static int process_rx_list(struct tls_sw_context_rx > > *ctx, > >u8 *control, > >

Re: [PATCH net 3/5] tls: don't skip over different type records from the rx_list

2024-02-21 Thread Sabrina Dubroca
2024-02-20, 17:50:53 -0800, Jakub Kicinski wrote: > On Tue, 20 Feb 2024 00:10:58 +0100 Sabrina Dubroca wrote: > > 2024-02-19, 12:07:03 -0800, Jakub Kicinski wrote: > > > On Thu, 15 Feb 2024 17:17:31 +0100 Sabrina Dubroca wrote: > > > > @@ -1772,7 +1772,8 @@ sta

Re: [PATCH net 3/5] tls: don't skip over different type records from the rx_list

2024-02-21 Thread Sabrina Dubroca
2024-02-21, 10:33:30 -0800, Jakub Kicinski wrote: > On Wed, 21 Feb 2024 14:59:40 +0100 Sabrina Dubroca wrote: > > It's not exactly enough, since tls_record_content_type will return 0 > > on a content type mismatch. We'll have to translate that into an > > "

[PATCH net 3/4] selftests: tls: add test with a partially invalid iov

2024-03-25 Thread Sabrina Dubroca
Make sure that we don't return more bytes than we actually received if the userspace buffer was bogus. We expect to receive at least the rest of rec1, and possibly some of rec2 (currently, we don't, but that would be ok). Signed-off-by: Sabrina Dubroca --- tools/testing/selftests/net/

[PATCH net] selftests: tls: swap the TX and RX sockets in some tests

2023-09-12 Thread Sabrina Dubroca
ftests: tls: add selftests for TLS sockets") Signed-off-by: Sabrina Dubroca --- tools/testing/selftests/net/tls.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/net/tls.c b/tools/testing/selftests/net/tls.c index 297d972558fb..464853a7f982 10064

Re: [PATCH net-next v3 0/2] fix icmp error source address over xfrm tunnel

2024-05-06 Thread Sabrina Dubroca
2024-05-06, 09:58:26 +0200, Antony Antony wrote: > Hi, > This fix, originally intended for XFRM/IPsec, has been recommended by > Steffen Klassert to submit to the net tree. > > The patch addresses a minor issue related to the IPv4 source address of > ICMP error messages, which originated from an o

Re: [PATCH net-next v3 2/2] selftests/net: add ICMP unreachable over IPsec tunnel

2024-05-07 Thread Sabrina Dubroca
Hi Antony, 2024-05-06, 10:05:54 +0200, Antony Antony wrote: > diff --git a/tools/testing/selftests/net/xfrm_state.sh > b/tools/testing/selftests/net/xfrm_state.sh > new file mode 100755 > index ..26eac013abcf > --- /dev/null > +++ b/tools/testing/selftests/net/xfrm_state.sh [...] > +r

Re: [PATCH net-next v3 0/2] fix icmp error source address over xfrm tunnel

2024-05-07 Thread Sabrina Dubroca
2024-05-06, 17:57:23 +0200, Antony Antony wrote: > Hi Sabrina, > > On Mon, May 06, 2024 at 03:36:15PM +0200, Sabrina Dubroca via Devel wrote: > > 2024-05-06, 09:58:26 +0200, Antony Antony wrote: > > > Hi, > > > This fix, originally intended for XFRM/IPsec, has

[PATCH net-next] selftests: tls: add a selftest for wrapping rec_seq

2024-10-18 Thread Sabrina Dubroca
Set the initial rec_seq to 0x so that it wraps immediately. The send() call should fail with EBADMSG. A bug in this code was fixed in commit cfaa80c91f6f ("net/tls: do not free tls_rec on async operation in bpf_exec_tx_verdict()"). Signed-off-by: Sabrina Dubroca

[PATCH net-next 6/8] selftests: move macsec offload tests from net/rtnetlink to drivers/net/netdvesim

2024-11-06 Thread Sabrina Dubroca
We're going to expand this test, and macsec offload is only lightly related to rtnetlink. Signed-off-by: Sabrina Dubroca --- .../selftests/drivers/net/netdevsim/Makefile | 1 + .../selftests/drivers/net/netdevsim/config| 1 + .../drivers/net/netdevsim/macsec-offload.sh

[PATCH net-next 4/8] macsec: clean up local variables in macsec_notify

2024-11-06 Thread Sabrina Dubroca
For all events, we need to loop over the list of secys, so let's move the common variables out of the switch/case. Signed-off-by: Sabrina Dubroca --- drivers/net/macsec.c | 25 +++-- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/net/macse

[PATCH net-next 7/8] selftests: netdevsim: add test toggling macsec offload

2024-11-06 Thread Sabrina Dubroca
The test verifies that toggling offload works (both via rtnetlink and macsec's genetlink APIs). This is only possible when no SA is configured. Signed-off-by: Sabrina Dubroca --- .../drivers/net/netdevsim/macsec-offload.sh | 21 +++ 1 file changed, 21 insertions(+) diff

[PATCH net-next 3/8] macsec: add some of the lower device's features when offloading

2024-11-06 Thread Sabrina Dubroca
set, and they're then removed via ndo_fix_features (macsec_fix_features). This allows the offloadable features to be automatically enabled if offloading is turned on after device creation. Signed-off-by: Sabrina Dubroca --- drivers/net/macsec.c | 17 +++-- 1 file changed, 15

[PATCH net-next 5/8] macsec: inherit lower device's TSO limits when offloading

2024-11-06 Thread Sabrina Dubroca
If macsec is offloaded, we need to follow the lower device's capabilities, like VLAN devices do. Leave the limits unchanged when the offload is disabled. Signed-off-by: Sabrina Dubroca --- drivers/net/macsec.c | 22 ++ 1 file changed, 22 insertions(+) diff --git a/dr

[PATCH net-next 2/8] selftests: netdevsim: add a test checking ethtool features

2024-11-06 Thread Sabrina Dubroca
Add a test checking that some features are active by default and changeable. Signed-off-by: Sabrina Dubroca --- .../selftests/drivers/net/netdevsim/Makefile | 1 + .../drivers/net/netdevsim/ethtool-features.sh | 31 +++ 2 files changed, 32 insertions(+) create mode 100644

[PATCH net-next 8/8] selftests: netdevsim: add ethtool features to macsec offload tests

2024-11-06 Thread Sabrina Dubroca
The test verifies that available features aren't changed by toggling offload on the device. Creating a device with offload off and then enabling it later should result in the same features as creating the device with offload enabled directly. Signed-off-by: Sabrina Dubroca --- .../driver

[PATCH net-next 0/8] macsec: inherit lower device's features and TSO limits when offloading

2024-11-06 Thread Sabrina Dubroca
t TSO limits from the lower device, like VLAN/macvlan devices do. This series also moves the existing macsec offload selftest to the netdevsim selftests before adding tests for the new features. To allow this new selftest to work, netdevsim's hw_features are expanded. Sabrina Dubroca (8):

[PATCH net-next 1/8] netdevsim: add more hw_features

2024-11-06 Thread Sabrina Dubroca
Then HW_CSUM (and thus TSO, thanks to netdev_fix_features) is not automatically turned back on when offload is re-enabled. Signed-off-by: Sabrina Dubroca --- drivers/net/netdevsim/netdev.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/netdevsim/netde

[PATCH net-next v4 1/6] tls: block decryption when a rekey is pending

2024-11-14 Thread Sabrina Dubroca
E to set key_update_pending to pair with ->poll's lockless read Signed-off-by: Sabrina Dubroca --- include/net/tls.h | 3 +++ net/tls/tls_sw.c | 35 +++ 2 files changed, 38 insertions(+) diff --git a/include/net/tls.h b/include/net/tls.h index 3a33924db2

[PATCH net-next v4 0/6] tls: implement key updates for TLS1.3

2024-11-14 Thread Sabrina Dubroca
l.net/ [v3] Link: https://lore.kernel.org/netdev/cover.1676052788.git...@queasysnail.net/ [v2] Link: https://lore.kernel.org/netdev/cover.1673952268.git...@queasysnail.net/ [v1] Link: https://www.rfc-editor.org/rfc/rfc8446#section-4.6.3 [1] Link: https://gitlab.com/gnutls/gnutls/-/merge_requests/1625

[PATCH net-next v4 5/6] selftests: tls: add key_generation argument to tls_crypto_info_init

2024-11-14 Thread Sabrina Dubroca
This allows us to generate different keys, so that we can test that rekey is using the correct one. v3: update for newly added tests v4: update for newly added tests Signed-off-by: Sabrina Dubroca --- tools/testing/selftests/net/tls.c | 20 +++- 1 file changed, 11 insertions

[PATCH net-next v4 3/6] tls: add counters for rekey

2024-11-14 Thread Sabrina Dubroca
This introduces 4 counters to keep track of key updates: Tls{Rx,Tx}Rekey{Ok,Error}. v4: new patch Suggested-by: Jakub Kicinski Signed-off-by: Sabrina Dubroca --- include/uapi/linux/snmp.h | 4 net/tls/tls_main.c| 27 ++- net/tls/tls_proc.c| 4

[PATCH net-next v4 4/6] docs: tls: document TLS1.3 key updates

2024-11-14 Thread Sabrina Dubroca
v3: added following Jakub's comment on the cover letter v4: add the new counters Signed-off-by: Sabrina Dubroca --- Documentation/networking/tls.rst | 31 +++ 1 file changed, 31 insertions(+) diff --git a/Documentation/networking/tls.rst b/Documentation/netwo

[PATCH net-next v4 2/6] tls: implement rekey for TLS1.3

2024-11-14 Thread Sabrina Dubroca
sk_poll to not say the socket is readable when we're waiting for a rekey, and wake up poll() when the new key is installed - use unsafe_memcpy to make FORTIFY_SOURCE happy v4: - rebase on top of current net-next - no {} needed around single line (Simon) Signed-off-by: Sabrina Dubroca ---

[PATCH net-next v4 6/6] selftests: tls: add rekey tests

2024-11-14 Thread Sabrina Dubroca
v2: add rekey_fail test (reject changing the version/cipher) v3: add rekey_peek_splice following Jakub's comment add rekey+poll tests v4: rebase, new selftests were added check that rekey isn't supported on TLS1.2 Signed-off-by: Sabrina Dubroca --- tools/testing/selftests

Re: [PATCH net-next v4 0/6] tls: implement key updates for TLS1.3

2024-12-03 Thread Sabrina Dubroca
Hey Jakub, 2024-11-18, 19:41:58 -0800, Jakub Kicinski wrote: > On Thu, 14 Nov 2024 16:50:47 +0100 Sabrina Dubroca wrote: > > This adds support for receiving KeyUpdate messages (RFC 8446, 4.6.3 > > [1]). A sender transmits a KeyUpdate message and then changes its TX > > key

Re: [PATCH net-next v4 4/6] docs: tls: document TLS1.3 key updates

2024-12-05 Thread Sabrina Dubroca
2024-12-03, 19:51:29 -0800, Jakub Kicinski wrote: > On Thu, 14 Nov 2024 16:50:51 +0100 Sabrina Dubroca wrote: > > +To prevent attempting to decrypt incoming records using the wrong key, > > +decryption will be paused when a KeyUpdate message is received by the > > +kernel,

Re: [PATCH net-next v4 1/6] tls: block decryption when a rekey is pending

2024-12-10 Thread Sabrina Dubroca
2024-12-03, 19:47:01 -0800, Jakub Kicinski wrote: > On Thu, 14 Nov 2024 16:50:48 +0100 Sabrina Dubroca wrote: > > +static int tls_check_pending_rekey(struct tls_context *ctx, struct sk_buff > > *skb) > > +{ > > + const struct tls_msg *tlm = tls_msg(skb); > &g

[PATCH net-next v5 5/6] selftests: tls: add key_generation argument to tls_crypto_info_init

2024-12-12 Thread Sabrina Dubroca
This allows us to generate different keys, so that we can test that rekey is using the correct one. Signed-off-by: Sabrina Dubroca --- v3: update for newly added tests v4: update for newly added tests tools/testing/selftests/net/tls.c | 20 +++- 1 file changed, 11 insertions

[PATCH net-next v5 0/6] tls: implement key updates for TLS1.3

2024-12-12 Thread Sabrina Dubroca
3] Link: https://lore.kernel.org/netdev/cover.1676052788.git...@queasysnail.net/ [v2] Link: https://lore.kernel.org/netdev/cover.1673952268.git...@queasysnail.net/ [v1] Link: https://www.rfc-editor.org/rfc/rfc8446#section-4.6.3 [1] Link: https://gitlab.com/gnutls/gnutls/-/merge_requests/1625 [2]

[PATCH net-next v5 1/6] tls: block decryption when a rekey is pending

2024-12-12 Thread Sabrina Dubroca
that record, and stop recvmsg/splice calls with EKEYEXPIRED until the new key is available. key_update_pending can't be combined with the existing bitfield, because we will read it locklessly in ->poll. Signed-off-by: Sabrina Dubroca --- v3: - move key_update_pending check into tls_rx_

[PATCH net-next v5 3/6] tls: add counters for rekey

2024-12-12 Thread Sabrina Dubroca
This introduces 5 counters to keep track of key updates: Tls{Rx,Tx}Rekey{Ok,Error} and TlsRxRekeyReceived. Suggested-by: Jakub Kicinski Signed-off-by: Sabrina Dubroca --- v4: new patch, suggested by Jakub v5: add TlsRxRekeyReceived include/uapi/linux/snmp.h | 5 + net/tls/tls_main.c

[PATCH net-next v5 6/6] selftests: tls: add rekey tests

2024-12-12 Thread Sabrina Dubroca
Test the kernel's ability to: - update the key (but not the version or cipher), only for TLS1.3 - pause decryption after receiving a KeyUpdate message, until a new RX key has been provided - reflect the pause/non-readable socket in poll() Signed-off-by: Sabrina Dubroca --- v2

[PATCH net-next v5 4/6] docs: tls: document TLS1.3 key updates

2024-12-12 Thread Sabrina Dubroca
Document the kernel's behavior and userspace expectations. Suggested-by: Jakub Kicinski Signed-off-by: Sabrina Dubroca --- v3: added following Jakub's comment on the cover letter v4: add the new counters v5: improve wording for poll() (Jakub) add the new counter Documentation/

[PATCH net-next v5 2/6] tls: implement rekey for TLS1.3

2024-12-12 Thread Sabrina Dubroca
. This change only affects tls_sw, since 1.3 offload isn't supported. Signed-off-by: Sabrina Dubroca Acked-by: Jakub Kicinski --- v2: - reverse xmas tree - turn the alt_crypto_info into an else if - don't modify the context when rekey fails v3: - only call tls_sw_strparser_arm wh

Re: [PATCH net-next v4 3/6] tls: add counters for rekey

2024-12-05 Thread Sabrina Dubroca
2024-12-03, 19:54:14 -0800, Jakub Kicinski wrote: > On Thu, 14 Nov 2024 16:50:50 +0100 Sabrina Dubroca wrote: > > This introduces 4 counters to keep track of key updates: > > Tls{Rx,Tx}Rekey{Ok,Error}. > > Possibly track detected rekey messages, too? Could help us identify