mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Bruno Thomsen <bruno.thomsen@gmail.com>
To: ptxdist@pengutronix.de
Subject: Re: [ptxdist] [PATCH] bugfix: kernel: install modules with 755 permission
Date: Tue, 7 Jul 2020 12:56:39 +0200	[thread overview]
Message-ID: <CAH+2xPCTLRnE5Qq55T_kDsSrCtNZZCfj3VOvbqVc1-V+Xq6smw@mail.gmail.com> (raw)
In-Reply-To: <20200707100622.GI25134@pengutronix.de>

Den tir. 7. jul. 2020 kl. 12.06 skrev Michael Olbrich
<m.olbrich@pengutronix.de>:
> > > Hmmm, you're running ptxdist with a 0002 umask, right?[1]
> >
> > Yes, I am running ptxdist with 0002 umask as a user.
> >
> > On Fedora users run with 0002 umask and root runs with 0022 umask,
> > but ptxdist does not support building as root, e.g. rootless
> > containers (podman).
> >
> > $ podman run --rm -it fedora:32
> > [root@7940c80a5df2 /]# whoami
> > root
> > [root@7940c80a5df2 /]# umask
> > 0022
> >
> > So requiring that umask seems a little counter intuitive to me.
>
> The problem is, that a lot of packages don't explicitly set the permissions
> when creating files or directories during 'make install'.
> Especially directories are often created with a simple 'mkdir'.
> As a result, the permissions depend on your current umask.
>
> And then install_tree looks just takes that permission. At that point
> PTXdist cannot know, if the permission was explicitly set like this or not,
> so we cannot do a fixup.
>
> We could change the umask during the ptxdist run, but I'm reluctant to do
> this because the umask is a security feature and just changing it feels
> wrong to me.
> Hmm, maybe we could just make it strikter:
>
> mask="$(umask)"
> if [ "$(( (mask | 0022) & 0755))" -eq 0 ]; then
>         umask 0022
> else
>         # fail here?
> fi
>
> or something like that?

Given the use-case I think your suggestion makes sense; Make umask
stricter when ptxdist is started with something like 0000 or 0002. Keep
umask 0022, and fail in case it's started with another umask.
This will make it consistent with how ptxdist handles being started with
UID = 0.

Fail trace suggestion:
ptxdist: error: refusing to run PTXdist with umask ${mask}.

/Bruno

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de

      reply	other threads:[~2020-07-07 10:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06 15:24 Bruno Thomsen
2020-07-06 16:56 ` Michael Olbrich
2020-07-07  6:26   ` Bruno Thomsen
2020-07-07 10:06     ` Michael Olbrich
2020-07-07 10:56       ` Bruno Thomsen [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

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

  git send-email \
    --in-reply-to=CAH+2xPCTLRnE5Qq55T_kDsSrCtNZZCfj3VOvbqVc1-V+Xq6smw@mail.gmail.com \
    --to=bruno.thomsen@gmail.com \
    --cc=ptxdist@pengutronix.de \
    /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