bug_map: Update denial metadata to have prefix "bug="
In Android Q and earlier, the format of bug_map file is:
<scontext> <tcontext> <tclass> <bugid>
and the bugid is prepended with a "b/" prefix implicitly.
In Android R, the format is generalized to encode arbitrary text:
<scontext> <tcontext> <tclass> <bug_description>
so if the bug_description is a bugid, the bug would need to have a "b/"
prefix explicitly:
<scontext> <tcontext> <tclass> b/<bugid>
This causes trouble on GSI mixed version testing.
For example, if a S GSI is mixed with Q vendor, then the logd logger (S)
would expect the bug_map file to have explicit "b/" prefix, however the
bug_map, which is from vendor partition, don't have any "b/" prefix,
because it (Q) assumes that the logger would prepend the "b/" prefix for
them.
To remedy this problem, let's unconditionally prepend bug_map metadata
with a "bug=" prefix, so for S+Q configurations the log would look like:
avc: denied ... bug=178056724
for ordinary S device:
avc: denied ... bug=b/178056724
avc: denied ... bug=<arbitrary text>
This would make the format of bug_map metadata more consistent, and
DeviceBootTest#SELinuxUncheckedDenialBootTest would be able to parse
bug_map metadata for both cases.
Bug: 178577550
Test: Trigger some denials, verify that the denials are tagged with
"bug=<bugid>"
Test: DeviceBootTest#SELinuxUncheckedDenialBootTest passes
Change-Id: Ic28981a15ce4ab635bfdc9596668c2f1326a8aa6
2 files changed