Re: cramfs mounts provide corrupted content since 2.6.15

From: Dave Johnson
Date: Tue Feb 28 2006 - 16:05:59 EST


Chris Mason writes:
> On Tuesday 28 February 2006 15:40, Dave Johnson wrote:
>
> > What version of mkcramfs are you using? Empty regular files should
> > have offset set to 0 already.
>
> The image is being generated by util-linux 2.12r (this is the root disk for
> the SUSE 10.1 install).
>
> I checked via hexdump, the offset for mtab is definitely not zero.
>
> -chris
>

Ah, that makes sense now.

parse_directory() is different between util-linux 2.12r and
cramfstools 1.1:

util-linux 2.12r:

} else if (S_ISREG(st.st_mode)) {
entry->path = strdup(path);
if (entry->size) {
if (entry->size >= (1 << CRAMFS_SIZE_WIDTH)) {
warn_size = 1;
entry->size = (1 << CRAMFS_SIZE_WIDTH) - 1;
}
}


cramfstools 1.1:

} else if (S_ISREG(st.st_mode)) {
if (entry->size) {
if (access(path, R_OK) < 0) {
warn_skip = 1;
continue;
}
entry->path = strdup(path);
if (!entry->path) {
die(MKFS_ERROR, 1, "strdup failed");
}
if ((entry->size >= 1 << CRAMFS_SIZE_WIDTH)) {
warn_size = 1;
entry->size = (1 << CRAMFS_SIZE_WIDTH) - 1;
}
}


in cramfstools entry->path is not set for empty files causing
write_data() to keep offset set to 0.


--
Dave Johnson
Starent Networks

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/