[arch-projects] [mkinitcpio] overwrite files/symlinks
Hello everybody, I added a hook to the initramfs whose install script added 'uname' by using add_binary. This resulted in major breakage and a kernel panicing on boot. I suppose this is because there is a symlink from uname to busybox - with adding uname I killed the busybox binary. Is this ok by design or do we want to raise an error if something like this happens? I created a patch (see attachment). Does this make sense? -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Chris get my mail address: */=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);}
On Wed, Jul 18, 2012 at 07:03:44PM +0200, Christian Hesse wrote:
Hello everybody,
I added a hook to the initramfs whose install script added 'uname' by using add_binary. This resulted in major breakage and a kernel panicing on boot.
I suppose this is because there is a symlink from uname to busybox - with adding uname I killed the busybox binary. Is this ok by design or do we want to raise an error if something like this happens?
I created a patch (see attachment). Does this make sense?
Nope, it doesn't make sense. We overwrite a busybox symlink in the shutdown hook (cp, since we need the -a flag), and this isn't a problem.
-- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Chris get my mail address: */=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);}
diff --git a/functions b/functions index e17e46e..364bbb2 100644 --- a/functions +++ b/functions @@ -437,6 +437,11 @@ add_file() { return 1 fi
+ if [[ -L "$dest" ]]; then + error "destination is a symbolic link: \`%s'" "$dest" + exit 1 + fi + mode=${3:-$(stat -c %a "$src")} if [[ -z $mode ]]; then error "failed to stat file: \`%s'." "$src"
Dave Reisner <d@falconindy.com> on Wed, 2012/07/18 13:10:
On Wed, Jul 18, 2012 at 07:03:44PM +0200, Christian Hesse wrote:
Hello everybody,
I added a hook to the initramfs whose install script added 'uname' by using add_binary. This resulted in major breakage and a kernel panicing on boot.
I suppose this is because there is a symlink from uname to busybox - with adding uname I killed the busybox binary. Is this ok by design or do we want to raise an error if something like this happens?
I created a patch (see attachment). Does this make sense?
Nope, it doesn't make sense. We overwrite a busybox symlink in the shutdown hook (cp, since we need the -a flag), and this isn't a problem.
Ah, my fault... I added my hook before base in HOOKS array. This way bin was a real directory instead of a symlink to usr/bin. (Note to self: Never do silly things. ;) -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Chris get my mail address: */=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);}
On Wed, Jul 18, 2012 at 07:27:50PM +0200, Christian Hesse wrote:
Dave Reisner <d@falconindy.com> on Wed, 2012/07/18 13:10:
On Wed, Jul 18, 2012 at 07:03:44PM +0200, Christian Hesse wrote:
Hello everybody,
I added a hook to the initramfs whose install script added 'uname' by using add_binary. This resulted in major breakage and a kernel panicing on boot.
I suppose this is because there is a symlink from uname to busybox - with adding uname I killed the busybox binary. Is this ok by design or do we want to raise an error if something like this happens?
I created a patch (see attachment). Does this make sense?
Nope, it doesn't make sense. We overwrite a busybox symlink in the shutdown hook (cp, since we need the -a flag), and this isn't a problem.
Ah, my fault...
I added my hook before base in HOOKS array. This way bin was a real directory instead of a symlink to usr/bin.
Yup, I figured this is what you did. Incidentally, this particular user-induced bug should be fixed by a commit I just pushed a few hours ago: http://projects.archlinux.org/mkinitcpio.git/commit/?id=5f81d06e8b
(Note to self: Never do silly things. ;) -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Chris get my mail address: */=0;b=c[a++];) putchar(b-1/(/* gcc -o sig sig.c && ./sig */b/42*2-3)*42);}
participants (2)
-
Christian Hesse
-
Dave Reisner