seL4 / rust-microkit-http-server-demo

Demonstrates the use of the seL4 crates with the seL4 Microkit
2 stars 2 forks source link

Crashing on HTTPS #9

Open Ivan-Velickovic opened 7 months ago

Ivan-Velickovic commented 7 months ago

Was just clicking around after getting the example building/running and ran into this:

MON|INFO: Microkit Bootstrap
MON|INFO: bootinfo untyped list matches expected list
MON|INFO: Number of bootstrap invocations: 0x0000000e
MON|INFO: Number of system invocations:    0x000013cd
MON|INFO: completed bootstrap invocations
MON|INFO: completed system invocations
INFO  [sel4_async_network] DHCP config lost
INFO  [sel4_async_network] DHCP config acquired
INFO  [sel4_async_network] IP address: 10.0.2.15/24
INFO  [sel4_async_network] Default gateway: 10.0.2.2
INFO  [sel4_async_network] DNS server 0: 10.0.2.3
http_server: panicked at 'assertion failed: `(left != right)`
  left: `0`,
 right: `0`', /work/crates/pds/server/core/src/server.rs:44:17
aborted at 'main thread panicked', /home/x/.cargo/git/checkouts/rust-sel4-a4edf3b9624837c3/4a2e125/crates/sel4-microkit/src/entry.rs:68:19
received message 0x00000003  badge: 0x0000000000000001  tcb cap: 0x800000000000138d
faulting PD: http_server
Registers: 
pc : 0x00000000002c4914
spsr : 0x0000000060000040
x0 : 0x0000000000000000
x1 : 0x0000000000000000
x2 : 0x0000000000000000
x3 : 0x0000000000000000
x4 : 0x0000000000000000
x5 : 0x0000000000000000
x6 : 0x0000000000000000
x7 : 0xfffffffffffffff4
UserException
<<seL4(CPU 0) [receiveIPC/142 T0xffffff807ffe7400 "rootserver" @8a000300]: Reply object already has unexecuted reply!>>

I'm not sure what caused it, but I think it's something to do with requesting another page before the current one finishes loading? E.g say going to https://localhost:9443/news/index.html and then reloading before the page is finished loading.

Ivan-Velickovic commented 7 months ago

The same kind of behaviour on HTTP ends up with these messages rather than crashing:

WARN  [microkit_http_server_example_server_core] error: Other(InvalidState(CloseWait))
WARN  [microkit_http_server_example_server_core] error: Other(InvalidState(Closed))
WARN  [microkit_http_server_example_server_core] error: Other(InvalidState(Closed))
WARN  [microkit_http_server_example_server_core] error: Other(InvalidState(Closed))
WARN  [microkit_http_server_example_server_core] error: Other(InvalidState(Closed))
WARN  [microkit_http_server_example_server_core] error: Other(InvalidState(Closed))
WARN  [microkit_http_server_example_server_core] error: Other(InvalidState(Closed))
WARN  [microkit_http_server_example_server_core] error: Other(InvalidState(CloseWait))
nspin commented 7 months ago

These bugs and warnings are due to the server assuming certain behavior from the client.

I haven't put much time into addressing TCP/IP and HTTP-level edge cases in this demo yet.

Using a third-party HTTP implementation (https://github.com/sammhicks/picoserve is the only no_std one I've found) would be one effort-efficient way to solve problems like this.

Whether I fix these issues myself or switch to using a third-party HTTP implementation instead, I'll post my progress in this thread.

nspin commented 7 months ago

The crash in this issue has been fixed with https://github.com/seL4/rust-sel4/pull/78, pulled into this repo with https://github.com/seL4/rust-microkit-http-server-demo/pull/10.