debugger: D5, the network transport -- and the plan closes
schdbgd bridges TCP to the debugger, which is the one way in that does not
need you to be sitting at the machine. It is a bridge and nothing else: a line
in becomes a line written to /dev/dbgro and the answer comes back, so `nc` is a
complete client and there is no clever client to be broken on the day you need
this.
# schdbgd &
schdbgd: debugger on port 4444, loopback only
$ nc 127.0.0.1 4444
dma
arena 0xffff80003da41000-0xffff80003ea41000 16384 KB total, ...
A kernel debugger plus a TCP socket is a remote root hole, so three things were
decided rather than discovered:
- It does not start by itself. schdbgd.job ships Disabled. SchOS has no
kernel command line, so the boot flag the plan asked for is the job
manifest, which is the same thing in this system's own idiom.
- It binds loopback; -a names an address and says so in a paragraph.
- It cannot reach a view that changes state, enforced in the kernel.
That last one is /dev/dbgro: /dev/dbg on minor 1. The minor is the one piece of
per-open state a character device already sees, so which node you opened is the
permission -- nothing to latch, nothing to remember between the write and the
read, no way across. Which views are refused comes from dbg_register_rw() on
the registration itself, because a central list of dangerous views goes stale
in the direction where a new view is quietly treated as safe. Today that is
`watch <addr>`; `watch` with no argument is still the listing and still
answered.
Also: socket() now accepts IPPROTO_TCP with SOCK_STREAM and IPPROTO_UDP with
SOCK_DGRAM. They name the default rather than departing from it, and toybox's
nc writes them out -- so TCP was "Protocol not supported" on a system whose
whole network is TCP.
docs/plan/debugger.md retires into docs/architecture/debugging.md; 16 files
repointed. Every plan in docs/plan/ that was open is now closed, so the next
thing is Gate 0 itself: the survey, with the instrument built.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VQ7Qx8E1q1M1bbCq8QLHS2
This commit is contained in:
parent
071499a378
commit
bc39b73969
23 changed files with 491 additions and 293 deletions
30
etc/schinit/schdbgd.job
Normal file
30
etc/schinit/schdbgd.job
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# The debugger, over the network. Off.
|
||||
#
|
||||
# docs/architecture/debugging.md milestone D5, and the `Disabled` line below is the
|
||||
# milestone's own security note being kept. SchOS has no kernel command line, so
|
||||
# the boot flag the plan asked for is this manifest: a machine that has not been
|
||||
# told to run this does not run it, and telling it is one line in one file that
|
||||
# somebody edited on purpose.
|
||||
#
|
||||
# schinitd enable os.schos.schdbgd (or: set Disabled = no here)
|
||||
#
|
||||
# Off rather than loopback-only-and-on, even though loopback-only is already the
|
||||
# default bind, because "a listener nobody asked for" is a different kind of
|
||||
# thing from "a listener bound somewhere narrow". A debugger that can read the
|
||||
# process table should not be running on a machine whose owner never wanted one.
|
||||
#
|
||||
# What it can reach is bounded in the kernel rather than here: schdbgd opens
|
||||
# /dev/dbgro, which refuses any view that declared itself as changing state.
|
||||
# See include/dbg.h.
|
||||
|
||||
Label = os.schos.schdbgd
|
||||
Program = /bin/schdbgd
|
||||
Args = schdbgd
|
||||
Disabled = yes
|
||||
RunAtLoad = yes
|
||||
KeepAlive = yes
|
||||
|
||||
ThrottleInterval = 3
|
||||
|
||||
StandardOut = /dev/tty1
|
||||
StandardError = /dev/tty1
|
||||
Loading…
Reference in a new issue