linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* make tar*-pkg considered dangerous
@ 2012-09-12  3:16 Andi Kleen
  2012-09-12 16:43 ` Zdenek Kaspar
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Andi Kleen @ 2012-09-12  3:16 UTC (permalink / raw)
  To: linux-kernel, linux-kbuild


Hi,

We've had some incidents with people destroying Fedore 17 installs
(to the point of reinstall) by installing a kernel tarball generated with 
make tar*-pkg

The problem is that the tarball includes /lib/{modules,firmware},
but on FC17 /lib is a symlink. tar when it unpacks the tarball
replaces the symlink with the directory. So they end up
with a /lib which only contains the new kernel files, but nothing else,

And then the system doesn't boot anymore.

I'm not sure there is a good fix for this. I don't know of a way to
convince tar to not do that. And putting everything into /usr 
would be very incompatible.

Disable these make targets or add warnings?  If disabling people should
use rpms or dpkgs instead?

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: make tar*-pkg considered dangerous
  2012-09-12  3:16 make tar*-pkg considered dangerous Andi Kleen
@ 2012-09-12 16:43 ` Zdenek Kaspar
       [not found] ` <20120912161154.GB3289@khazad-dum.debian.net>
  2012-09-25 22:17 ` [PATCH] kbuild: Do not package /boot and /lib in make tar-pkg Michal Marek
  2 siblings, 0 replies; 6+ messages in thread
From: Zdenek Kaspar @ 2012-09-12 16:43 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, linux-kbuild

On 09/12/2012 05:16 AM, Andi Kleen wrote:
> 
> Hi,
> 
> We've had some incidents with people destroying Fedore 17 installs
> (to the point of reinstall) by installing a kernel tarball generated with 
> make tar*-pkg
> 
> The problem is that the tarball includes /lib/{modules,firmware},
> but on FC17 /lib is a symlink. tar when it unpacks the tarball
> replaces the symlink with the directory. So they end up
> with a /lib which only contains the new kernel files, but nothing else,
> 
> And then the system doesn't boot anymore.
> 
> I'm not sure there is a good fix for this. I don't know of a way to
> convince tar to not do that. And putting everything into /usr 
> would be very incompatible.
> 
> Disable these make targets or add warnings?  If disabling people should
> use rpms or dpkgs instead?
> 
> -Andi
> 

I dont use the dpkg/rpm variants myself, but unpack with -h should be
enough?

HTH, Z.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: (fwd) make tar*-pkg considered dangerous
       [not found] ` <20120912161154.GB3289@khazad-dum.debian.net>
@ 2012-09-12 20:39   ` Ben Hutchings
  2012-09-19 11:58   ` Thorsten Glaser
  1 sibling, 0 replies; 6+ messages in thread
From: Ben Hutchings @ 2012-09-12 20:39 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh, Andi Kleen
  Cc: pkg-sysvinit-devel, debian-devel, linux-kernel, linux-kbuild

On Wed, Sep 12, 2012 at 01:11:54PM -0300, Henrique de Moraes Holschuh wrote:
> I am forwarding this as a remider that, should we ever get to the point of
> moving around /lib or /usr/lib, /sbin or /usr/sbin, and /bin or /usr/sbin,
> as well as any other such trunks, we really ought to consider whether we
> should be using symlinks or bind mounts [where possible] for such moves.
> 
> Also, just in case, Debian users are gently reminded that there are less
> unsavory methods of packing custom kernel builds for later use in Debian
> boxes, including the Linux upstream "deb-pkg" make target (dpkg is a lot
> smarter than "tar"), and the make-kpkg command provided by the
> kernel-package Debian package (which IMHO tends to produce better kernel
> .deb packages than the upstream "deb-pkg" make target.

kernel-package is effectively unmaintained, so please don't recommend
its use unless you intend to rectify that.

> ----- Forwarded message from Andi Kleen <andi@firstfloor.org> -----
> Date: Wed, 12 Sep 2012 05:16:46 +0200
> From: Andi Kleen <andi@firstfloor.org>
> To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
> Subject: make tar*-pkg considered dangerous
> 
> Hi,
> 
> We've had some incidents with people destroying Fedore 17 installs
> (to the point of reinstall) by installing a kernel tarball generated with 
> make tar*-pkg
> 
> The problem is that the tarball includes /lib/{modules,firmware},
> but on FC17 /lib is a symlink. tar when it unpacks the tarball
> replaces the symlink with the directory.
[...]

Presumably the tarball also contains an entry for the directory lib,
and that (not the subdirectory entries) triggers tar to replace the
symlink.  So this can be fixed by only including
lib/{modules,firmware} in the tarball, not lib.

A quick experiment under F16 (tar 1.26) supports this.
 
Ben.

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: make tar*-pkg considered dangerous
       [not found] ` <20120912161154.GB3289@khazad-dum.debian.net>
  2012-09-12 20:39   ` (fwd) " Ben Hutchings
@ 2012-09-19 11:58   ` Thorsten Glaser
  1 sibling, 0 replies; 6+ messages in thread
From: Thorsten Glaser @ 2012-09-19 11:58 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh, Andi Kleen
  Cc: pkg-sysvinit-devel, debian-devel, linux-kernel, linux-kbuild

Henrique de Moraes Holschuh dixit:

>From: Andi Kleen <andi@firstfloor.org>
>To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org

