Check_path method for sysfscontrollerlist
Checks that a given path is authorized by first resolving any references to parent directories, and then checking if the path starts with the path to a controller. This basically creates an absolute path (but not necessarily canonical!) More precisely, starting from the root, on each element of the path: - if it is a 'normal' element: push it at the end of the current built path - it if is a 'parent dir' (..): pop the last element of the current path (i.e. go up a level) After processing all components of a path, we get an absolute path. This is then checked against the controllers paths. For now, this algorithm seems to work pretty well on simple and more complex examples. It ignores references to the root dir in the input path (because that is the starting point of the algorithm). In addition, it also ignores references to the current directory (.) There is currently no symlink resolution, nor is there a check to ensure the user is not trying to write in the root cgroup controller, or in the controller of cuttr (if there is one). This will probably be added in the future by parsing /proc/self/cgroup which contains the list of cgroup the current process belongs to.
Please register or sign in to comment