Hi James, Vaibhav,
Apologies for the delay replying.
Hoping others will add their thoughts here, but a couple of other engineers and I discussed your proposal and we think it is a great idea. This more precise definition of what the driver needs to access would likely improve security. We'd like to work with you to spec the file format and do a prototype, probably on Linux. CC'ing
tis...@chromium.org as an initial point of contact from Chrome's security team.
It might be easiest to make a Google doc in which we could collaborate directly - what do you think? In the meantime, here are a few initial thoughts.
- Chromium already contains supporting libraries for parsing JSON, and I think we would heavily lean toward using JSON rather than XML.
- Simplicity and size of the file are important, since parsing this file will be on the critical path of Chromium's GPU sub-process startup (and, hopefully, other browsers' and applications' in the future).
- One could imagine attacks involving deliberately corrupting this file or making it exceedingly large, and it's important to think through that possibility.
- How will the JSON file be located initially?
- Will there be rules about which portions of the file system can be whitelisted for read access by the JSON file?
- Will paths be required to be relative / absolute?
- Rather than partitioning the driver's files into kernel/userspace/etc., I think it would be more straightforward to group entries in this sandbox description by function; for example, a "read_access" key in a dictionary whose value is an array of file or directory names that the sandbox must grant read access to. From the point of view of the sandbox, it doesn't matter whether those are shared objects, data files, etc. Again for simplicity, we would not want to have to parse a more complex file and merge different portions of it, but would rather the contents of this file be targeted specifically at sandboxing the driver. Similarly, one could imagine another key specifying allowed ioctl request types, a "read_write_access" key specifying a directory where the driver caches its compiled pipelines, certain magic variables which refer to the temp directory, etc.
- One colleague suggested something like an EGL API which would return this data in some well-defined C struct. I personally think it is difficult to maintain and evolve such structs, and agree with your proposed direction of parsing a file.
- We'll need to think about how this file will evolve. Assuming it contains a JSON dictionary, once keys are defined in it and browsers are looking for them, it will be difficult to remove them or modify their structure. It may be beneficial to define a version key at the beginning of time, and specify which keys were added in which version.
Again, looking forward to working with you on this more, and hope that other Chromium teammates will share their thoughts too.
-Ken