[syslinux] Possible bug in ext_read_adv
Frediano Ziglio
frediano.ziglio at citrix.com
Thu May 30 08:16:33 PDT 2013
Hi,
looking at ext_read_adv code (extlinux/main.c)
static int ext_read_adv(const char *path, int devfd, const char **namep)
{
int err;
const char *name;
if (fs_type == BTRFS) {
/* btrfs "ldlinux.sys" is in 64k blank area */
return btrfs_read_adv(devfd);
} else if (fs_type == XFS) {
/* XFS "ldlinux.sys" is in the first 2048 bytes of the primary AG */
return xfs_read_adv(devfd);
} else {
err = read_adv(path, name = "ldlinux.sys");
if (err == 2) /* ldlinux.sys does not exist */
err = read_adv(path, name = "extlinux.sys");
if (namep)
*namep = name;
return err;
}
}
beside the name is quite confusing (ext from extlinux and ext from
ext2/3 filesystem), for XFS code xfs_read_adv is called which is
static inline int xfs_read_adv(int devfd)
{
const size_t adv_size = 2 * ADV_SIZE;
if (xpread(devfd, syslinux_adv, adv_size, boot_image_len) != adv_size)
return -1;
return syslinux_validate_adv(syslinux_adv) ? 1 : 0;
}
boot_image_len for me is about 53 kb so it read after 53 kb after start
of partition however comment on ext_read_adv state that 2kb is used.
Also in ext_write_adv adv is written with a write_adv which use a file
inside the filesystem so the first function looks wrong to me. Well, we
are not corrupting XFS cause is a read and never a write but surely adv
won't work for xfs code.
I did not test it so I could be possible wrong.
Frediano
More information about the Syslinux
mailing list