libgocryptfs/internal/fusefrontend
Jakob Unterwurzacher 72b975867a fusefronted: allow_other: close race between mknod and chown
If the user manages to replace the directory with
a symlink at just the right time, we could be tricked
into chown'ing the wrong file.

This change fixes the race by using fchownat, which
unfortunately is not available on darwin, hence a compat
wrapper is added.

Scenario, as described by @slackner at
https://github.com/rfjakob/gocryptfs/issues/177 :

1. Create a forward mount point with `plaintextnames` enabled
2. Mount as root user with `allow_other`
3. For testing purposes create a file `/tmp/file_owned_by_root`
   which is owned by the root user
4. As a regular user run inside of the GoCryptFS mount:

```
mkdir tempdir
mknod tempdir/file_owned_by_root p &
mv tempdir tempdir2
ln -s /tmp tempdir
```

When the steps are done fast enough and in the right order
(run in a loop!), the device file will be created in
`tempdir`, but the `lchown` will be executed by following
the symlink. As a result, the ownership of the file located
at `/tmp/file_owned_by_root` will be changed.
2017-11-27 21:04:45 +01:00
..
args.go main: purge masterkey from memory as soon as possible 2017-08-11 19:02:26 +02:00
ctlsock_interface.go fusefrontend: implement path decryption via ctlsock 2017-05-07 21:01:39 +02:00
file.go Revert most of "fusefrontend: clamp oversized reads" 2017-10-21 17:43:21 +02:00
file_allocate_truncate.go fusefrontend: Read: use provided buffer 2017-06-30 23:11:38 +02:00
file_holes.go fusefrontend: truncateGrowFile: avoid createHeader() call 2017-03-12 21:06:59 +01:00
fs.go fusefronted: allow_other: close race between mknod and chown 2017-11-27 21:04:45 +01:00
fs_dir.go fusefrontend: Skip gocryptfs.diriv handling when directory was deleted successfully 2017-11-25 16:20:00 +01:00
names.go nametransform: delete unused function DecryptPathDirIV 2016-09-25 18:56:23 +02:00