Unlinking objects in a directory with sticky bit set

YONETANI Tomokazu qhwt+dfly at les.ath.cx
Sun May 3 07:03:15 PDT 2009


On Sat, May 02, 2009 at 10:53:31AM -0700, Matthew Dillon wrote:
> :Hi.
> :On HAMMER filesystem, you can remove an object you do not own even
> :when the directory containing it has sticky bit set:
> 
>     Committed as a kernel-layer fix.  Please test also, and if it works
>     as expected I will cherry-pick it over to 2.2.x as well.

Quoting from sticky(8):
  ... A file in a sticky directory may only be removed or renamed
  by a user if the user has write permission for the directory and the user
  is the owner of the file, the owner of the directory, or the super-user.

So rename(2) in a directory with sticky bit set should also be taken care of.
Currently there are three commits to be cherry-picked to 2.2 branch:
  918101d3be679a76c85ea8f47b94e05f8eb11ee5
  ee89633d5330733056052c06919a5dd4c01347bc
  dae8d54f0708cf191cbb06ef6aa43cd570ceea90

The filesystems affected by ee89633d are: ext2fs, hpfs, msdosfs, ntfs,
nwfs, smbfs, udf, ufs, and HAMMER, but I only tested ufs and HAMMER.

And a very silly nit-pick would be that with these commits the return
code is changed from EPERM to EACCES.  I can't think of a situation
when that could be a problem, though.





More information about the Bugs mailing list