summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2021-06-28 11:27:11 -0400
committer Ivan Lozano <ivanlozano@google.com> 2021-06-28 11:59:07 -0400
commit03a94c48da15ed366a8094de2508076a86ed0804 (patch)
tree097387e162606c30ac73359780c23edb9f5f800e
parent770193da6c61669458f76fa347470232772809cc (diff)
rust: Add missing Rust allow path modules.
Adds rust_benchmark and rust_fuzz to the list of Rust module types which need to be in the allowed paths, and a comment about rust_bindgen and rust_protobuf. This also adds a downstream allow path list which helps prevent merge conflicts if downstream wants to extend the list of allowed paths. Bug: 191507775 Test: Paths are checked for the newly added module types. Test: Paths in DownstreamRustAllowedPaths allow Rust modules. Change-Id: Ida80c33a815d47ffdfb1f648125d71316a2a9d8a
-rw-r--r--rust/config/allowed_list.go10
-rw-r--r--rust/rust.go2
2 files changed, 11 insertions, 1 deletions
diff --git a/rust/config/allowed_list.go b/rust/config/allowed_list.go
index 394fcc52d..31ec3f12c 100644
--- a/rust/config/allowed_list.go
+++ b/rust/config/allowed_list.go
@@ -26,9 +26,18 @@ var (
"system/logging/rust",
"system/security",
"system/tools/aidl",
+ "tools/security/fuzzing/example_rust_fuzzer",
+ }
+
+ DownstreamRustAllowedPaths = []string{
+ // Add downstream allowed Rust paths here.
}
RustModuleTypes = []string{
+ // Don't add rust_bindgen or rust_protobuf as these are code generation modules
+ // and can be expected to be in paths without Rust code.
+ "rust_benchmark",
+ "rust_benchmark_host",
"rust_binary",
"rust_binary_host",
"rust_library",
@@ -37,6 +46,7 @@ var (
"rust_ffi",
"rust_ffi_shared",
"rust_ffi_static",
+ "rust_fuzz",
"rust_library_host",
"rust_library_host_dylib",
"rust_library_host_rlib",
diff --git a/rust/rust.go b/rust/rust.go
index b8c8be5a2..98241f4c6 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -35,7 +35,7 @@ func init() {
android.AddNeverAllowRules(
android.NeverAllow().
- NotIn(config.RustAllowedPaths...).
+ NotIn(append(config.RustAllowedPaths, config.DownstreamRustAllowedPaths...)...).
ModuleType(config.RustModuleTypes...))
android.RegisterModuleType("rust_defaults", defaultsFactory)