>The problem is that the tarball includes /lib/{modules,firmware},
>but on FC17 /lib is a symlink. tar when it unpacks the tarball
>replaces the symlink with the directory. So they end up
>with a /lib which only contains the new kernel files, but nothing else,

Well, this is both a bug in Fedora IMHO, and (objectively) a fault
of the users to not use “tar xzphf” for extracting.

bye,
//mirabilos
-- 
“It is inappropriate to require that a time represented as
 seconds since the Epoch precisely represent the number of
 seconds between the referenced time and the Epoch.”
	-- IEEE Std 1003.1b-1993 (POSIX) Section B.2.2.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] kbuild: Do not package /boot and /lib in make tar-pkg
  2012-09-12  3:16 make tar*-pkg considered dangerous Andi Kleen
  2012-09-12 16:43 ` Zdenek Kaspar
       [not found] ` <20120912161154.GB3289@khazad-dum.debian.net>
@ 2012-09-25 22:17 ` Michal Marek
  2012-09-26 16:08   ` Andi Kleen
  2 siblings, 1 reply; 6+ messages in thread
From: Michal Marek @ 2012-09-25 22:17 UTC (permalink / raw)
  To: andi; +Cc: linux-kbuild, linux-kernel, ben

There were reports of users destroying their Fedora installs by a kernel
tarball that replaces the /lib -> /usr/lib symlink. Let's remove the
toplevel directories from the tarball to prevent this from happening.

Reported-by: Andi Kleen <andi@firstfloor.org>
Suggested-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
 arch/x86/Makefile        |    2 +-
 scripts/Makefile.fwinst  |    4 ++--
 scripts/package/buildtar |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index c098ca4..b0c5276 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -138,7 +138,7 @@ KBUILD_CFLAGS += $(call cc-option,-mno-avx,)
 KBUILD_CFLAGS += $(mflags-y)
 KBUILD_AFLAGS += $(mflags-y)
 
-archscripts: scripts_basic
+archscripts:
 	$(Q)$(MAKE) $(build)=arch/x86/tools relocs
 
 ###
diff --git a/scripts/Makefile.fwinst b/scripts/Makefile.fwinst
index 4d908d1..c3f69ae 100644
--- a/scripts/Makefile.fwinst
+++ b/scripts/Makefile.fwinst
@@ -27,7 +27,7 @@ endif
 installed-mod-fw := $(addprefix $(INSTALL_FW_PATH)/,$(mod-fw))
 
 installed-fw := $(addprefix $(INSTALL_FW_PATH)/,$(fw-shipped-all))
-installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/./
+installed-fw-dirs := $(sort $(dir $(installed-fw))) $(INSTALL_FW_PATH)/.
 
 # Workaround for make < 3.81, where .SECONDEXPANSION doesn't work.
 PHONY += $(INSTALL_FW_PATH)/$$(%) install-all-dirs
@@ -42,7 +42,7 @@ quiet_cmd_install = INSTALL $(subst $(srctree)/,,$@)
 $(installed-fw-dirs):
 	$(call cmd,mkdir)
 
-$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $(INSTALL_FW_PATH)/$$(dir %)
+$(installed-fw): $(INSTALL_FW_PATH)/%: $(obj)/% | $$(dir $(INSTALL_FW_PATH)/%)
 	$(call cmd,install)
 
 PHONY +=  __fw_install __fw_modinst FORCE
diff --git a/scripts/package/buildtar b/scripts/package/buildtar
index 8a7b155..d0d748e 100644
--- a/scripts/package/buildtar
+++ b/scripts/package/buildtar
@@ -109,7 +109,7 @@ esac
 	if tar --owner=root --group=root --help >/dev/null 2>&1; then
 		opts="--owner=root --group=root"
 	fi
-	tar cf - . $opts | ${compress} > "${tarball}${file_ext}"
+	tar cf - boot/* lib/* $opts | ${compress} > "${tarball}${file_ext}"
 )
 
 echo "Tarball successfully created in ${tarball}${file_ext}"
-- 
1.7.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] kbuild: Do not package /boot and /lib in make tar-pkg
  2012-09-25 22:17 ` [PATCH] kbuild: Do not package /boot and /lib in make tar-pkg Michal Marek
@ 2012-09-26 16:08   ` Andi Kleen
  0 siblings, 0 replies; 6+ messages in thread
From: Andi Kleen @ 2012-09-26 16:08 UTC (permalink / raw)
  To: Michal Marek; +Cc: andi, linux-kbuild, linux-kernel, ben

On Wed, Sep 26, 2012 at 12:17:25AM +0200, Michal Marek wrote:
> There were reports of users destroying their Fedora installs by a kernel
> tarball that replaces the /lib -> /usr/lib symlink. Let's remove the
> toplevel directories from the tarball to prevent this from happening.

Looks good to me.

Please also submit to stable and all the longterms.

-Andi

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-09-26 16:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-12  3:16 make tar*-pkg considered dangerous Andi Kleen
2012-09-12 16:43 ` Zdenek Kaspar
     [not found] ` <20120912161154.GB3289@khazad-dum.debian.net>
2012-09-12 20:39   ` (fwd) " Ben Hutchings
2012-09-19 11:58   ` Thorsten Glaser
2012-09-25 22:17 ` [PATCH] kbuild: Do not package /boot and /lib in make tar-pkg Michal Marek
2012-09-26 16:08   ` Andi Kleen

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 NNTP newsgroup(s).