[optee] Remove workaround for misbehaving TAs
Previously we synchronized the whole shared memory buffer back to the
VMO even though that should be unnecessary. With this change only the
output range specified by the TA will be written to the client's VMO.
Bug: 35763
Test: optee_smoke_test
optee-client-test
optee-controller-test
optee-message-test
manual verification of some TA workloads
Change-Id: I96837662d98c38d6d549d9ba5019a6d9f3b88270
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/475282
Reviewed-by: RJ Ascani <rjascani@google.com>
Commit-Queue: Jonathan Bailey <jonathanbailey@google.com>
diff --git a/src/devices/tee/drivers/optee/optee-message.cc b/src/devices/tee/drivers/optee/optee-message.cc
index f926154..117704e 100644
--- a/src/devices/tee/drivers/optee/optee-message.cc
+++ b/src/devices/tee/drivers/optee/optee-message.cc
@@ -352,10 +352,7 @@
if (actual_size > size_) {
return ZX_OK;
}
- // TODO(fxbug.dev/35763): synchronize only actual_size bytes.
- // Currently we synchronize the whole shared memory back to the vmo
- // as a workaround, even though that should be unnecessary.
- return vmo_.write(reinterpret_cast<void*>(shared_memory_->vaddr()), vmo_offset_, size_);
+ return vmo_.write(reinterpret_cast<void*>(shared_memory_->vaddr()), vmo_offset_, actual_size);
}
zx_handle_t Message::TemporarySharedMemory::ReleaseVmo() { return vmo_.release(); }