From: Olaf Hering <olh@suse.de>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] missing padding in cpio_mkfile in usr/gen_init_cpio.c
Date: Sun, 16 Nov 2003 16:08:02 +0100 [thread overview]
Message-ID: <20031116150802.GA17141@suse.de> (raw)
Add this line to main() and booting will fail with panic:
cpio_mkfile("t", "/sbin/init", 0700, 0, 0);
olaf@nectarine:~/kernel/pineapple/linuxppc-2.5> echo > t
olaf@nectarine:~/kernel/pineapple/linuxppc-2.5> gcc -o foo usr/gen_init_cpio.c.kaputt.c && ./foo | tee bar | cpio -vt
drwxr-xr-x 2 root root 0 Nov 16 16:06 /dev
crw------- 1 root root 5, 1 Nov 16 16:06 /dev/console
drwx------ 2 root root 0 Nov 16 16:06 /root
-rwx------ 1 root root 1 Nov 16 16:05 /sbin/init
cpio: premature end of file
olaf@nectarine:~/kernel/pineapple/linuxppc-2.5> gcc -o foo usr/gen_init_cpio.c && ./foo | tee bar | cpio -vt
drwxr-xr-x 2 root root 0 Nov 16 16:06 /dev
crw------- 1 root root 5, 1 Nov 16 16:06 /dev/console
drwx------ 2 root root 0 Nov 16 16:06 /root
-rwx------ 1 root root 1 Nov 16 16:05 /sbin/init
2 blocks
olaf@nectarine:~/kernel/pineapple/linuxppc-2.5> diff -pu usr/gen_init_cpio.c.kaputt.c usr/gen_init_cpio.c
--- usr/gen_init_cpio.c.kaputt.c 2003-11-16 16:03:27.000000000 +0100
+++ usr/gen_init_cpio.c 2003-11-16 16:02:12.000000000 +0100
@@ -197,6 +197,7 @@ void cpio_mkfile(const char *filename, c
for (i = 0; i < buf.st_size; ++i)
fputc(filebuf[i], stdout);
+ offset += buf.st_size;
close(file);
free(filebuf);
push_pad();
--
USB is for mice, FireWire is for men!
sUse lINUX ag, nÜRNBERG
reply other threads:[~2003-11-16 15:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20031116150802.GA17141@suse.de \
--to=olh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/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