aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/rpcserver/rpcserver_test.go
Commit message (Collapse)AuthorAgeFilesLines
* pkg/rpcserver: pkg/flatrpc: executor: add handshake stage 0Alexander Potapenko2025-02-201-8/+24
| | | | | | | | | | | | | | | | | | | | As we figured out in #5805, syz-manager treats random incoming RPC connections as trusted, and will crash if a non-executor client sends an invalid packet to it. To address this issue, we introduce another stage of handshake, which includes a cookie exchange: - upon connection from an executor, the manager sends a ConnectHello RPC message to it, which contains a random 64-bit cookie; - the executor calculates a hash of that cookie and includes it into its ConnectRequest together with the other information; - before checking the validity of ConnectRequest, the manager ensures client sanity (passed ID didn't change, hashed cookie has the expected value) We deliberately pick a random cookie instead of a magic number: if the fuzzer somehow learns to send packets to the manager, we don't want it to crash multiple managers on the same machine.
* pkg/rpcserver: run machine check from the global contextAleksandr Nogikh2025-02-031-4/+2
| | | | | Running it from the VM context causes its cancellation each time VM crashes or the connection is aborted.
* pkg/rpcserver: test on crash during machine checkAleksandr Nogikh2025-02-031-0/+79
| | | | | If an instance crashed during machine check, that should not normally abort all RPCServer operation.
* pkg/rpcserver: refactor to remove Fatalf callsAleksandr Nogikh2025-01-291-1/+7
| | | | Apply necessary changes to pkg/flatrpc and pkg/manager as well.
* pkg/rpcserver: refactoring in preparation for dynamic interface extractionDmitry Vyukov2024-11-261-2/+11
| | | | | | | | | | | Few assorted changes to reduce future diffs: - add rpcserver.RemoteConfig similar to LocalConfig (there are too many parameters) - add CheckGlobs to requesting additional globs from VMs - pass whole InfoRequest to the MachineChecked callback so that it's possible to read globs information - add per-mode config checking in the manager - add Manager.saveJson helper
* pkg/rpcserver: take stats as a dependencyAleksandr Nogikh2024-10-251-2/+2
| | | | | It will enable collecting statistics for several simultaneous RPCServer objects.
* pkg/rpcserver: add unit tests, Manager mocksSabyrzhan Tasbolatov2024-09-091-0/+209
Added more test coverage of the package and created an interface of rpcserver to use it as the dependency (for syz-manager). Also tried to cover with tests a private method handleConn(), though it calls handleRunnerConn which has a separate logic in Handshake(), which within handleConn() unit test we should've mocked. This will require a refactoring of `runners map[int]*Runner` and runner.go in general with a separate interface which we can mock as well. General idea is to have interfaces of Server (rpc), Runner etc. and mock a compound logic like Handshake during a separate public (or private if it has callable, if-else logic) method unit-testing.