Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147726032
D21796.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D21796.diff
View Options
Index: head/sys/kern/kern_mbuf.c
===================================================================
--- head/sys/kern/kern_mbuf.c
+++ head/sys/kern/kern_mbuf.c
@@ -1171,6 +1171,7 @@
ext_pgs->nrdy = 0;
ext_pgs->first_pg_off = 0;
ext_pgs->last_pg_len = 0;
+ ext_pgs->flags = 0;
ext_pgs->hdr_len = 0;
ext_pgs->trail_len = 0;
ext_pgs->tls = NULL;
Index: head/sys/kern/uipc_ktls.c
===================================================================
--- head/sys/kern/uipc_ktls.c
+++ head/sys/kern/uipc_ktls.c
@@ -1363,7 +1363,7 @@
* (from sendfile), anonymous wired pages are
* allocated and assigned to the destination iovec.
*/
- is_anon = M_WRITABLE(m);
+ is_anon = (pgs->flags & MBUF_PEXT_FLAG_ANON) != 0;
off = pgs->first_pg_off;
for (i = 0; i < pgs->npgs; i++, off = 0) {
@@ -1416,6 +1416,9 @@
/* Use the basic free routine. */
m->m_ext.ext_free = mb_free_mext_pgs;
+
+ /* Pages are now writable. */
+ pgs->flags |= MBUF_PEXT_FLAG_ANON;
}
/*
Index: head/sys/kern/uipc_mbuf.c
===================================================================
--- head/sys/kern/uipc_mbuf.c
+++ head/sys/kern/uipc_mbuf.c
@@ -1664,6 +1664,7 @@
prev->m_next = mb;
prev = mb;
pgs = mb->m_ext.ext_pgs;
+ pgs->flags = MBUF_PEXT_FLAG_ANON;
needed = length = MIN(maxseg, total);
for (i = 0; needed > 0; i++, needed -= PAGE_SIZE) {
retry_page:
Index: head/sys/sys/mbuf.h
===================================================================
--- head/sys/sys/mbuf.h
+++ head/sys/sys/mbuf.h
@@ -312,7 +312,7 @@
* - 21 (AES-CBC with explicit IV)
* - 13 (AES-GCM with 8 byte explicit IV)
*/
-#define MBUF_PEXT_HDR_LEN 24
+#define MBUF_PEXT_HDR_LEN 23
/*
* TLS records for TLS 1.0-1.2 can have the following maximum trailer
@@ -333,6 +333,8 @@
#define MBUF_PEXT_MAX_BYTES \
(MBUF_PEXT_MAX_PGS * PAGE_SIZE + MBUF_PEXT_HDR_LEN + MBUF_PEXT_TRAIL_LEN)
+#define MBUF_PEXT_FLAG_ANON 1 /* Data can be encrypted in place. */
+
/*
* This struct is 256 bytes in size and is arranged so that the most
* common case (accessing the first 4 pages of a 16KB TLS record) will
@@ -347,6 +349,7 @@
uint16_t last_pg_len; /* Length of last page */
vm_paddr_t pa[MBUF_PEXT_MAX_PGS]; /* phys addrs of pages */
char hdr[MBUF_PEXT_HDR_LEN]; /* TLS header */
+ uint8_t flags; /* Flags */
struct ktls_session *tls; /* TLS session */
#if defined(__i386__) || \
(defined(__powerpc__) && !defined(__powerpc64__) && defined(BOOKE))
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Mar 14, 5:42 AM (1 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29655124
Default Alt Text
D21796.diff (2 KB)
Attached To
Mode
D21796: Fix a sw ktls bug where we would never encrypt anonymous data in place
Attached
Detach File
Event Timeline
Log In to Comment