kata-security-coordinator: fix fakeimpl memory stats

Request the MemoryManager to free the package contents' CNode
on uninstall.  We were reclaiming this locally without informing
MmemoryManager so it's bookkeeping was off.

Change-Id: I925178ad50cf84a85dd401aafd9fdbea71e050a3
GitOrigin-RevId: 3e369dd558542d6f85f70f0ea9894ea370fd51d6
This commit is contained in:
Sam Leffler 2022-06-06 21:51:27 +00:00
parent ddacc3762e
commit 8255aeb604

View File

@ -3,23 +3,10 @@
extern crate alloc;
use alloc::string::{String, ToString};
use hashbrown::HashMap;
use kata_os_common::sel4_sys;
use kata_os_common::slot_allocator;
use kata_memory_interface::ObjDescBundle;
use kata_memory_interface::kata_object_free;
use kata_memory_interface::kata_object_free_in_cnode;
use kata_security_interface::*;
use kata_storage_interface::KeyValueData;
use log::error;
use sel4_sys::seL4_CNode_Delete;
use sel4_sys::seL4_CPtr;
use sel4_sys::seL4_WordBits;
use slot_allocator::KATA_CSPACE_SLOTS;
extern "C" {
static SELF_CNODE: seL4_CPtr;
}
struct BundleData {
pkg_contents: ObjDescBundle,
@ -52,14 +39,7 @@ impl BundleData {
}
impl Drop for BundleData {
fn drop(&mut self) {
let _ = kata_object_free(&self.pkg_contents);
unsafe {
KATA_CSPACE_SLOTS.free(self.pkg_contents.cnode, 1);
if let Err(e) = seL4_CNode_Delete(SELF_CNODE, self.pkg_contents.cnode, seL4_WordBits as u8) {
// XXX no bundle_id
error!("Error deleting CNode {}, error {:?}", self.pkg_contents.cnode, e);
}
}
let _ = kata_object_free_in_cnode(&self.pkg_contents);
}
}