vmbase: Support LLVM and Bionic stack guard

C code compiled with the Android toolchain has stack guard checks
enabled. So as to avoid having to recompile every target with
-fno-stack-guard, instead add the expected symbols to vmbase.

This means we need __stack_chk_guard variable containing the canary
(used by all libc implementations [1]) and a thread-local storage containing
another copy of the canary at offset 40 (Bionic only [2]).

If the instrumentation detects an error, it calls __stack_chk_fail.
Provide an implementation that simply panics.

[1] bionic/tests/stack_protector_test.cpp
[2] https://reviews.llvm.org/D18632

Bug: 237372981
Test: atest vmbase_example.integration_test
Change-Id: I00de7c75aef6a57a73667df6983a12b01fbe9e51
4 files changed
tree: 351e78d8201c91681f4ea1b12c1b5e5a1a864bcf
  1. apex/
  2. apkdmverity/
  3. authfs/
  4. avmd/
  5. compos/
  6. demo/
  7. docs/
  8. javalib/
  9. launcher/
  10. libs/
  11. microdroid/
  12. microdroid_manager/
  13. pvmfw/
  14. rialto/
  15. tests/
  16. virtualizationservice/
  17. vm/
  18. vmbase/
  19. vmclient/
  20. zipfuse/
  21. .clang-format
  22. .gitignore
  23. Android.bp
  24. OWNERS
  25. PREUPLOAD.cfg
  26. README.md
  27. TEST_MAPPING
README.md

Virtualization

This repository contains userspace services related to running virtual machines on Android, especially protected virtual machines. See the getting started documentation and Microdroid README for more information.