Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate injection example to use linear-handles feature. #1892

Merged
merged 1 commit into from
Feb 25, 2021

Conversation

wildarch
Copy link
Contributor

@wildarch wildarch commented Feb 19, 2021

Checklist

  • Pull request affects core Oak functionality (e.g. runtime, SDK, ABI)
    • I have written tests that cover the code changes.
    • I have checked that these tests are run by
      Cloudbuild
    • I have updated documentation accordingly.
    • I have raised an issue to
      cover any TODOs and/or unfinished work.
  • Pull request includes prototype/experimental work that is under
    construction.

Tracking issue: #1854

@google-cla google-cla bot added the cla: yes label Feb 19, 2021
@wildarch wildarch force-pushed the linear_hanles_injection_example branch from 796323a to ac7fda6 Compare February 19, 2021 16:03
@wildarch wildarch marked this pull request as ready for review February 19, 2021 16:03
@wildarch wildarch force-pushed the linear_hanles_injection_example branch from ac7fda6 to a343057 Compare February 19, 2021 16:38
Copy link
Contributor

@rbehjati rbehjati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

grpc_fe_entrypoint()
});

// the linear-handles feature is disabled during clippy analysis, so this lint is a false-positive
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: perhaps add a TODO(#1854) to remember to remove this when linear-handles becomes a default feature.

@@ -43,12 +43,14 @@ impl<T: Encodable> SenderExt<T> for Sender<T> {
fn send(&self, t: &T) -> Result<(), OakError> {
let message = t.encode()?;
crate::channel_write(&self.handle, &message.bytes, &message.handles)?;
drop_handles(message);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure why the handles need to be dropped. Are not they borrowed or moved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During encoding we extract the raw handle values from the message, and replace them with INVALID_HANDLE: https://github.com/project-oak/oak/blob/main/oak_io/src/handle.rs#L202.

When this message is dropped, all handle values are invalid, so no handles are dropped. Instead we need to manually drop the raw handle values here. I hope that makes sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Thanks. I had overlooked a clone :)

@@ -43,12 +43,14 @@ impl<T: Encodable> SenderExt<T> for Sender<T> {
fn send(&self, t: &T) -> Result<(), OakError> {
let message = t.encode()?;
crate::channel_write(&self.handle, &message.bytes, &message.handles)?;
drop_handles(message);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Thanks. I had overlooked a clone :)

@wildarch wildarch merged commit 0b63f58 into project-oak:main Feb 25, 2021
@wildarch wildarch deleted the linear_hanles_injection_example branch February 25, 2021 10:00
@github-actions
Copy link

Reproducibility Index:

b8b378416e4ed10f558b8e41c4577e3b010b0a1eb6fa32ea3a6c4430cd35201d  ./examples/abitest/bin/abitest_0_frontend.wasm
691019ccb0f22af4a07560a773d005f6346dd4a4c7116690e06f3654e904029c  ./examples/abitest/bin/abitest_1_backend.wasm
69b651f1edccec1436793d90677467471919897481e619e7e87b3bae0701c0f4  ./examples/abitest/bin/abitest_linear_handles.wasm
401b1d9f238b82b12043e80eb214e0b0fe782447cd6ee251601a7f5bb3374221  ./examples/aggregator/bin/aggregator.wasm
e06e9dc64d8ac7480bd1f97c28ce623197f6a680e4b9c5844ca2b673f4f45431  ./examples/chat/bin/chat.wasm
7b4bf21eb8e976cc542b9a15a3051f0c005f3282442bd7dadd21bee7e5e1a981  ./examples/hello_world/bin/hello_world.wasm
6cdade7f66bf2ea5c9b74a14deadae474f631fe6aaa3dade858b7e4695f6cde9  ./examples/hello_world/bin/translator.wasm
2cfca9c514d384c6edcfcd8adde55f610a9c6f2b6a9f1a8ea7964834ef43d12f  ./examples/http_server/bin/http_server.wasm
18d0c9ff1ffa8982bbb9018c9c9bd87d7c4166d0e71ff17c0d482a886b0df3a1  ./examples/injection/bin/injection.wasm
8fcbacd377bc8219789c7966532caf2b41fe19ce9bffcf1bf1d0cee828212f9e  ./examples/private_set_intersection/bin/private_set_intersection.wasm
6d8cb28d84840997591bd8d72e466273788b70443dafbf85d2302db2e5c2ff54  ./examples/private_set_intersection/bin/private_set_intersection_handler.wasm
c0ecf5c7ea4b46109fce12d82ffbfbd4b5123ff163070e0bc54467d34c538fd6  ./examples/proxy_attestation/bin/proxy_attestation_example.wasm
6cdade7f66bf2ea5c9b74a14deadae474f631fe6aaa3dade858b7e4695f6cde9  ./examples/translator/bin/translator.wasm
19b9524d8920c6d6805d7a6adb84d1c3936e58b25d0599e5d7a2ad921bd6981f  ./examples/trusted_database/bin/trusted_database.wasm
cb9e5dd25ec5f9d440dbcede2c361ffacfa98090bf92d4610ed6d5fd0bd50fb8  ./oak_loader/bin/oak_loader

Reproducibility Index diff:

diff --git a/reproducibility_index b/reproducibility_index
index 276353e..1075242 100644
--- a/reproducibility_index
+++ b/reproducibility_index
@@ -1,15 +1,15 @@
-faf7091d124a520c114b6523820f3b1f12eb50b341955fa38b6fcc300684ea10  ./examples/abitest/bin/abitest_0_frontend.wasm
-5384945ff4d67d758e15f0ece0550f59aef877e3fef37907b749da3b2519c21f  ./examples/abitest/bin/abitest_1_backend.wasm
-8f907b548339324bdbc87894714806facbbd225a5798b557b2001c2b493b0c52  ./examples/abitest/bin/abitest_linear_handles.wasm
-cda3674646ebf25e5b34a15ded9c8dca78f7a8361cdbbb43b75b07fe92430382  ./examples/aggregator/bin/aggregator.wasm
-ef447cdfda3b6d78ee518722ac3270609bc602a6c7cfd197fa82e9070b3ccd3e  ./examples/chat/bin/chat.wasm
-d812f9b3a7c867be2df853f3061647c8e9a9b9fbcef4a39daaf5da33a53c1bb3  ./examples/hello_world/bin/hello_world.wasm
-18c03f19c64a0e487e0a118743a0a2e1df16a87e41cd8530a523da4027a90bef  ./examples/hello_world/bin/translator.wasm
-3d7bbf45681b499be9ee8daf55cd029ce749dd7f9113bdb0403da8b8d3d17a2c  ./examples/http_server/bin/http_server.wasm
-9409a53f823a9febd7a2bc16677de093479880acd7da1a34ea79278972b53dc6  ./examples/injection/bin/injection.wasm
-8efff73b9a678970664770512d97c191fb3c9397124439abe72e5b304b999e43  ./examples/private_set_intersection/bin/private_set_intersection.wasm
-abf0475fe00c584096f16fd340dd822c1d6879b54adc912406902e7b0b035a43  ./examples/private_set_intersection/bin/private_set_intersection_handler.wasm
-c6a2919c06a536170d225e9bba5c9be97eaa5e800f57f62405972ed138064639  ./examples/proxy_attestation/bin/proxy_attestation_example.wasm
-18c03f19c64a0e487e0a118743a0a2e1df16a87e41cd8530a523da4027a90bef  ./examples/translator/bin/translator.wasm
-424eb245c92b2afc48a2027aceb274525be765048ab38d759900db47fa037a11  ./examples/trusted_database/bin/trusted_database.wasm
+b8b378416e4ed10f558b8e41c4577e3b010b0a1eb6fa32ea3a6c4430cd35201d  ./examples/abitest/bin/abitest_0_frontend.wasm
+691019ccb0f22af4a07560a773d005f6346dd4a4c7116690e06f3654e904029c  ./examples/abitest/bin/abitest_1_backend.wasm
+69b651f1edccec1436793d90677467471919897481e619e7e87b3bae0701c0f4  ./examples/abitest/bin/abitest_linear_handles.wasm
+401b1d9f238b82b12043e80eb214e0b0fe782447cd6ee251601a7f5bb3374221  ./examples/aggregator/bin/aggregator.wasm
+e06e9dc64d8ac7480bd1f97c28ce623197f6a680e4b9c5844ca2b673f4f45431  ./examples/chat/bin/chat.wasm
+7b4bf21eb8e976cc542b9a15a3051f0c005f3282442bd7dadd21bee7e5e1a981  ./examples/hello_world/bin/hello_world.wasm
+6cdade7f66bf2ea5c9b74a14deadae474f631fe6aaa3dade858b7e4695f6cde9  ./examples/hello_world/bin/translator.wasm
+2cfca9c514d384c6edcfcd8adde55f610a9c6f2b6a9f1a8ea7964834ef43d12f  ./examples/http_server/bin/http_server.wasm
+18d0c9ff1ffa8982bbb9018c9c9bd87d7c4166d0e71ff17c0d482a886b0df3a1  ./examples/injection/bin/injection.wasm
+8fcbacd377bc8219789c7966532caf2b41fe19ce9bffcf1bf1d0cee828212f9e  ./examples/private_set_intersection/bin/private_set_intersection.wasm
+6d8cb28d84840997591bd8d72e466273788b70443dafbf85d2302db2e5c2ff54  ./examples/private_set_intersection/bin/private_set_intersection_handler.wasm
+c0ecf5c7ea4b46109fce12d82ffbfbd4b5123ff163070e0bc54467d34c538fd6  ./examples/proxy_attestation/bin/proxy_attestation_example.wasm
+6cdade7f66bf2ea5c9b74a14deadae474f631fe6aaa3dade858b7e4695f6cde9  ./examples/translator/bin/translator.wasm
+19b9524d8920c6d6805d7a6adb84d1c3936e58b25d0599e5d7a2ad921bd6981f  ./examples/trusted_database/bin/trusted_database.wasm
 cb9e5dd25ec5f9d440dbcede2c361ffacfa98090bf92d4610ed6d5fd0bd50fb8  ./oak_loader/bin/oak_loader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants