kilobyte / compsize

btrfs: find compression type/ratio on a file or set of files
Other
344 stars 23 forks source link

Setuid root? #43

Open jbosboom opened 3 years ago

jbosboom commented 3 years ago

Could compsize be made safe to be setuid root, so that unprivileged users can check the compression of files they can read?

biggestsonicfan commented 1 year ago

Was there any consideration to this issue?

kilobyte commented 1 year ago

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.

Mart-Bogdan commented 1 year ago

So basically is it safe to sudo chmod u+s /usr/bin/compsize ?

Or it would allow malicious software to get privilege escalation?