-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ktls buffer revamp #62
Conversation
This fixed the way that recvmsg is handled. Asynchronous worker now decrypts directly on skbuffs rather than using kernel_recvmsg. Records that come into TCP rcvq are cloned and assembled into a single skb. This skb is then converted to a sgvec and passed to decryption routine. Decryption routine decrypts inplace, and the skb is added to TLS rcvq. Recvmsg checks TLS rcvq and copies them to user buffer. There should only be a single copy during decryption- from skbuff to user space. Splice is not yet supported. Tested with af_ktls-tests. Basic functionalities work.
from the underlying socket in the event that a non-encrypted message is received. Some of the logic for reading the TLS record had to be changed. It is not safe to automatically read KTLS_TLS_PREPEND_SIZE bytes since control messages shorter than that would be missed.
…or. An error is raised when decryption fails in TLS_TCP_RECV
6bfe0f3
to
b15a7b8
Compare
tsk->iv_recv); | ||
|
||
/* | ||
* Decrypt in place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a serious bottleneck for AES GCM. We shouldn't decrypt in place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative would be to allocate another skb for decrypted data. According to Dave, decrypting in place does not incur any extra overhead. The hope is that once we fix high memory issues, we can use skb_clone() instead of skb_copy(), therefore requiring less space for decryption.
First commit looks like a bad merge and can be dropped |
/* | ||
*Copy header to use later in decryption. | ||
*An optimization could be to zero-copy, but you'd | ||
*have to be able to deal with frag_list bs. This function call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove 'bs'
So it turns out there is no issue of high memory. The scatterwalk API _does_ kmap pages as necessary. The actual bug was me being stupid and not initializing the sgtable every time, causing some of the pages to be marked as "sg_last_page" when they actually are not and causing null pointer exceptions
a10c59c
to
caa407d
Compare
OK, so could we merge this with the first patch dropped and with removed changes in gitignore file (4c454ba and b15a7b8)? And also with this change: #62 (comment) |
Yes, I think it is ready. This code is passing FB tests as well. |
…surpass ALG_MAX_PAGES. Also added ret check to decrypt_skb
…nd(). Also unrelated comment patches
62e4f8b
to
509e432
Compare
Pull request that includes all my diffs for the past 2 weeks.