Commit 7a2154c
committed
fix(net): defer the named-unix sendto path and align batch partial semantics
Addresses review on the connected-AF_UNIX sendmsg change.
- sendto_named_unix_on_behalf() still sent inline with a blocking libc::sendto()
on the notification loop. A child with only fs-write grants (no net rule) can
bind a datagram socket under a writable path, never drain it, and send until
the queue fills; the next blocking sendto would wedge the whole loop — the
same DoS this change fixes for the other send paths. Route it through
resolve_send (first attempt MSG_DONTWAIT on the loop, a blocking child's
would-block completed off-loop) by wrapping the already-copied data and pinned
inode in a MaterializedMsg, mirroring the sendmsg path.
- complete_batch_entry(): align the deferred batch tail with the kernel's
blocking-stream semantics. A sendmsg that makes any progress returns that byte
count and is a completed message (a hard error after partial progress surfaces
on the next call). Merge the two Ok arms: for any Ok(n) write n back as the
entry's msg_len and count it (prior_count + 1). The prior shape left a
partially-sent-then-errored entry uncounted, so the child would re-send bytes
the kernel already queued (duplicate data) or spin forever on a zero-progress
retry; it also never returns 0 for vlen > 0 now.1 parent cc3f33b commit 7a2154c
1 file changed
Lines changed: 34 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1000 | 1000 | | |
1001 | 1001 | | |
1002 | 1002 | | |
1003 | | - | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | | - | |
1012 | | - | |
1013 | | - | |
1014 | | - | |
1015 | | - | |
1016 | | - | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
1017 | 1011 | | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
1018 | 1022 | | |
1019 | 1023 | | |
1020 | 1024 | | |
| |||
1694 | 1698 | | |
1695 | 1699 | | |
1696 | 1700 | | |
1697 | | - | |
1698 | | - | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
1702 | | - | |
1703 | | - | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
1704 | 1715 | | |
1705 | 1716 | | |
1706 | 1717 | | |
| |||
1712 | 1723 | | |
1713 | 1724 | | |
1714 | 1725 | | |
1715 | | - | |
1716 | 1726 | | |
1717 | 1727 | | |
1718 | | - | |
1719 | | - | |
| 1728 | + | |
| 1729 | + | |
1720 | 1730 | | |
1721 | 1731 | | |
1722 | 1732 | | |
1723 | | - | |
1724 | | - | |
1725 | | - | |
1726 | 1733 | | |
1727 | 1734 | | |
1728 | 1735 | | |
| |||
0 commit comments