Skip to content

Commit af597ab

Browse files
hlefdavidchisnall
authored andcommitted
firewall: send a read-only/non-capturable buffer to the TCP/IP stack.
The firewall currently sends a writable and capturable frame buffer capability to the TCP/IP stack. This is bad because the TCP/IP stack can keep the capability and alter the buffer at a later point when we re-use it. Not sure what the exact impact is, but it sounds like the TCP/IP may be able to use this to add endpoints to the firewall table. Signed-off-by: Hugo Lefeuvre <[email protected]>
1 parent 45f6872 commit af597ab

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/firewall/firewall.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,11 @@ void __cheri_compartment("Firewall") ethernet_run_driver()
10821082
auto &frame = *maybeFrame;
10831083
if (packet_filter_ingress(frame.buffer, frame.length))
10841084
{
1085-
ethernet_receive_frame(frame.buffer, frame.length);
1085+
// Send the frame buffer to the TCP/IP stack as
1086+
// a read-only, non-capturable capability.
1087+
CHERI::Capability frameBuffer{frame.buffer};
1088+
frameBuffer.permissions() &= CHERI::Permission::Load;
1089+
ethernet_receive_frame(frameBuffer, frame.length);
10861090
}
10871091
}
10881092
receivedCounter += packets;

0 commit comments

Comments
 (0)