NETGDB(4)
π NAME π
okay so bestie, this is netgdb β aka NETGDB(4) β from the Kernel Interfaces Manual, and it's the protocol for debugging the kernel with GDB over the network π«Ά. It's giving remote-kernel-debugging main character energy, and honestly? I'm obsessed.
β¨ SYNOPSIS β¨
to compile NetGDB support into the kernel, place these exact lines in your kernel configuration file:
options DDB
options GDB
options INET
options DEBUGNET
options NETGDB
πΈ DESCRIPTION πΈ
netgdb is a UDP-based protocol for communicating with a remote GDB client via an intermediary proxy. lowkey a middleman for your kernel debug session, but make it network π
.
A netgdb session is started by using the netgdb -s server [-g gateway -c client -i iface] command in ddb(4) to connect to a proxy server. When the connection is made, the proxy server logs a message that a netgdb client has connected. It subsequently establishes a TCP listening socket and logs a message specifying which port it is listening on. Then it waits for a GDB client to connect. The GDB command to connect is:
target remote β¨proxyip:proxyportβ©
At this point, the server proxies traffic back and forth between netgdb and the ordinary GDB client, speaking the ordinary GDB remote protocol. The netgdb session is identical to any other kernel GDB session from the perspective of the GDB debugger. literally same energy to GDB, periodt.
π§ IMPLEMENTATION NOTES π§
The UDP protocol is based on the same packet structure and a subset of the exact same message types as netdump(4). It uses the HERALD, DATA (nΓ©e VMCORE), and FINISHED message types. Like netdump(4), the client's initial HERALD message is acknowledged from a random source port, and the client sends subsequent communication to that port.
Unlike netdump(4), the initial HERALD port is 20025. Additionally, the proxy server sends responses to the source port of the client's initial HERALD, rather than a separate reserved port. vibe check: netgdb message and acknowledgements are bidirectional. The sequence number and acknowledgement protocol is otherwise identical to the unidirectional version used by netdump; it just runs in both directions. Acknowledgements are sent to and from the same addresses and ports as regular messages.
The first version of the netgdb protocol uses the protocol number 0x2515f095 in the 32-bit aux2 parameter of the initial HERALD message.
The list of supported network drivers and protocol families is identical to that of netdump(4). iykyk.
π DIAGNOSTICS π
The following variable is available via both sysctl(8) and loader(8) (as a tunable):
debug.gdb.netgdb.debugβ control debug message verbosity. Debug messages are disabled by default. They may be enabled by setting the variable to a non-zero value. slay.
π SEE ALSO π
ddb(4), gdb(4), netdump(4) β go read the besties.
π¦ HISTORY π¦
netgdb first appeared in FreeBSD 13.0. iconic behavior.
π BUGS π
netgdb may only be used after the kernel has panicked, due to limitations in the treatment of locking primitives under ddb(4). ngl, no pre-panic casual debugging, bestie π.
π SECURITY CONSIDERATIONS π
Version 1 of the netgdb protocol has no security properties whatsoever. All messages are sent and acknowledged in cleartext, and no message authentication codes are used to prevent attackers from forging messages. It is absolutely inappropriate for use across the public internet. fr fr, do not put this on the public internet, I am literally begging you π.
That's the whole page, bestie β source/version Debian, date November 10, 2022, and NETGDB(4) signing off with a lil mwah πβ¨.
π¦ where this page comes from
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2019 Conrad Meyer <cem@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms