unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Steven Allen <steven@stebalien.com>
Cc: help-guix <help-guix@gnu.org>
Subject: Re: Why is /gnu/store writable by the guixbuild group?
Date: Sat, 23 Jan 2016 21:56:46 +0100	[thread overview]
Message-ID: <878u3gui9d.fsf@gnu.org> (raw)
In-Reply-To: <20160122231756.GA2284@stebalien.com> (Steven Allen's message of "Fri, 22 Jan 2016 18:17:56 -0500")

Steven Allen <steven@stebalien.com> skribis:

> On 01-22-16, Ludovic Courtès wrote:
>> What’s TPE (sorry for asking) and how does it complain exactly?
>
> Nevermind. This is a false positive and I've reported it to the
> grsecurity people (although they may not fix it...).
>
> FYI...
>
> TPE is Trusted Path Execution. Basically, it means that unprivileged
> users can only execute files that are not writable, or in directories
> writable, by users other than the current user or root. This is to help
> make it harder to trick users into executing files written by a
> malicious user.

OK.

> However, after thinking about it, I this case is a false positive
> because:
>
> 1. The /gnu/store/xxx/ directories and all files under them are not
>    group writable and are owned by root.
> 2. /gnu/store has the sticky bit set.
>
> This means that any files in /gnu/store that are owned by root must have
> "blessed" by root (either linked-in or chowned by root). Therefore, the
> "no group/other writable parent directory" constraint is unnecessary.

Indeed.  The mental model is that /gnu/store is populated by root, on
behalf of other users.  The build users act as a poor way to enforce the
principle of least authority.

>> > Guix on Arch keeps on trying to build gcc on my poor laptop even
>> > though I've enabled substitutes but that's another issue...)
>> 
>> That shouldn’t happen, unless you’re using an old version of Guix for
>> which substitutes are no longer available at hydra.gnu.org.
>
> I'm using guix from git and I'll look into it. In my build logs, it
> appears that tar is complaining about an invalid flat ("--sort=name") so
> I think guix is having trouble extracting the substitutes.

I don’t think this is related.

>> That’s because initially build processes write to their chroot, but when
>> the build completes, the build process moves the outputs (the results)
>> back to the store. 
> ...
>> If you look at ‘strace -f -p $(pidof guix-daemon)’ while running ‘guix
>> build grue-hunter’, the above lines of code translate to:
>> 
>> --8<---------------cut here---------------start------------->8---
>> 7519  --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=7544, si_status=0, si_utime=0, si_stime=0} ---
>> 7519  lstat("/gnu/store/660hdld3sc7laz8kw871pd3yyg9khs5m-grue-hunter-1.0.drv.chroot/gnu/store/h6sdfqzv4xbydwiafiqvrw0d5505l1l8-grue-hunter-1.0", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
>> 7519  rename("/gnu/store/660hdld3sc7laz8kw871pd3yyg9khs5m-grue-hunter-1.0.drv.chroot/gnu/store/h6sdfqzv4xbydwiafiqvrw0d5505l1l8-grue-hunter-1.0", "/gnu/store/h6sdfqzv4xbydwiafiqvrw0d5505l1l8-grue-hunter-1.0") = 0
>> --8<---------------cut here---------------end--------------->8---
>
> I just did a local experiment (running pstree alongside strace) and,
> unless I'm mistaken, 7519 is running as root.

Hmm, I think you’re right.  In that case the thing does not need to be
world-writable, we should try and check!

Thanks,
Ludo’.

      reply	other threads:[~2016-01-23 20:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22 14:41 Why is /gnu/store writable by the guixbuild group? Steven Allen
2016-01-22 14:57 ` Thompson, David
2016-01-22 15:45   ` Steven Allen
2016-01-22 15:59     ` Andreas Enge
2016-01-22 17:02     ` Ludovic Courtès
2016-01-22 23:17       ` Steven Allen
2016-01-23 20:56         ` Ludovic Courtès [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878u3gui9d.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=help-guix@gnu.org \
    --cc=steven@stebalien.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).