Disallow '_' in bpf source name
Current design: 1. The bpf compiled object name is derived from the source name (e.g. foo.c -> foo.o). 2. Full bpf program/map name are concatenated by object name + '_' + program/map name in run-time. (e.g. obj name: x.o; program name: y_z; full bpf program name will be x_y_z) Issue: x.o with map y_z and x_y.o with map z can cause naming collision in run-time, since both result in x_y_z. This commit prevents it from happening with a build-time check. Bug: 236706995 Test: m Change-Id: Ic03bfcf07a5748ed63246b71d5ae8de0405e658a
This commit is contained in:
@@ -619,7 +619,7 @@ func TestDefaults(t *testing.T) {
|
||||
java_libs: ["myjar"],
|
||||
apps: ["AppFoo"],
|
||||
rros: ["rro"],
|
||||
bpfs: ["bpf", "netd_test"],
|
||||
bpfs: ["bpf", "netdTest"],
|
||||
updatable: false,
|
||||
}
|
||||
|
||||
@@ -673,8 +673,8 @@ func TestDefaults(t *testing.T) {
|
||||
}
|
||||
|
||||
bpf {
|
||||
name: "netd_test",
|
||||
srcs: ["netd_test.c"],
|
||||
name: "netdTest",
|
||||
srcs: ["netdTest.c"],
|
||||
sub_dir: "netd",
|
||||
}
|
||||
|
||||
@@ -687,7 +687,7 @@ func TestDefaults(t *testing.T) {
|
||||
"overlay/blue/rro.apk",
|
||||
"etc/bpf/bpf.o",
|
||||
"etc/bpf/bpf2.o",
|
||||
"etc/bpf/netd/netd_test.o",
|
||||
"etc/bpf/netd/netdTest.o",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -6151,7 +6151,7 @@ func TestOverrideApex(t *testing.T) {
|
||||
name: "override_myapex",
|
||||
base: "myapex",
|
||||
apps: ["override_app"],
|
||||
bpfs: ["override_bpf"],
|
||||
bpfs: ["overrideBpf"],
|
||||
prebuilts: ["override_myetc"],
|
||||
bootclasspath_fragments: ["override_bootclasspath_fragment"],
|
||||
systemserverclasspath_fragments: ["override_systemserverclasspath_fragment"],
|
||||
@@ -6201,8 +6201,8 @@ func TestOverrideApex(t *testing.T) {
|
||||
}
|
||||
|
||||
bpf {
|
||||
name: "override_bpf",
|
||||
srcs: ["override_bpf.c"],
|
||||
name: "overrideBpf",
|
||||
srcs: ["overrideBpf.c"],
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
@@ -6305,7 +6305,7 @@ func TestOverrideApex(t *testing.T) {
|
||||
ensureContains(t, copyCmds, "image.apex/app/override_app@TEST.BUILD_ID/override_app.apk")
|
||||
|
||||
ensureNotContains(t, copyCmds, "image.apex/etc/bpf/bpf.o")
|
||||
ensureContains(t, copyCmds, "image.apex/etc/bpf/override_bpf.o")
|
||||
ensureContains(t, copyCmds, "image.apex/etc/bpf/overrideBpf.o")
|
||||
|
||||
ensureNotContains(t, copyCmds, "image.apex/etc/myetc")
|
||||
ensureContains(t, copyCmds, "image.apex/etc/override_myetc")
|
||||
@@ -6339,7 +6339,7 @@ func TestOverrideApex(t *testing.T) {
|
||||
data.Custom(&builder, name, "TARGET_", "", data)
|
||||
androidMk := builder.String()
|
||||
ensureContains(t, androidMk, "LOCAL_MODULE := override_app.override_myapex")
|
||||
ensureContains(t, androidMk, "LOCAL_MODULE := override_bpf.o.override_myapex")
|
||||
ensureContains(t, androidMk, "LOCAL_MODULE := overrideBpf.o.override_myapex")
|
||||
ensureContains(t, androidMk, "LOCAL_MODULE := apex_manifest.pb.override_myapex")
|
||||
ensureContains(t, androidMk, "LOCAL_MODULE := override_bcplib.override_myapex")
|
||||
ensureContains(t, androidMk, "LOCAL_MODULE := override_systemserverlib.override_myapex")
|
||||
|
Reference in New Issue
Block a user