mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
xous: hosted: free MemoryMessage::Move after send
This ensures that these messages aren't leaked. In a native system, this memory would be "freed" by the kernel as it is attached to the new memory space. Signed-off-by: Sean <xobs@ci.betrusted.io>
This commit is contained in:
parent
5b45382489
commit
f1353e8ff0
1 changed files with 35 additions and 27 deletions
|
|
@ -559,10 +559,15 @@ fn _xous_syscall_result(
|
||||||
|
|
||||||
crate::Message::Move(crate::MemoryMessage {
|
crate::Message::Move(crate::MemoryMessage {
|
||||||
id: _id,
|
id: _id,
|
||||||
buf: _buf,
|
buf,
|
||||||
offset: _offset,
|
offset: _offset,
|
||||||
valid: _valid,
|
valid: _valid,
|
||||||
}) => (),
|
}) => {
|
||||||
|
// In a hosted environment, the message contents are leaked when
|
||||||
|
// it gets converted into a MemoryMessage. Now that the call is
|
||||||
|
// complete, free the memory.
|
||||||
|
mem::unmap_memory_post(*buf).unwrap();
|
||||||
|
},
|
||||||
// Nothing to do for Immutable borrow, since the memory can't change
|
// Nothing to do for Immutable borrow, since the memory can't change
|
||||||
crate::Message::Scalar(_) => (),
|
crate::Message::Scalar(_) => (),
|
||||||
}
|
}
|
||||||
|
|
@ -612,7 +617,8 @@ fn _xous_syscall_to(
|
||||||
for word in &[nr, a1, a2, a3, a4, a5, a6, a7] {
|
for word in &[nr, a1, a2, a3, a4, a5, a6, a7] {
|
||||||
pkt.extend_from_slice(&word.to_le_bytes());
|
pkt.extend_from_slice(&word.to_le_bytes());
|
||||||
}
|
}
|
||||||
if let crate::SysCall::SendMessage(_, ref msg) = call {
|
match call {
|
||||||
|
crate::SysCall::SendMessage(_, ref msg) | crate::SysCall::TrySendMessage(_, ref msg) => {
|
||||||
match msg {
|
match msg {
|
||||||
crate::Message::MutableBorrow(crate::MemoryMessage {
|
crate::Message::MutableBorrow(crate::MemoryMessage {
|
||||||
id: _id,
|
id: _id,
|
||||||
|
|
@ -640,6 +646,8 @@ fn _xous_syscall_to(
|
||||||
crate::Message::Scalar(_) => (),
|
crate::Message::Scalar(_) => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ => (),
|
||||||
|
}
|
||||||
|
|
||||||
xsc.write_all(&pkt).expect("Server shut down");
|
xsc.write_all(&pkt).expect("Server shut down");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue