search for: boot_image_len

Displaying 16 results from an estimated 16 matches for "boot_image_len".

2012 Aug 02
0
[PATCH 2/3] ALPHA: first try to fix adv problem
...uot;); @@ -450,10 +473,17 @@ int ext2_fat_install_file(const char *path, int devfd, struct stat *rst) goto bail; } + /* FIXME copied above */ + sector_size = fs_type == BTRFS ? SECTOR_SIZE : get_sector_size(devfd); + /* Write it the first time */ - if (xpwrite(fd, boot_image, boot_image_len, 0) != boot_image_len || - xpwrite(fd, syslinux_adv, 2 * ADV_SIZE, - boot_image_len) != 2 * ADV_SIZE) { + pos = 0; + if (xpwrite(fd, boot_image, boot_image_len, pos) != boot_image_len || + !inc_and_align(fd, &pos, boot_image_len, sector_size) || + xpwrite(fd, syslinux_adv, ADV_SIZ...
2016 Feb 24
2
[PATCH 4/5] installers: fix a possible buffer overflow when looking for LDLINUX_MAGIC
If the ldlinux being processed is garbage, the search for LDLINUX_MAGIC will overflow its buffer - fix that. I did encounter this issue in Rufus as, due to notorious incompatibilities between different versions of ldlinux.sys and the com32's residing on an ISO, we download a version specific ldlinux.sys from our server... which may get trashed if the user sits behind one of these
2015 Nov 13
4
[PATCH] extlinux: code cleanup and simplification
...me; + + if (fs_type == BTRFS) { + /* btrfs "ldlinux.sys" is in 64k blank area */ + return ext_read_adv_offset(devfd, BTRFS_ADV_OFFSET); + } else if (fs_type == XFS) { + /* XFS "ldlinux.sys" is in the first 2048 bytes of the primary AG */ + return ext_read_adv_offset(devfd, boot_image_len); + } 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; + } +} + +static int ext_write_adv_offset(int devfd, off_t offset...
2016 Mar 07
0
[PATCH 4/5] installers: fix a possible buffer overflow when looking for LDLINUX_MAGIC
...behind one > of these corporate firewalls that modifies the download payload and > replaces it with something like "You are not authorized to download > this file"... $0.02: - Casting to a uintptr_t is ugly (and not C89, not that Syslinux cares about that) - The boot_image + boot_image_len calculation is loop invariant, so some kind of boot_image_end or wpe pointer before the loop might be nicer. Unfortunately, the 8-bit boot_image_len (bytes) versus the 32-bit wp stride complicates things Maybe something like: const uint32_t * wpe = (const uint32_t *) boot_image + boot_len...
2016 Mar 07
1
[PATCH 4/5] installers: fix a possible buffer overflow when looking for LDLINUX_MAGIC
...etic logic, unless you specifically use uintptr_t. But, considering your other very valid point, let me see if I can work something better here, that could eliminate this cast. > With the proposed patch's uintptr_t stuff, if the magic isn't found: > > * <------- boot_image_len dictates the final byte > * <-------- wp is less than boot_image_len > 00001111222233XXYYYY <- XX are out-of-bound bytes > * <---- Where wp is when the loop breaks > * <------ As far as any kind of pointer should point >...
2015 Nov 18
0
[PATCH] extlinux: code cleanup and simplification
...BTRFS) { > + /* btrfs "ldlinux.sys" is in 64k blank area */ > + return ext_read_adv_offset(devfd, BTRFS_ADV_OFFSET); > + } else if (fs_type == XFS) { > + /* XFS "ldlinux.sys" is in the first 2048 bytes of the primary AG */ > + return ext_read_adv_offset(devfd, boot_image_len); > + } 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; > + } > +} > + > +...
2015 Nov 26
0
[syslinux:master] extlinux: code cleanup and simplification
...me; + + if (fs_type == BTRFS) { + /* btrfs "ldlinux.sys" is in 64k blank area */ + return ext_read_adv_offset(devfd, BTRFS_ADV_OFFSET); + } else if (fs_type == XFS) { + /* XFS "ldlinux.sys" is in the first 2048 bytes of the primary AG */ + return ext_read_adv_offset(devfd, boot_image_len); + } 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; + } +} + +static int ext_write_adv_offset(int devfd, off_t offset...
2015 Nov 18
1
[PATCH] extlinux: code cleanup and simplification
...t; +??? /* btrfs "ldlinux.sys" is in 64k blank area */ > +??? return ext_read_adv_offset(devfd, BTRFS_ADV_OFFSET); > +? ? } else if (fs_type == XFS) { > +??? /* XFS "ldlinux.sys" is in the first 2048 bytes of the primary AG */ > +??? return ext_read_adv_offset(devfd, boot_image_len); > +? ? } 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; > +? ?...
2015 Nov 12
1
[PATCH] Unification of ext_(write/read)_adv
..._OFFSET) - != 2 * ADV_SIZE) - return -1; - - return syslinux_validate_adv(syslinux_adv) ? 1 : 0; -} - -static inline int xfs_read_adv(int devfd) +static int ext_read_adv_offset(int devfd, off_t offset) { const size_t adv_size = 2 * ADV_SIZE; - if (xpread(devfd, syslinux_adv, adv_size, boot_image_len) != adv_size) - return -1; + if (xpread(devfd, syslinux_adv, adv_size, offset) != adv_size) + return -1; return syslinux_validate_adv(syslinux_adv) ? 1 : 0; } @@ -1441,10 +1432,10 @@ static int ext_read_adv(const char *path, int devfd, const char **namep) if (fs_type == BTRFS...
2012 Sep 10
19
Initial support for sector size >512
This set of patches add some support for sector size >512. Currently it fixes extlinux, MBR for GPT and ext partitions. Other code is unaffected. This set of patches has been tested on a read Dell machine running a beta firmware.
2012 Aug 02
0
[PATCH 1/3] ALPHA: make sector size dynamic in extlinux
...sHeads, geo.heads); set_32(&sbs->bsHiddenSecs, geo.start); @@ -292,11 +306,11 @@ static int patch_file_and_bootblock(int fd, const char *dir, int devfd) /* Construct the boot file map */ dprintf("directory inode = %lu\n", (unsigned long)dirst.st_ino); - nsect = (boot_image_len + SECTOR_SIZE - 1) >> SECTOR_SHIFT; + nsect = (boot_image_len + sector_size - 1) / sector_size; nsect += 2; /* Two sectors for the ADV */ sectp = alloca(sizeof(sector_t) * nsect); if (fs_type == EXT2 || fs_type == VFAT || fs_type == NTFS) { - if (sectmap(fd, sectp, nsect))...
2013 May 30
0
Possible bug in ext_read_adv
...ame; 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...
2014 Dec 24
14
[PATCH 0/8] extlinux: support unmounted ext2/3/4 filesystem
Hello syslinux, Merry Christmas! These patches will make extlinux work with umounted ext2/3/4 filesystem, for example: $ extlinux -i /dev/sdXN or $ extlinux -i file_block Also it can work with something like: $ extlinux /dev/sdXN --reset-adv or $ extlinux file_block --reset-adv We don't use a new option (I planed to use "-d" but it is already in use), it will check whether the
2015 Jan 02
13
[PATCH 0/9] linux/syslinux: support ext2/3/4 device
Hello, Happy New Year! These patches make syslinux/linux support ext2/3/4, and it doesn't require the root privilege, I'd like to add a separate e2fs/syslinux, if that is more appropriate, it should be easy to do that. I put these patches on github so that you can easily get them in case you'd like to test them. (The repo's name is sys_tmp, which avoids confusing others, I will
2015 Nov 13
4
[PATCH 1/4] extlinux: simplification
...bail: since the cow feature of btrfs will move the ldlinux.sys every where */ int btrfs_install_file(const char *path, int devfd, struct stat *rst) { - char *file; - int fd, rv; - patch_file_and_bootblock(-1, path, devfd); if (xpwrite(devfd, (const char _force *)boot_image, boot_image_len, BTRFS_EXTLINUX_OFFSET) @@ -680,32 +696,7 @@ int btrfs_install_file(const char *path, int devfd, struct stat *rst) * it doesn't need to be within the first 64K. The Syslinux core * has enough smarts to search the btrfs dirs and find this file. */ - rv = asprintf(&file,...
2012 Sep 03
1
[GIT-PULL] XFS filesystem driver
...size */ + /* the btrfs partition first 64K blank area is used to store boot sector and boot image, the boot sector is from 0~512, the boot image starts after */ #define BTRFS_BOOTSECT_AREA 65536 @@ -295,7 +307,8 @@ int patch_file_and_bootblock(int fd, const char *dir, int devfd) nsect = (boot_image_len + SECTOR_SIZE - 1) >> SECTOR_SHIFT; nsect += 2; /* Two sectors for the ADV */ sectp = alloca(sizeof(sector_t) * nsect); - if (fs_type == EXT2 || fs_type == VFAT || fs_type == NTFS) { + if (fs_type == EXT2 || fs_type == VFAT || fs_type == NTFS || + fs_type == XFS) { if (sec...