Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Tổng quan về Khung ảo hoá Android (AVF)
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Khung ảo hoá Android (AVF) cung cấp môi trường thực thi bảo mật và riêng tư để thực thi mã. AVF là giải pháp lý tưởng cho các trường hợp sử dụng tập trung vào bảo mật yêu cầu khả năng tách biệt mạnh mẽ hơn, thậm chí được xác minh chính thức so với những khả năng mà hộp cát ứng dụng của Android cung cấp. Android cung cấp một cách triển khai tham chiếu
cho tất cả các thành phần cần thiết để triển khai AVF. AVF chỉ được hỗ trợ trên các thiết bị ARM64. Hình 1 cho thấy cấu trúc của AVF:
Hình 1. Cấu trúc AVF.
Sau đây là định nghĩa của các thuật ngữ quan trọng nhất trong hình 1:
- apexd và zipfuse
- Gắn an toàn các tệp APEX và APK được nhập từ máy chủ lưu trữ.
- authfs
- Hệ thống tệp cầu chì để chia sẻ nhiều tệp một cách an toàn giữa Android và pVM (máy chủ và khách).
- Trình liên kết
- Công cụ chính để giao tiếp giữa các máy ảo.
- crosvm
- Trình giám sát máy ảo được viết bằng rust. crosvm phân bổ bộ nhớ máy ảo, tạo luồng CPU ảo và triển khai phần phụ trợ của thiết bị ảo.
- Hình ảnh hạt nhân chung (GKI)
- Hình ảnh khởi động được Google chứng nhận, chứa hạt nhân GKI được tạo từ cây nguồn Hạt nhân chung Android (ACK) và phù hợp để cài đặt ROM vào phân vùng khởi động của thiết bị Android. Để biết thêm thông tin, hãy xem bài viết Tổng quan về nhân.
- trình điều khiển ảo hoá
- Công nghệ ảo hoá mà AVF sử dụng, còn gọi là pKVM. Trình điều khiển ảo hoá duy trì tính toàn vẹn của mã đã thực thi và tính bảo mật của các tài sản của pVM, ngay cả khi máy chủ lưu trữ Android hoặc bất kỳ pVM nào khác bị xâm phạm.
- Java API
- Các API Java VirtualizationService chỉ có trên các thiết bị hỗ trợ AVF. Các API này là không bắt buộc và không thuộc
thebootclasspath
.
- Microdroid
- Hệ điều hành Android mini do Google cung cấp, chạy trong pVM.
- Trình quản lý Microdroid
- Quản lý vòng đời pVM, bên trong pVM và ổ đĩa thực thể.
- API gốc
- Một tập hợp con của Bộ công cụ phát triển mã gốc của Android (NDK).
- máy ảo bảo vệ dựa trên nhân (pKVM)
- Xem Trình điều khiển ảo hoá.
- Phần mềm cơ sở pVM (
pvmfw
)
- Mã đầu tiên chạy trên pVM,
pvmfw
xác minh tải trọng và lấy khoá bí mật cho mỗi máy ảo.
- máy ảo được bảo vệ (pVM)
Môi trường thực thi tách biệt không tin cậy lẫn nhau (khách) chạy cùng với hệ điều hành Android chính (máy chủ). Một khía cạnh quan trọng của tính bảo mật pVM là ngay cả khi máy chủ bị xâm phạm, máy chủ vẫn không có quyền truy cập vào bộ nhớ của pVM. pKVM là trình điều khiển ảo hoá chuẩn để chạy pVM.
So với các môi trường thực thi đáng tin cậy (TEE) hiện có, pVM cung cấp một môi trường phong phú hơn, bao gồm cả khả năng chạy một bản phân phối Android mini có tên là Microdroid (mặc dù Microdroid cũng có thể chạy trên một máy ảo không được bảo vệ). Bạn có thể sử dụng pVM một cách linh động và cung cấp một bộ API tiêu chuẩn trong một môi trường đáng tin cậy có trên tất cả các thiết bị hỗ trợ pVM.
- VirtualizationService
Dịch vụ Android quản lý vòng đời của pVM.
Tiếp theo là gì?
- Nếu bạn muốn hiểu rõ hơn về nhu cầu sử dụng AVF, hãy tham khảo bài viết Tại sao nên dùng AVF?.
- Để đọc về cách sử dụng AVF cho quá trình biên dịch riêng biệt, hãy tham khảo phần Trường hợp sử dụng.
- Nếu bạn muốn biết thêm thông tin giải thích chi tiết về cấu trúc triển khai tham chiếu AVF, hãy tham khảo cấu trúc AVF.
- Nếu bạn muốn tìm hiểu về Microdroid, hãy tham khảo bài viết Microdroid.
- Nếu bạn quan tâm đến cách AVF xử lý vấn đề bảo mật, hãy tham khảo phần Bảo mật.
- Để hiểu vai trò của dịch vụ ảo hoá, hãy tham khảo VirtualizationService.
- Để biết mã nguồn của AVF hoặc nội dung giải thích chuyên sâu về từng thành phần, hãy tham khảo kho lưu trữ AOSP
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# Android Virtualization Framework (AVF) overview\n\n*Android Virtualization Framework (AVF)* provides secure and private execution\nenvironments for executing code. AVF is ideal for security-oriented use cases\nthat require stronger, even formally verified, isolation assurances over those\noffered by Android's app sandbox. Android provides a reference implementation\nof all the components needed to implement AVF. AVF is supported only\non ARM64 devices. Figure 1 shows the architecture of AVF:\n\n**Figure 1.** AVF architecture.\n\nHere are the definitions for the most important terms from figure 1:\n\n*apexd and zipfuse*\n: Securely mounts APEXes and APKs imported from host.\n\n*authfs*\n: A fuse file system for securely sharing multiple files between Android and pVM\n (host and guest).\n\n*binder*\n: Primary means of inter-VM communication.\n\n*crosvm*\n: A virtual machine monitor written in rust. crosvm allocates VM memory,\n creates virtual CPU threads, and implements the virtual device's back-ends.\n\n*Generic Kernel Image (GKI)*\n: A boot image certified by Google that contains a GKI kernel built from an\n Android Common Kernel (ACK) source tree and is suitable to be flashed to the\n boot partition of an Android device. For further information, see the [Kernel\n overview](/docs/core/architecture/kernel).\n\n*hypervisor*\n: The virtualization technology used by AVF, also known as *pKVM*. The\n hypervisor maintains the integrity of the executed code and confidentiality of\n the pVM's assets, even if host Android or any of the other pVMs are compromised.\n\n*Java API*\n: The VirtualizationService Java APIs, which are present only on devices with\n AVF support. These APIs are optional and not part of `thebootclasspath`.\n\n*Microdroid*\n: A Google-provided mini-Android OS that runs in a pVM.\n\n*Microdroid Manager*\n: Manages the pVM lifecycle, inside the pVM, and instance disk.\n\n*Native API*\n: A subset of the Android Native Developers Kit (NDK).\n\n*protected kernel-based virtual machine (pKVM)*\n: See [Hypervisor](#hyper).\n\n*pVM firmware (`pvmfw`)*\n: The first code that runs on a pVM, `pvmfw` verifies the payload and derives\n the per-VM secret.\n\n*protected virtual machine (pVM)*\n\n: A mutually distrusted isolated execution environment (*guest* ) that runs\n alongside the main Android operating system (*host*). One important aspect of\n pVM security is even if the host is compromised, the host doesn't have access\n to a pVM's memory. pKVM is the standard hypervisor for running pVMs.\n\n Compared to existing trusted execution environments (TEEs), pVMs provide a\n richer environment, including the ability to run a mini-Android distribution\n called [Microdroid](#micro) (though Microdroid can also run on an\n unprotected VM). pVMs can be used dynamically and provide a\n standard set of APIs in a trusted environment available across all devices\n that support them.\n\n*VirtualizationService*\n\n: The Android service that manages the lifecycle of pVMs.\n\nWhat's next?\n------------\n\n- If you want to better understand the need for AVF, refer to [Why AVF?](/docs/core/virtualization/whyavf).\n- To read about how AVF can be used for isolated compilation, refer to [Use cases](/docs/core/virtualization/usecases).\n- If you want a more in-depth explanation of the AVF reference implementation's architecture, refer to [AVF architecture](/docs/core/virtualization/architecture).\n- If you want to learn about Microdroid, refer to [Microdroid](/docs/core/virtualization/microdroid).\n- If you are interested in how AVF handles security, refer to [Security](/docs/core/virtualization/security).\n- To understand the role of the virtualization service, refer to [VirtualizationService](/docs/core/virtualization/virtualization-service).\n- For source code of AVF or in-depth explanation about individual components, refer to [AOSP\n repository](https://android.googlesource.com/platform/packages/modules/Virtualization/+/refs/heads/main)"]]