RFC: Move default module cache path from /tmp

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

RFC: Move default module cache path from /tmp

Vassil Vassilev via cfe-dev
Hello,

I'd like to request that we move the default module cache that is currently created in /tmp to somewhere that isn't a shared writable directory (with all of the associated security risks).

The traditional Unix solution for caches (web browser, ccache, etc) is to have a directory in $HOME.

I'd like to suggest moving the clang module cache there.

Dave

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Move default module cache path from /tmp

Vassil Vassilev via cfe-dev

nnelson@x570:~$ mktemp -d
/tmp/tmp.lOPA8997cg
nnelson@x570:~$ ls -ld /tmp/tmp.lOPA8997cg
drwx------ 2 nnelson nnelson 40 Jun 21 11:27 /tmp/tmp.lOPA8997cg

This shows that mktemp creates a directory under /tmp with only the user's access permissions.

/tmp currently defaults to disk when Ubuntu is installed. There may be cases where some distributions mount /tmp in memory. I have changed fstab here to mount /tmp in memory.

Neil Nelson

On 6/21/20 3:54 AM, David Zarzycki via cfe-dev wrote:
Hello,

I'd like to request that we move the default module cache that is currently created in /tmp to somewhere that isn't a shared writable directory (with all of the associated security risks).

The traditional Unix solution for caches (web browser, ccache, etc) is to have a directory in $HOME.

I'd like to suggest moving the clang module cache there.

Dave

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: RFC: Move default module cache path from /tmp

Vassil Vassilev via cfe-dev
In reply to this post by Vassil Vassilev via cfe-dev
On 21/06/2020 10:54, David Zarzycki via cfe-dev wrote:
> Hello,
>
> I'd like to request that we move the default module cache that is
> currently created in /tmp to somewhere that isn't a shared writable
> directory (with all of the associated security risks).

This hasn't really been an issue for a long time on modern *NIX systems.
  /tmp usually has the sticky bit set, which allows any user to create a
file or directory owned by them and with permissions that are not world
readable,(and mkdirtemp does that automatically).

> The traditional Unix solution for caches (web browser, ccache, etc) is
> to have a directory in $HOME.

There are three places where caches live on *NIX (ignoring XNU systems,
which add a few more):

  - /tmp, for caches that are safe to discard across reboots
  - /var/cache, for things that are shared and are expected to persist
across reboots
  - ~/.cache (if $XDG_CACHE_HOME is unsed), for things that are pre-user
and are persistent.

> I'd like to suggest moving the clang module cache there.

If the cache is per-user (for security, I believe it has to be, unless
there is a trusted clang daemon running somewhere to maintain
system-wide ones) and should be preserved across reboots, I agree.  We
should put them somewhere like $XDG_CACHE_HOME/clang.

That said, on a lot of systems, $HOME is a lot slower than a build disk
and so it would be nice to have an environment variable to override this
configuration.

David

_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev