Handle exceptions in nativeBinderFromPreconnected.

The `requestFunc` now checks for Java exceptions after calling
`CallIntMethod`. If an exception is detected, a failure flag is
set, and subsequent calls will also fail.

Using stdin like this is typically not going to be a problem,
but it is possible for FD 0 to become a socket for a misbehaving
process, and that could lead to very bad behavior indeed!

Without this change, when failing, we saw this error, due to file no 0 (stdin) being used wrongly:

	08-13 06:42:19.997	1730	2806	E	libbinder.RpcSession:  Could not write connection header to socket: -88 (Socket operation on non-socket)
	08-13 06:42:19.999	1730	2806	E	libbinder.libbinder_rpc_unstable:  Failed to set up preconnected client. error: -88 (Socket operation on non-socket)

With this change, the log we see is this expected error:

    08-19 16:37:38.520 24279  7636 E libbinder.libbinder_rpc_unstable: Failed to set up preconnected client. error: BAD_VALUE

Bug: 437940735
Test: test case added, atest com.android.microdroid.test.MicrodroidTests
Change-Id: I181309a7bd1a139517efd7de3b6df02e5e5991f4
2 files changed
tree: 5c51988934461711da61889488f70fded70209b6
  1. android/
  2. build/
  3. docs/
  4. guest/
  5. libs/
  6. microfuchsia/
  7. tests/
  8. .clang-format
  9. .gitignore
  10. Android.bp
  11. dice_for_avf_guest.cddl
  12. NOTICE
  13. OWNERS
  14. PREUPLOAD.cfg
  15. README.md
  16. rustfmt.toml
  17. TEST_MAPPING
README.md

Android Virtualization Framework (AVF)

Android Virtualization Framework (AVF) provides secure and private execution environments for executing code. AVF is ideal for security-oriented use cases that require stronger isolation assurances over those offered by Android’s app sandbox.

Visit our public doc site to learn more about what AVF is, what it is for, and how it is structured. This repository contains source code for userspace components of AVF.

If you want a quick start, see the getting started guideline and follow the steps there.

For in-depth explanations about individual topics and components, visit the following links.

AVF components:

AVF APIs:

How-Tos: