Setuid root?
Could compsize be made safe to be setuid root, so that unprivileged users can check the compression of files they can read?
Was there any consideration to this issue?
I started writing a setuid helper that passes the call, but I then realized it can be much better done in the kernel, solving both permissions and performance problems.
BTRFS_IOC_TREE_SEARCH_V2 is a powerful tool, but ill-fitting for this purpose. Having an additional simple ioctl to fetch extents just for a file would be best.
So basically is it safe to sudo chmod u+s /usr/bin/compsize ?
Or it would allow malicious software to get privilege escalation?