handleConnect handles the bind(2) syscall.
(n *seccomp.Notif, fd int, addrPtr uintptr, addrSize int)
| 348 | |
| 349 | // handleConnect handles the bind(2) syscall. |
| 350 | func (p *Process) handleBind(n *seccomp.Notif, fd int, addrPtr uintptr, addrSize int) error { |
| 351 | s, ok := p.getSocket(fd) |
| 352 | if !ok { |
| 353 | return n.Skip() |
| 354 | } |
| 355 | |
| 356 | bind, errno, err := p.vmReadSockaddr(n, addrPtr, addrSize) |
| 357 | if err != nil { |
| 358 | return fmt.Errorf("read bind addr: %w", err) |
| 359 | } |
| 360 | if errno != 0 { |
| 361 | return n.Return(0, errno) |
| 362 | } |
| 363 | |
| 364 | errno, err = s.Bind(bind) |
| 365 | if err != nil { |
| 366 | return fmt.Errorf("bind socket: %w", err) |
| 367 | } |
| 368 | return n.Return(0, errno) |
| 369 | } |
| 370 | |
| 371 | // handleConnect handles the connect(2) syscall. |
| 372 | func (p *Process) handleConnect(n *seccomp.Notif, fd int, addrPtr uintptr, addrSize int) error { |