287 Commits
Author SHA1 Message Date
Lucas ManningandgVisor bot 95ad423f8c Don't return empty translation in ring buffer during bus error.
Reported-by: syzbot+b441fb97dc83729a444d@syzkaller.appspotmail.com
PiperOrigin-RevId: 726111936
2025-02-12 10:43:52 -08:00
Lucas ManningandgVisor bot d6454b486f Lock around packetmmap cooked field and check for PACKET_RESERVE opt size.
Reported-by: syzbot+ca91395278b8bbe45820@syzkaller.appspotmail.com
Reported-by: syzbot+7786024ead82f25b39c5@syzkaller.appspotmail.com
PiperOrigin-RevId: 725302503
2025-02-10 12:18:14 -08:00
Lucas ManningandgVisor bot faac8f36cd Add support for PACKET_STATISTICS.
PiperOrigin-RevId: 725271073
2025-02-10 10:46:54 -08:00
Lucas ManningandgVisor bot 9c490f813d Implement GetSockOpt PACKET_HDRLEN and add a test for tcpdump.
PiperOrigin-RevId: 724445536
2025-02-07 13:06:14 -08:00
Lucas ManningandgVisor bot 25084ce9ed Add locking around packetmmap initialization and mode.
Reported-by: syzbot+0bd17f07432518e1a3f4@syzkaller.appspotmail.com
Reported-by: syzbot+c461ce33fdf84ea55105@syzkaller.appspotmail.com
Reported-by: syzbot+8d5e8d31b8303257b69f@syzkaller.appspotmail.com
PiperOrigin-RevId: 724407775
2025-02-07 11:13:16 -08:00
Lucas ManningandgVisor bot 213917f3ea Don't switch to using the packet mmap endpoint for zero length requests.
This matches linux's behavior.

Reported-by: syzbot+31f4b63198c23c53c6e2@syzkaller.appspotmail.com
Reported-by: syzbot+e19f276e27cccbbecd0e@syzkaller.appspotmail.com
PiperOrigin-RevId: 724032784
2025-02-06 12:34:46 -08:00
Ayush RanjanandgVisor bot d8518f2991 Validate PACKET_RX_RING and PACKET_VERSION socket option value size.
Reported-by: syzbot+0e132bb052dcf3804e31@syzkaller.appspotmail.com
Reported-by: syzbot+8e48cb352eb08dc2c8ab@syzkaller.appspotmail.com
PiperOrigin-RevId: 723999333
2025-02-06 11:04:23 -08:00
Lucas ManningandgVisor bot 6194338723 Add support for setting PACKET_VERSION for PACKET_MMAP.
tcpdump requires TPACKET_V2 to work properly.

PiperOrigin-RevId: 723670574
2025-02-05 15:19:34 -08:00
Lucas ManningandgVisor bot 83a4caf2a7 Implement MappablePacketEndpoint for PACKET_MMAP and add tests.
PiperOrigin-RevId: 723590936
2025-02-05 11:39:27 -08:00
Lucas ManningandgVisor bot 0f8896589f Implement the PacketMMapEndpoint interface for PACKET_MMAP.
This code is tested in the subsequent change with syscall tests.

PiperOrigin-RevId: 721861305
2025-01-31 12:26:38 -08:00
Andrei Vagin f010ae01ac Fix a few typos 2025-01-29 21:16:51 -08:00
clickyotomy 4a8209f26f netfilter: Support multiport matching (-m multiport)
This set of changes adds:

  - support for `xt_multiport_{,v1}` matchers for matching for
    a range of ports and their inverse, i.e.,:

      ```
      -m multiport [!] --[s|d]ports (PORT,...|PORT:PORT,...)
      ```

  - support for `IP{,6}T_SO_GET_REVISION_MATCH` socket options,
    which allows `iptables` to query for the highest supported
    revision for a given matcher
2025-01-18 09:46:30 -05:00
Nayana BidariandgVisor bot a3e5887415 Changes to support netstack save restore.
- Added a new Stats() method in inet.Stack to get the saved stats
during restore.
- Mark stack.nic, tcpip.Route and stack.addressState structs as "nosave".
These fields should not be saved because the IP addresses and routes can
change during restore and new configuration of routes and IP addresses will be
extracted from the restore spec and initialized in the saved stack.
- Changes in Restore() method in icmp, udp, tcp, packet and raw endpoint files
to support save restore of these endpoints. These changes are flag guarded by
the TESTONLY-save-restore-netstack flag.

