Skip to content

Support rust InetSockets in the network interface#2713

Merged
stevenengler merged 3 commits intoshadow:mainfrom
stevenengler:wrap-tcp-rust
Feb 2, 2023
Merged

Support rust InetSockets in the network interface#2713
stevenengler merged 3 commits intoshadow:mainfrom
stevenengler:wrap-tcp-rust

Conversation

@stevenengler
Copy link
Copy Markdown
Contributor

@stevenengler stevenengler commented Feb 1, 2023

Changes:

  • add a remove_all_sockets method to the network interface — since sockets might access the global host when they're freed/dropped, we should free/drop the sockets while the global host is still set (so before we drop the host)
  • when adding a socket to the qdisc, check for the canonical handle rather than the pointer address (involves a hash table iteration unfortunately) — closes Rust sockets can be added to the qdisc more than once #2704
  • add the tcp socket to the network interface as a rust InetSocket rather than as a LegacySocket

The benchmark results change slightly for some reason, but they're very similar in both the tgen and tor benchmarks.

tgen

1675355279_grim
1675355309_grim
bytes_read_count_timeseries
time_to_last_byte_recv_1048576_timeseries

tor

run_time
transfer_time_5242880 exit

@stevenengler stevenengler self-assigned this Feb 1, 2023
@github-actions github-actions bot added the Component: Main Composing the core Shadow executable label Feb 1, 2023
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 1, 2023

Codecov Report

Base: 67.82% // Head: 68.07% // Increases project coverage by +0.25% 🎉

Coverage data is based on head (5ef8005) compared to base (b4a1313).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2713      +/-   ##
==========================================
+ Coverage   67.82%   68.07%   +0.25%     
==========================================
  Files         203      203              
  Lines       30509    30513       +4     
  Branches     5970     5970              
==========================================
+ Hits        20693    20772      +79     
+ Misses       5117     5038      -79     
- Partials     4699     4703       +4     
Flag Coverage Δ
tests 68.07% <100.00%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/host/descriptor/socket/inet/mod.rs 43.30% <100.00%> (+15.18%) ⬆️
src/main/host/network_interface.rs 91.80% <100.00%> (+0.42%) ⬆️
src/main/network/net_namespace.rs 78.37% <100.00%> (+0.39%) ⬆️
src/main/core/logger/shadow_logger.rs 69.61% <0.00%> (-2.77%) ⬇️
src/lib/shmem/src/scmutex.rs 87.05% <0.00%> (-2.36%) ⬇️
src/test/futex/test_futex.c 64.00% <0.00%> (-1.78%) ⬇️
src/main/host/descriptor/pipe.rs 84.37% <0.00%> (-0.63%) ⬇️
src/main/host/memory_manager/memory_mapper.rs 71.00% <0.00%> (-0.60%) ⬇️
src/main/host/process.rs 79.81% <0.00%> (-0.11%) ⬇️
src/lib/tsc/tsc_test.c 12.67% <0.00%> (ø)
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@stevenengler stevenengler force-pushed the wrap-tcp-rust branch 2 times, most recently from cce0916 to 5490787 Compare February 1, 2023 20:03
@stevenengler stevenengler marked this pull request as ready for review February 2, 2023 16:33
`CompatSocket`s that point to rust `InetSocket`s might store different
addresses that point to the same underlying socket object. So if two tagged
pointers are different, it doesn't mean that they point to different sockets.
@stevenengler stevenengler merged commit 520184d into shadow:main Feb 2, 2023
@stevenengler stevenengler deleted the wrap-tcp-rust branch February 2, 2023 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Main Composing the core Shadow executable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust sockets can be added to the qdisc more than once

2 participants