Page MenuHomeFreeBSD

bhyve: Set SO_REUSEADDR on the gdb stub socket
ClosedPublic

Authored by markj on Apr 29 2021, 3:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 2, 5:19 AM
Unknown Object (File)
Sat, Nov 2, 5:19 AM
Unknown Object (File)
Sat, Nov 2, 5:19 AM
Unknown Object (File)
Sat, Nov 2, 4:57 AM
Unknown Object (File)
Oct 1 2024, 8:50 PM
Unknown Object (File)
Sep 19 2024, 1:44 AM
Unknown Object (File)
Sep 17 2024, 9:32 AM
Unknown Object (File)
Sep 9 2024, 3:39 AM

Details

Summary

When using bhyve's gdb stub to debug some changes to the kernel's early
boot code, I frequently hit an error when reconnecting gdb. Set
SO_REUSEADDR to mitigate this, as we do for the VNC server.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 38924
Build 35813: arc lint + arc unit

Event Timeline

markj requested review of this revision.Apr 29 2021, 3:52 PM
usr.sbin/bhyve/gdb.c
1846

Why no check for errors from setsockopt call?

jhb added a subscriber: jhb.
jhb added inline comments.
usr.sbin/bhyve/gdb.c
1846

Because failure isn't fatal probably? The VNC code in rfb.c doesn't check for errors either. In practice I don't think SO_REUSEADDR can fail for a TCP socket on FreeBSD.

This revision is now accepted and ready to land.Apr 29 2021, 4:54 PM
usr.sbin/bhyve/gdb.c
1846

This was exactly my reasoning.

usr.sbin/bhyve/gdb.c
1846

The man page clearly indicates it can fail, and the one in dbgport.c does check status.

usr.sbin/bhyve/gdb.c
1846

It will only fail for generic reasons, like if s is not a socket or a copyin of the optval fails.

This revision was automatically updated to reflect the committed changes.