From 65bad96f52c239338676d9a1977c773f63fde19f Mon Sep 17 00:00:00 2001 From: bunnie Date: Sat, 30 Oct 2021 02:14:31 +0800 Subject: [PATCH] fix killbounce & formatting sleep killbounce wouldn't work because we started limiting the number of connections to the LLIO. This change makes connections to the LLIO unlimited, but perhaps later on we should split out the I2C bus into a separate security domain, so that the LLIO's unlimited connection policy doesn't introduce a risk into a rogue process being able to overwrite the RTC contents. --- services/llio/src/main.rs | 8 ++++++-- services/shellchat/src/cmds/sleep.rs | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/services/llio/src/main.rs b/services/llio/src/main.rs index e785d561b..bb3024133 100644 --- a/services/llio/src/main.rs +++ b/services/llio/src/main.rs @@ -696,13 +696,17 @@ fn xmain() -> ! { // - rootkeys (for reboots) // - oqc-test (for testing the vibe motor) // - net (for COM interrupt dispatch) + // - problem: `sleep killbounce` allocates a connection. That would bring us to 10 normally, but 11 when that function is needed. + // for now we're going to leave the total server count as "None" (open-ended) but we probably want to rethink this as + // the I2C access is in this crate. Perhaps we should split I2C out, so that the RTC can be protected and not grouped + // into the same severe security restrictions as the other LLIO items? let num_conns = 10; - let llio_sid = xns.register_name(api::SERVER_NAME_LLIO, Some(num_conns)).expect("can't register server"); + let llio_sid = xns.register_name(api::SERVER_NAME_LLIO, None).expect("can't register server"); log::trace!("registered with NS -- {:?}", llio_sid); // create the I2C handler thread // each connection to llio also creates an i2c connection, so it has the same expectation list - let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, Some(num_conns)).expect("can't register I2C thread"); + let i2c_sid = xns.register_name(api::SERVER_NAME_I2C, None).expect("can't register I2C thread"); log::trace!("registered I2C thread with NS -- {:?}", i2c_sid); let (sid0, sid1, sid2, sid3) = i2c_sid.to_u32(); xous::create_thread_4(i2c_thread, sid0 as usize, sid1 as usize, sid2 as usize, sid3 as usize).expect("couldn't start I2C handler thread"); diff --git a/services/shellchat/src/cmds/sleep.rs b/services/shellchat/src/cmds/sleep.rs index bf0089e95..7dd96b2be 100644 --- a/services/shellchat/src/cmds/sleep.rs +++ b/services/shellchat/src/cmds/sleep.rs @@ -35,7 +35,7 @@ fn kill_thread(bounce: usize) { llio.self_destruct(0x2718_2818).unwrap(); llio.self_destruct(0x3141_5926).unwrap(); com.power_off_soc().unwrap(); - ticktimer.sleep_ms(100).unwrap(); + ticktimer.sleep_ms(1000).unwrap(); log::info!("If you can read this, we failed to destroy ourselves!"); } }