PiperOrigin-RevId: 707639274
2024-12-18 12:52:22 -08:00
Jing ChenandgVisor bot c88ffa321e Returns ENOBUFS when writing to a veth device whose buffer is full.
A task is stuck when it keeps sendMsg w/o any recvMsg  until  the number of
message exceeds the buffer limit. The change also significantly bumps the
limit from 64 to 1000 for a larger buffer.

Reported-by: syzbot+8788f5c1ba95e12ab07d@syzkaller.appspotmail.com
Reported-by: syzbot+67759fceac0c30ece991@syzkaller.appspotmail.com
PiperOrigin-RevId: 704904404
2024-12-10 17:35:54 -08:00
Lucas ManningandgVisor bot 2267c24a41 Add support for custom socket options and setting the experiment IP option.
PiperOrigin-RevId: 700011458
2024-11-25 09:43:21 -08:00
Nayana BidariandgVisor bot df9ba5fb67 Restore listening connections when netstack s/r is enabled.
This CL restores the listening connections when netstack s/r is enabled.
The changes include:
- New method as a workaround to replace the new routes and nics to the loaded
stack after restore.
- New Restore() for transport layer protocols to restore the protocol level
background workers.
- Adds afterLoad() method for fdbased processors.
- Adds a test to verify listening connection is restored after checkpointing
with netstack s/r enabled.
- Few other changes to save restore fields to enable netstack s/r.

PiperOrigin-RevId: 698453124
2024-11-20 11:13:57 -08:00
Jamie LiuandgVisor bot e23347e5b5 Move //pkg/sentry/kernel/time to //pkg/sentry/ktime.
This avoids needing to rename it everywhere it's imported.

PiperOrigin-RevId: 693930089
2024-11-06 18:13:51 -08:00
Koichi Shiraishi 0cf77c02f8 all: remove use io/ioutil deprecated package & fix some deprecated thing
Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
2024-10-10 20:36:24 +09:00
Jing ChenandgVisor bot f681bcc095 Implement RTM_DELROUTE in netstack.
PiperOrigin-RevId: 675711612
2024-09-17 14:33:41 -07:00
Nayana BidariandgVisor bot 740dc367db Mark netstack as save and use it only in tests
- Adds a new flag which will enable netstack s/r. When the flag is not enabled,
there is no change in the existing behavior. The flag will be enabled only in
tests to verify the s/r functionality of netstack.
- Some additional fields in netstack were causing panic when netstack is
save/restored. Such fields are marked as 'save'/'nosave' accordingly to resolve
the panic.

PiperOrigin-RevId: 668566657
2024-08-28 12:49:43 -07:00
Kevin KrakauerandgVisor bot 626010438a noop upon IP_PMTUDISC_INTERFACE and IP_PMTUDISC_OMIT
This is what we did previously, and doing so avoids breaking some users.

Fixes #10760.

PiperOrigin-RevId: 663358270
2024-08-15 10:35:00 -07:00
Jing ChenandgVisor bot 35309c96c0 Implement RTM_NEWROUTE in netstack to create/replace a route.
PiperOrigin-RevId: 650814137
2024-07-09 18:04:19 -07:00
Jing ChenandgVisor bot b0ee04a097 Skip IFLA_TXQLEN and IFA_BROADCAST in gVisor.
The attributes are expected by Dockerd to start. In gVisor, skipping
the attributes is good enough to run the Docker workloads.

PiperOrigin-RevId: 650362257
2024-07-08 13:49:26 -07:00
Jing ChenandgVisor bot 096478a2ff Fix the MAC address parse in IFLA_ADDRESS and add the tests.
PiperOrigin-RevId: 650333797
2024-07-08 12:19:08 -07:00
Andrei VaginandgVisor bot b488752cba netstack: implement RTM_SETLINK/IFLA_NET_NS_FD
IFLA_NET_NS_FD specifies a file descriptor that refers to a network namespace.

PiperOrigin-RevId: 648882826
2024-07-02 16:49:27 -07:00