public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: Michal Marek <mmarek@suse.com>
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] builddeb: fix file permissions before packaging
Date: Thu, 7 Jul 2016 16:56:49 +0200	[thread overview]
Message-ID: <20160707165649.1fe18f84@md1em3qc> (raw)
In-Reply-To: <1467903037-11785-1-git-send-email-henning.schild@siemens.com>

On Thu, 7 Jul 2016 16:50:37 +0200
Henning Schild <henning.schild@siemens.com> wrote:

> Builddep is not very explicit about file permissions. Actually the
> file permissions in the package are largely influenced by the umask
> of the user cloning the git and building the package. If that umask
> does not set go+r the resulting linux-headers package will prevent
> non-root users from building out-of-tree modules. And that is
> probably just one unexpected effect.

This problem was found in a CI-system (buildbot) running with a 0077
umask and building packages. These packages contained headers with 600
instead of 644 and users could not build there modules anymore.

Reproduce with "umask 0077", "git clone ..", ... "make deb-pkg"

> Being a packaging/install tool builddep should make sure the file
> permissions are set correctly and not just derived from a value that
> is never checked.

If that patch is not accepted i strongly suggest at least asserting
that the headers in linux-headers.deb have 644. I am not sure which is
the better solution, but builddeb should not produce such broken
packages.

> This patch derives the "r" and "x" bits for all files from the file
> owner, all directories in the package will be 755.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  scripts/package/builddeb | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/scripts/package/builddeb b/scripts/package/builddeb
> index 86e56fe..615e0ed 100755
> --- a/scripts/package/builddeb
> +++ b/scripts/package/builddeb
> @@ -26,6 +26,11 @@ create_package() {
>  	# Fix ownership and permissions
>  	chown -R root:root "$pdir"
>  	chmod -R go-w "$pdir"
> +	# in case we are in a restrictive umask environment like 0077
> +	# set permissions for dirs and derive "go"-"rx" permissions
> from "u"
> +	find $pdir -type d -exec chmod 0755 {} +
> +	find $pdir -type f -perm -u+r -exec chmod go+r {} +
> +	find $pdir -type f -perm -u+x -exec chmod go+x {} +
>  
>  	# Create the package
>  	dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}"
> -p$pname -P"$pdir"


  reply	other threads:[~2016-07-07 14:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-07 14:50 [PATCH] builddeb: fix file permissions before packaging Henning Schild
2016-07-07 14:56 ` Henning Schild [this message]
2016-07-22 12:15 ` Michal Marek
2016-07-22 12:46   ` [PATCHv2] " Henning Schild
2016-07-26 20:27     ` Michal Marek
2016-07-22 12:48   ` [PATCH] " Henning Schild

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=20160707165649.1fe18f84@md1em3qc \
    --to=henning.schild@siemens.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.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