aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2013-04-25iso9660.c did not copy terminating 0 of Rock Ridge namerockridgeThomas Schmitt1-1/+1
I noticed that the trailing 0-byte is not copied to the result of iso_readdir(). The function iso_convert_name() does append a trailing 0.
2013-04-02iso9660: use generic get_le32() accessor in SUSP/Rock Ridge codeH. Peter Anvin1-12/+7
Use the new get_le32() accessor in the SUSP/Rock Ridge code. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Cc: Thomas Schmitt <scdbackup@gmx.net>
2013-04-02Generic facilities for byteswapping and unaligned referencesH. Peter Anvin2-11/+141
For future portability, add functions to access both littleendian and bigendian numbers, and to perform unaligned memory references. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
2013-04-02iso9660: read littleendian ISO 9660/SUSP numbersH. Peter Anvin1-9/+6
Attached is a patch which switches susp_rr.c from reading the big-endian ISO 9660 and SUSP numbers to reading the little-endian ones. Tested within libisofs on my collection of ISO images. [ hpa: more mastering programs are known which botch the bigendian information than the littleendian information, so most systems only read the littleendian info regardless of the native byte order. ]
2013-04-02iso9660: Avoid arbitrarily large malloc()sThomas Schmitt1-0/+4
After explaining the slightly wasteful usage of malloc()/memcpy() with multi-block CE entries, i noticed that i did not install a safety cap on the malloc size. I could not challenge this in practice but only by gdb manipulation. My most CE-happy test image has 3 occasions of multi-block CE. All three only span over 2 blocks each.
2013-03-31iso9660: Add support for Rock Ridge filenamesThomas Schmitt4-4/+659
Add support for parsing SUSP and RRIP records, and support for Rock Ridge filename extensions, thus avoiding the filename limitations (length and character set) of plain iso9660. This will be a part of using UTF-8 for filenames and console. [ hpa: manually rebased to the elflink branch ]
2013-03-28pxe: disentangle the legacy and lwip stacks without #ifdefH. Peter Anvin8-81/+88
Disentangle the dependencies via the legacy and the lwip stacks. Now there are no more #ifdefs (except for a single one in pxelinux.asm) and the only difference between the pxelinux and lpxelinux archives are which files are included. To make this happen: 1. Replace the private part of the socket structure with a union. 2. Move the list of URL methods into a stack-dependent file. Reported-by: Josh Triplett <josh@joshtriplett.org> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-03-20pxe: Fix compiler warnings and real bugsyslinux-5.10-pre2Matt Fleming1-1/+1
commit 00a6f13139 ("Partially revert "pxe: Pass absolute path to pxe_chdir()"") introduced a bug by comparing the function 'url_type' with URL_SUFFIX. This resulted in the following warning, fs/pxe/pxe.c: In function ‘pxe_chdir’: fs/pxe/pxe.c:460:18: warning: comparison between pointer and integer [enabled by default] fs/pxe/pxe.c:458:19: warning: unused variable ‘path_type’ [-Wunused-variable] fs/pxe/pxe.c: In function ‘pxe_chdir’: fs/pxe/pxe.c:460:18: warning: comparison between pointer and integer [enabled by default] fs/pxe/pxe.c:458:19: warning: unused variable ‘path_type’ [-Wunused-variable] which unfortunately went unnoticed. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-03-15ldlinux: Fixup lwip merge botchMatt Fleming1-0/+1
The lwip merge changed the code for copying cmdline arguments from, strcpy(q, p); to this, do { *q++ = ch = *p++; } while (ch); which means 'p' no longer points at 'args'. Use 'args' explicitly for the case where we need to apply a filename extension, otherwise users end up seeing errors like, Failed to load COM32 file .c32 Reported-by: Mattias Schlenker <ms@mattiasschlenker.de> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-03-11Partially revert "pxe: Pass absolute path to pxe_chdir()"Matt Fleming1-16/+27
This partially reverts commit b208ba467f678ed8e73f8d11fc0609634120cb83. It isn't correct to always pass URL_OLD_TFTP to chdir(), since the path prefix option may contain a full url, e.g. http:// Specialise the one case where we need to build a ::-style TFTP path inside of get_prefix() to maintain backwards compatability, since from Syslinux 5.00 onwards we may move out of the root directory ("::") while searching for ldlinux.c32. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-03-07readconfig: Don't display "(null)" labels when hitting TABMatt Fleming1-0/+3
It is entirely legitimate for a menu entry to have a NULL label or displayname. Since these entries are not used for execution, skip displaying them in print_labels() when hitting the TAB key. Reported-by: Bernd Blaauw <bblaauw@home.nl> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-03-07ldlinux: Always update ConfigName when opening a config fileMatt Fleming1-0/+9
With the introduction of commit aa7dd29db684 ("ldlinux: Pass config filename as argv[1] to ldlinux.c32") we stopped using ConfigName to store the filename of the config file we intend to open in execute() since it interfered with the filesystem-specific open_config() implementations. But a side-effect of this change is that syslinux_config_file() no longer works if we explicitly pass a filename to parse_config_file(). The logical place to keep ConfigName in sync is in parse_config_file() since it's expected that all the filesystem-specific open_config() functions will fill out ConfigName for us. In the case where the filename is supplied by the caller, we need to fill it out ourselves. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-03-06Merge branch 'lwip-merge' into elflinksyslinux-5.10-pre1Matt Fleming233-1591/+69694
2013-03-06net: Return of the legacy network stackMatt Fleming15-178/+1129
While it's nice having the shiny new lwIP stack, there is definitely merit in being able to choose between two different network stacks. We want to keep the legacy network stack around as it is known to handle funky BIOS implementations and provides a good reference point when bugs are suspected in the lwIP code. Users now have a choice of .0 files. pxelinux.0 uses the legacy network stack, while lpxelinux.0 uses lwIP. Note that not every protocol is converted to using this new API. The http, ftp and tcp code is still inherently tied to the netconn API, and is only available with lpxelinux.0 and the lwIP stack. It's unlikely that this code will ever be fixed up to work with the legacy network stack. Network stack operations are abstracted behind the net_core_* interface, and each network stack has private data fields contained within a struct net_private. Cc: H. Peter Anvin <hpa@zytor.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Gene Cumm <gene.cumm@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-26shuffle: syslinux_dump_movelist() only takes 1 argumentMatt Fleming1-2/+2
Fix up the following compiler error that is triggered with -DDEBUG=2, syslinux/shuffle.c:135:2: error: too many arguments to function ‘syslinux_dump_movelist’ In file included from syslinux/shuffle.c:44:0: ../include/syslinux/movebits.h:87:6: note: declared here syslinux/shuffle.c:155:5: warning: passing argument 1 of ‘syslinux_dump_movelist’ from incompatible pointer type [enabled by default] Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-26lwip: Fix use-after-free memory corruptionMatt Fleming1-0/+1
Set *sem to NULL after free() otherwise calling sys_sem_set_invalid() will cause us to write into a memory location that has potentially either been reused for another allocation or contains freelist metadata. This manifested as malloc() corruption, because we sys_sem_set_invalid() was overwriting malloc metadata used for maintaining the freelist. Cc: H. Peter Anvin <hpa@zytor.com> Cc: Eric W. Biederman <ebiederm@xmission.com> Cc: Gene Cumm <gene.cumm@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-26pxe: Handle closing file with NULL ->inodeMatt Fleming1-0/+3
It's possible that pxe_close_file() will be called with a NULL file->inode from searchdir() if pxe_searchdir() fails to lookup a file. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-26Merge branch 'lwip' into elflinkMatt Fleming227-1653/+68801
Welcome to Syslinux 5.10. Conflicts: NEWS com32/lib/Makefile com32/lib/sys/open.c com32/lib/syslinux/ipappend.c com32/modules/Makefile com32/modules/prdhcp.c core/Makefile core/cmdline.inc core/com32.inc core/comboot.inc core/configinit.inc core/fs/chdir.c core/fs/fs.c core/fs/pxe/dnsresolv.c core/fs/pxe/pxe.c core/fs/pxe/pxe.h core/idle.c core/include/ctype.h core/init.inc core/mem/init.c core/parseconfig.inc core/runkernel.inc core/syslinux.ld core/ui.inc doc/comboot.txt version
2013-02-23com32: Add com32_cmdline() which returns argv[1..argc-1]syslinux-5.02-pre3Matt Fleming3-1/+15
cmd.c32 needs an equivalent of __com32.cs_cmdline now that the COMBOOT code is dead. Introducing com32_cmdline(), which returns a string consisting of module arguments from argv[1] to argv[argc-1], separated by spaces. Reported-by: Gene Cumm <gene.cumm@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-21ldlinux: Don't discard cmdline arguments when executing labelsMatt Fleming1-2/+22
Don't throw away additional cmdline arguments when executing a label. Append them instead. Gene Cumm reports, When using the CLI and calling a LABEL "mylabel", specifying "mylabel options" does not pass "options" through to the kernel's command line. Reported-by: Gene Cumm <gene.cumm@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-21mem: Add magic field to detect memory corruptionMatt Fleming6-6/+38
Very little checking is performed on the validity of freelist metadata. Add a magic field to struct arena_header which can be used to detect memory corruption or whether a user tries to free something that isn't a malloc pointer. This feature can be enabled with -DDEBUG_MALLOC. Turn it on for development in mk/devel.mk. Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-20pxe: Pass absolute path to pxe_chdir()Matt Fleming1-6/+16
We may have moved out of the root directory when calling get_prefix() and so need a way to create an absolute path. Historically, in versions prior to 5.xx we would call pxe_open_config() while we were still in the root directory ("::"), and so, we could construct a relative path to the config file. However, because we need to load ldlinux.c32 before opening the config file, which may involve us changing directory, we need a way of constructing an absolute path to the config file in get_prefix(). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-20ldlinux: Pass config filename as argv[1] to ldlinux.c32Matt Fleming4-14/+17
Instead of hijacking ConfigName use a more standard method of passing a config name to ldlinux.c32's main() function, via argc and argv. This allows us to actually call open_config() the first time ldlinux.c32 is executed even if the file system has already modified ConfigName. For example, pxelinux_configfile() parses the DHCP 209 option and fills out ConfigName before ldlinux.c32 is launched, but because the PXE code needs to do things with the path to the config file (such as parsing the DHCP 210 option), we need to leave the config mangling to open_config() and not try and lookup ConfigName from ldlinux. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-14com32/chain: fix potential problem with 'fs' optionMichal Soltys1-2/+2
It's possible, that fs_lba available through syslinux_derivative_info() could be 0. So match the candidates including disk, instead of only partitions. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: sizeof style change (trivial)Michal Soltys4-20/+20
Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: (utility) use enum for BPB typesMichal Soltys1-9/+2
Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: (partiter) add cebr_siz for completnessMichal Soltys2-0/+2
Might be useful at some and/or when partiter becomes a non-chain specific code. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: (partiter) dos_next_ebr() fixupMichal Soltys1-1/+1
Make sure that *lba is set to 0, if start_lba in the record is 0. Not an issue in any of the code using partiter currently, as that implies either broken layout or a hole. Still useful for consistency with index == -1 or when relax flag is set. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: use single value for partiter related options (flags)Michal Soltys5-16/+13
Also use enum instead of #defines for flags. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: partiter: rename start_lbaMichal Soltys4-23/+23
disk.c also uses start_lba and it can mean few different things depending on context (disk relative, BEBR relative, current EBR relative). partiter's main offset is always a disk relative value. To make it more distinct and avoid suggestion the value is simply a copy of the one from disk_dos_part_entry, we rename it to more fitting abs_lba. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: manglepe_fixchs() correctionMichal Soltys1-10/+38
We have to be more careful, when in-entry start/length values are 0 (one or both). Firstly they are relative to the disk or the [B]EBR (while CHS are absolute). Secondly, length 0 would imply the end CHS being lower than the start CHS. Under normal circumstances, partiter would complain about corrupt layout (unless relax flag is set) and value 0 in any of those fields generally imply a hole, so the adjustments were harmless - nontheless they made everything look silly and not really correct. Adjusted approach is: - for start entry - if the os entry is 0 /and/ the beginning is 0 - reset to 0, otherwise calculate chs - for end entry - as above /or/ length is 0 - reset to 0, otherwise calculate chs Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: index -1 partiter adjustmentMichal Soltys3-14/+12
Currently, the only situation when index could be set to -1 was empty logical partition (with stepall flag active). To keep things consistent (and with index0 already providing "full" info), adjust the partiter to also set -1 on empty main partition. This change also allows simple index check to see whether we're are at the empty partition or not, without digging into disk_dos_part_entry data and retesting ostype field. We rely on it now in manglepe_hide(). Also some retab! changes in partiter.h and one variable rename. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: rely more on addr_t, replace ADDR*Michal Soltys4-22/+32
Whenever the computation imply use of that type, even if it's just uint32_t. Add dosmax (using 40:13) and dosmin (0x500) instead of separate ADDR* and dosmem (in do_boot()). Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: remove common.hMichal Soltys6-43/+3
Only 2 defines there related to preliminary options.c's and chain.c's hecks (real checks come later during mapping to real memory). So move them to options.h and remove common.h. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: recognize exFATMichal Soltys3-4/+19
The usual stuff - hidden sectors (now 64bit at different offset), drive offest, "BPB" type. Formally (?) region from 0x0B to 0x3F should be 0, but ... it's tempting to fill "old" values there. Might be worth adding a switch to handle such behavior. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: implement handling of non-standard hybrid GPT+MBR layoutsMichal Soltys7-18/+34
We also take a bit relaxed approach - so we check for presence of 0xEE at any place, then attempt to read GPT header only if prefmbr is not set. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: implement relax flagMichal Soltys7-11/+42
This flag tones down sanity checks during partition iteration. This is useful in situations such as: - inconsistent layouts, but with some partition still in sane bootable state - usb sticks/disks moved between different PCs might return different size, which might cause problems if the partitions span the whole disk Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: warning/error/help/doc tidyingMichal Soltys6-149/+166
Trivial change that tidies a bit warning / error reporting through fatal()/error()/warn(). Also small doc/help updates. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: use disk_guid for part_guid for 0th partitionMichal Soltys2-7/+4
Initial position of each itarator is whole disk, so this actually matches. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: cleaner variable namesMichal Soltys2-16/+14
Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: mangle and related updatesMichal Soltys5-43/+49
Comments, output and minor adjustments. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: add pi_errored() in partiterMichal Soltys2-2/+7
Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: remove unused ebr_startMichal Soltys2-4/+0
Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: partiter - more precise comments / outputMichal Soltys2-19/+23
Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: remove redundant rawindexMichal Soltys3-7/+4
'index0' provides the same "raw" info, complementing standard 'index'. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: partiter - simplifications and updatesMichal Soltys4-279/+119
The code uses more abstractions than it's really worth or necessary, so these patches simplify the code a bit. Partially suggested by Shao as well. Additionally, there're some added comments and more consistent naming used. Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: shuffle code before partiter simplificationsMichal Soltys1-62/+62
Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: change stepall into flagsMichal Soltys3-14/+18
Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: use anonymous and unnamed aggregatesMichal Soltys4-58/+58
Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: comments, minor adjustmentMichal Soltys7-81/+87
- add some comments to clarify c{nul,add,max} modes - use enums instead of defines - remove unnecessary integer casts - avoid casts and uninline guid_is0() - minor handover comment/flow changes - clean up some old comment-outs - add -fno-strict-aliasing as it's not picked anymore by default for elf.mk Signed-off-by: Michal Soltys <soltys@ziu.info>
2013-02-14com32/chain: update licenses and #ifndef stanzasMichal Soltys12-19/+248
Licenses: chain.[ch] Makefile: GPLv2+ the rest: MIT Defines: Avoid prefixing with _ Signed-off-by: Michal Soltys <soltys@ziu.info> Acked-by: H. Peter Anvin <hpa@linux.intel.com> Acked-by: Shao Miller <sha0.miller@gmail.com>
2013-02-13pxe: chdir to Path Prefix (DHCP Option 210) to open configsyslinux-5.02-pre2Matt Fleming1-0/+1
This is an addition to commit 282fe9da42e ("elflink: Use CurrentDirName for initial PATH if valid") which tried to fix the case when booting PXELINUX with DHCP options 209 and 210. Unfortunately, it's not useful to play games with PATH and we really do need to chdir to the Path Prefix before opening the config file because the config file may be specified with a path relative to the Path Prefix. Just do the chdir() and be done with it. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-11poweroff COM32 moduleSebastian Herbszt2-1/+89
This module is able to power off a system via APM. It replaces the poweroff COMBOOT module. Signed-off-by: Sebastian Herbszt <herbszt@gmx.de> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-114k_sector: Support sectors >512Frediano Ziglio1-14/+27
If EBIOS is detected for this drive it tries to read sector size and use it. If error or no EBIOS 512 is assumed. Buffer to read sector size is always allocated into the stack. CHS informations are not readed as not needed and save space not restoring %dl for drive number. Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-114k_sector: Reduce size reducing a messageFrediano Ziglio1-1/+1
Easy way to reduce code but actually I found the message is readable at the same way as previous. Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-114k_sector: Save some bytes adding a function to set bx before read_sectorFrediano Ziglio1-6/+7
Mostly of the time bx was set as phdr before calling read_sector so add a specific function to set %bx and call read_sector gaining 2 bytes Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-114k_sector: Recover 3 bytes avoid a callFrediano Ziglio1-9/+10
after read_sector %edx:%eax are unused or incremented so increment always at end gaining 3 bytes Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-07version: Welcome to the 5.02 release cyclesyslinux-5.02-pre1Matt Fleming1-1/+1
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-07elflink: Use CurrentDirName for initial PATH if validMatt Fleming2-12/+23
commit c250a42263c8 ("elflink: Set PATH to the directory containing ldlinux.c32") made the mistake of thinking that CurrentDirName doesn't contain useful data for PXELINUX, it may do. If a user specifies a Path Prefix (DHCP option 210) we enter load_env32() with that path as the current working directory. If that path is thrown away instead of being used for PATH we may fail to load a config file as specified with Configuration File Option (DHCP option 209). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-07run_command: Use load_kernel() which understands labelsMatt Fleming1-1/+1
load_kernel() understands how to handle labels from config files whereas create_args_and_load() assumes that the cmdline is a COM32 file. Callers of syslinux_run_command() may want to pass labels, so use a function that allows that. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-07ldlinux: Append BOOT_IMAGE= to kernel cmdlineMatt Fleming2-13/+6
Some users rely on the syntax of the kernel cmdline from 4.xx and this is currently different in 5.xx. Fix things to match the 4.xx syntax. Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-02-04load_linux: bail if no place for the real mode portion is foundH. Peter Anvin1-0/+3
Bail in the case of no space for the real mode code. This can happen mostly for zImage kernels when the conventional memory ceiling is too low. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-02-04load_linux: additional cleanups and corner case fixingH. Peter Anvin1-15/+14
Handle the case with a zero-length passed in initramfs for ancient protocols, since we bothered handling it correctly for newer protocols. Move the setting of the command line pointer to the place where the command line is actually placed, for clarity. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-02-04load_linux: the command line pointer depends on real_mode_baseH. Peter Anvin1-12/+12
The command line pointer depends on real_mode_base, so we can't set it up until we know where the real mode code will actually land. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-02-04load_linux: boot protocol < 2.00 could still have a command lineH. Peter Anvin1-6/+10
The command line existed before the 2.00 boot protocol, it was the initrd which was the new addition to that version. Therefore, allow the command line to be set even for the ancient kernels. This is necessary to specify a command line for memtest86+. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-01-25ldlinux: Correct the attribute bit for foreground brightsyslinux-5.01Matt Fleming1-1/+1
The foreground bright bit number is bit 3. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-25ldlinux: Convert all UsingVGA uses with display_mask_vga()Matt Fleming1-24/+35
Introduce display_mask_vga() which does the necessary converting of UsingVGA into a mask to be AND'd with DisplayMask. Also, apply TextAttribute when clearing the screen after we've seen a form feed. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-25elflink: Set PATH to the directory containing ldlinux.c32syslinux-5.01-pre5Matt Fleming1-2/+23
On ISOLINUX and PXELINUX, CurrentDirName doesn't contain anything useful when we enter load_env32(). commit 10bb72d1528b ("PATH: Use installation directory for 'PATH'") didn't handle the case where we don't have an installation path, or don't find ldlinux.c32 there. If we find ldlinux.c32 in one of 'search_directories' use that directory as the PATH string. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-24NEWS: Add entries for 5.01Matt Fleming1-0/+12
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-24Merge branch 'doc-elflink-for-mfleming' of git://github.com/geneC/syslinux ↵Matt Fleming11-1/+1038
into elflink Pull AsciiDoc-based documentation from Gene Cumm, * 'doc-elflink-for-mfleming' of git://github.com/geneC/syslinux: txt/Makefile: make directories txt/: Remove COMBOOT as of 5.00; spelling; add PATH NEWS: add txt/ Makefile: add txt/ txt/: Add new AsciiDoc formatted documentation
2013-01-24Merge branch 'for-upstream' of git://git.zytor.com/users/pcacjr/syslinux ↵Matt Fleming7-199/+251
into elflink Pull XFS changes from Paulo Alcantara, "feel free to pull my for-upstream branch on zytor. it contains the cache for directory blocks on XFS, ldlinux.c32 installation support for XFS and one trivial fix for shortform-directory lookup." * 'for-upstream' of git://git.zytor.com/users/pcacjr/syslinux: extlinux: Also install ldlinux.c32 file on XFS xfs: Flush cache of directory blocks once done with readdir() xfs: Remove unnecessary free()'s xfs: Fix bug when listing shortform directory entries xfs: Add cache for directory blocks xfs: Make xfs_dir2_entry_name_cmp() inline xfs: Avoid useless malloc()'s and free()'s xfs: Make it more verbose on debug xfs: Improve error and debug printing xfs: Do some refactoring
2013-01-24ldlinux: Fix serial output and delete eprintf()Matt Fleming10-94/+63
Tagging __syslinux_get_serial_info() with __constructor is pretty useless when the global variables it uses, such as SerialPort, etc, are assigned *after* the constructor has run. This constructor made sense when config parsing was done by the core, but parsing is now performed by ldlinux. We need to explicitly invoke the function to initialise __syslinux_serial_console_info once we've parsed any config files. eprintf.c was introduced in commit 086d698c642f ("ldlinux: Add eprintf() to print to VGA and serial") because printf() output wasn't appearing on the serial console. It turns out that the above __constructor confusion was the real bug. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-24ldlinux: Don't update UsingVGA when we just want the valueMatt Fleming1-8/+3
There was a bug introduced when this code was copied from the old 4.x assembly implementation, we don't need to update UsingVGA everytime we read a character, we only need its value when comparing it against the DisplayMask. This bug caused every other character to be displayed when only writing to the text console, as well as other nasties such as making syslinux_force_text_mode() think it's in VGA mode even when it's in text mode. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-24ldlinux: Dynamically allocate cmdline buffer to avoid overflowMatt Fleming1-5/+3
Also, because we no longer pass the allocated buffer to __intcall() and friends we can use malloc() instead of lmalloc(), leaving precious low memory for other users. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-24ldlinux: Clear screen on ASCII 12 (form feed) in DISPLAY fileMatt Fleming1-0/+8
The ansi code won't handle \f the way we want, so we need to explicitly clear the screen and reset the cursor position, like the old 4.x code. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-23module: Replace cur_module with module_current()syslinux-5.01-pre4Matt Fleming3-9/+15
It's easy for cur_module and prev_module to get out of sync with reality (the actual module that is running), so add module_current() which returns the module at the head of the module_list, i.e. the module that was loaded most recently. Better still, by using the list we don't have to do any kind of stacking of module pointers ourselves. This fixes a bug where cur_module contained a stale pointer (the module had actually been unloaded) but the pointer value had since been reallocated for a new module in spawn_load(), meaning that the following check, if (!strcmp(cur_module->name, module->name)) was always going to be true, even though *no* module was actually loaded at this point as we were reloading ldlinux.c32 from start_ldlinux(). This could have been fixed with a NULL-assignment after module_unload(), but using the modules_head list to detect the current module is much cleaner. Note that the core module loaded in load_env32() is always on the list, therefore module_current() will always return a valid pointer. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-23hdt: Move ~162K byte data object from the stack to the bssMatt Fleming1-1/+1
A struct s_hardware is far too large to be placed onto the stack and was causing us run past the end of the allocated stack and overwrite the diskcache, which resulted in apparent file system corruption. Move this hefty object into the bss. Cc: Erwan Velu <erwanaliasr1@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-23module: Check for NULL ctors and dtorsMatt Fleming2-2/+2
Don't dereference a NULL ctor/dtor as that can cause us to crash. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-23module: Check the return value of malloc()Matt Fleming1-0/+8
Instead of blindly writing through a possible-NULL pointer, check the return value of malloc(). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-23init: Leave mem_init() to fs_init()Matt Fleming1-3/+0
Remove the superfluous call from init(). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-23realloc: Set the HEAP when splitting a blockMatt Fleming1-0/+2
Failure to do so means we may put a free block in some random location because ARENA_HEAP_GET() can return something invalid when used to find the correct free list in __free_block(). This bug manifested as running out of available free memory. Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-22extlinux: Also install ldlinux.c32 file on XFSPaulo Alcantara1-4/+26
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
2013-01-22xfs: Flush cache of directory blocks once done with readdir()Paulo Alcantara3-4/+33
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
2013-01-22xfs: Remove unnecessary free()'sPaulo Alcantara3-37/+3
Those freed memories are all now cached and need to get flushed at some point. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
2013-01-22xfs: Fix bug when listing shortform directory entriesPaulo Alcantara1-2/+3
The xfs_fmt_local_readdir() function should call xfs_readdir_dir2_local() instead. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
2013-01-21xfs: Add cache for directory blocksPaulo Alcantara5-71/+118
This cache will avoid lots of malloc() and free() calls for getting an allocated area for directory blocks whenever listing and finding directory entries. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
2013-01-21xfs: Make xfs_dir2_entry_name_cmp() inlinePaulo Alcantara2-13/+13
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
2013-01-21xfs: Avoid useless malloc()'s and free()'sPaulo Alcantara3-61/+25
This patch speeds up the process of retrieving and comparing entry names while looking up inodes. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
2013-01-21xfs: Make it more verbose on debugPaulo Alcantara5-11/+35
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
2013-01-21xfs: Improve error and debug printingPaulo Alcantara1-2/+6
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
2013-01-21xfs: Do some refactoringPaulo Alcantara1-20/+15
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
2013-01-21Merge branch 'com32lib_spotless_for_mfleming' of ↵Matt Fleming1-1/+1
git://github.com/geneC/syslinux into elflink Pull clean up patch from Gene Cumm, * 'com32lib_spotless_for_mfleming' of git://github.com/geneC/syslinux: com32/lib: delete *.c32 on key target
2013-01-21pxe: Add PXELINUX-specific symbols to symbol whitelistMatt Fleming2-3/+3
We need to allow PXELINUX to link with required symbols at runtime otherwise, when executing prdhcp.c32, the user will be presented with the following message, Error: An undefined symbol was referenced Add pxe_call, dns_resolv and unload_pxe to the symbol whitelist. Reported-by: Gene Cumm <gene.cumm@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-20com32/lib: delete *.c32 on key targetGene Cumm1-1/+1
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
2013-01-17core/lzo: move LZO back to uncompressed sectionH. Peter Anvin1-1/+1
The LZO decompressor really can't live in the compressed part of the core, for some odd reason. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-01-17txt/Makefile: make directoriesGene Cumm1-4/+7
2013-01-17txt/: Remove COMBOOT as of 5.00; spelling; add PATHGene Cumm3-14/+22
Also changing markup for AsciiDoc Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
2013-01-17NEWS: add txt/Gene Cumm1-0/+4
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
2013-01-17Makefile: add txt/Gene Cumm1-1/+1
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
2013-01-17txt/: Add new AsciiDoc formatted documentationGene Cumm9-0/+1022
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
2013-01-17elf: remove long-since-obsolete shallow module machineryH. Peter Anvin6-223/+5
Meant to handle symbols exported from the core, but we just pregenerate the dynamic section instead. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-01-17core: switch LZO decompressor to "fast safe" versionH. Peter Anvin8-17/+42
Switch LZO decompressor to the "fast safe" version (and bump LZO source to version 2.06). This allows us to use that decompressor for module compression later without carrying another decompressor. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-01-17core/fs: remove some stale functions, inode refcount debugH. Peter Anvin2-112/+9
Remove some stale (16-bit compatibility) functions in fs.c. Add some debugging for inode refcounts. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-01-17bios.h: add missing dependent #includeH. Peter Anvin1-0/+2
io_delay() defined in bios.h depends on outb() defined in <sys/io.h>. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-01-17Rename libcom32gpl.c32 to libgpl.c32H. Peter Anvin2-4/+4
Conform to 8.3 filenames for essential files. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-01-17Rename libutil_com.c32 to libutil.c32H. Peter Anvin5-8/+7
Conform to 8.3 filenames for essential files. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-01-17Always strip all the modulesH. Peter Anvin15-25/+35
Always strip the modules; they are too big unstripped. Specifically, we generate unstripped *.elf files, and then convert them to stripped *.c32 files. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-01-17dos: obtain the executable pathname, cleanupsH. Peter Anvin7-75/+175
DOS actually does provide the fully qualified pathname to the executable, which would be useful to make ldlinux.c32 data rather than live inside the executable itself -- it has gotten too large. Also, move some DOS internals -- inline functions only used inside the dos directory -- out of libinstaller. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
2013-01-16ldlinux: Perform chdir() before parsing configsyslinux-5.01-pre3Matt Fleming1-3/+3
The old 4.x behaviour for handling CONFIG directives of the form, CONFIG foo.cfg /bar was to lookup the absolute pathname of foo.cfg, then chdir to /bar and finally to parse foo.cfg. The 5.x behaviour reversed the chdir and parsing steps. This meant if foo.cfg's contents were simply, INCLUDE say.txt 4.x would include /bar/say.txt and 5.x would include /boot/syslinux/say.txt (assuming the current working directory was /boot/syslinux). What's even worse is that because of the way 'config_cwd' is used in 5.x we'd actually perform the chdir() operation after the first INCLUDE in foo.cfg, e.g. INCLUDE say.txt INCLUDE say.txt would include /boot/syslinux/say.txt and /bar/say.txt, respectively. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-16module: Check return value of malloc()Matt Fleming1-0/+5
And return NULL after printing an appropriate error message if the call failed. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-15ldlinux: Strip whitespace from LABEL directiveMatt Fleming1-5/+11
Any LABEL directive arguments shouldn't include whitespace characters. If whitespace characters are needed use MENU LABEL. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-14PXELINUX: Fix IPAPPEND to include BOOTIF and SYSUUIDsyslinux-5.01-pre2Matt Fleming1-1/+3
commit 14531c47bc95 ("core: Delete code that is duplicated in ldlinux") erroneously deleted the BOOTIFStr and SYSUUIDStr entries from the PXELINUX-version of IPAppends, meaning that IPAPPEND 3 and IPAPPEND 4 didn't append the corresponding strings to the command line. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-11isolinux: Update LBA in getlinsec loopMatt Fleming1-0/+3
We need to increment the Logical Block Address in eax by the number of sectors we passed to getlinsec after every invocation, otherwise we'll start with the same sector everytime. This bug was discovered when booting an isohybrid image, which failed to boot after printing the following error, "Image checksum error, sorry..." because the isolinux.bin was bigger than 32K, and thus invoked the getlinsec loop that reads the file in chunks. Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-10module: Allow .c32 files to execute themselvesMatt Fleming1-14/+2
Historically, .c32 files had to explicitly link against ldlinux.c32 in order to use its exported symbols. This lead to the undesirable situation during module dependency resolution where loading, e.g. menu.c32, would cause ldlinux.c32 to be reloaded, thus re-executing its main() function and dropping the user at a prompt instead of executing menu.c32. commit 1357b7e62706 ("elflink: Don't reload the current EXEC_MODULE module") was the solution to this problem, since you don't need to reload a module to link against it's symbols. Unfortunately, while this commit was intended to stop ldlinux.c32 being reloaded, it also broke the use case where a .c32 wants to load itself, e.g. when vesamenu.c32 wants to execute vesamenu.c32 with a different config. Luckily, modules no longer need to include ldlinux.c32 in their dependency list, since ldlinux.c32 is *always* loaded and any symbols can be automatically resolved. Which means that the check in spawn_load() can be deleted. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-10extlinux: Fix installation subdirectory patchingMatt Fleming1-7/+3
Commit a126f17f663c ("EXTLINUX: Initial XFS filesystem support") broke the code that inserts the installation subdirectory into the Extended Patch Area (EPA). The EPA entry is used to set the initial working directory on boot. This caused boot failures for users that chose an install directory other than /boot/syslinux (technically, it failed for any path not in 'search_directories' in load_env32()) due to ldlinux.c32 failing to load because the initial working directory was not set correctly. Cc: Paulo Alcantara <pcacjr@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-10extlinux: Make sure ldlinux.sys file is installedPaulo Alcantara1-0/+2
Due to delayed allocation feature on XFS filesystems, a write is not guaranteed to flushed out to the underlying file system after crash or something else - so we need to make sure that ldlinux.sys is installed correctly in the mounted filesystem. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-09menugen: Make it compatible with Py3kPaulo Alcantara1-28/+28
Signed-off-by: Paulo Alcantara <pcacjr@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-08core/kaboom.c: Export __bad_SEG()Matt Fleming1-1/+1
We need to add __bad_SEG() to the symbol export whitelist, otherwise ldlinux.c32 will fail to load if compiled with -DDEBUG=1 due to not being able to resolve __bad_SEG(). Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-08version: Bump minor number and yearsyslinux-5.01-pre1Matt Fleming1-1/+1
Welcome to the 5.01 development cycle and 2013. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-04ldlinux: Dynamically alloc memory for kernel and initrd filenamesMatt Fleming1-19/+45
Absolutely no bounds checking is performed when copying filenames to 'cmdline_buf' and 'initrd_name' which means that sufficiently long strings will scribble over the stack. At best, the files will simply fail to load because the name is garbled. Allocate space for the cmdline at runtime to avoid these overflow problems. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-04ldlinux: Don't delete ldlinux.c32 with 'make clean'Matt Fleming1-4/+6
The documented command sequence for distributions wishing to package a Syslinux release is, make clean make installer Unfortunately, becaues ldlinux.c32 is deleted by 'make clean' the installer target fails like so, make[1]: *** No rule to make target `../com32/elflink/ldlinux/ldlinux.c32', needed by `ldlinuxc32_bin.c'. Stop. make: *** [installer] Error 2 Follow the example set by core/Makefile for ldlinux.sys, etc and add any build files that are required by the installers to $(BTARGET). $(BTARGET) only gets deleted when running 'make spotless'. Reported-by: László Házy <hazy_l@yahoo.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2013-01-03elflink: set the sonames of shared librariesH. Peter Anvin4-4/+4
Set the sonames of shared libraries to the filename, so we don't end up with full pathnames embedded in the files.
2012-12-06Delete 16-bit COMBOOT supportsyslinux-5.00Matt Fleming20-2443/+23
16-bit COMBOOT files are no longer supported by Syslinux in 5.00 so delete all references and change any 32-bit COMBOOT image references to mention ELF instead. Some of the COMBOOT stuff is still used internally so we can't nuke core/comboot.inc yet, but that will disappear in a future release. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-05Symbol export whitelistMatt Fleming44-92/+103
Before modules were dynamically loaded the boundary between GPL and non-GPL code was implicit because of the separate link domains for each module. With dynamic modules we need an explicit whitelist of core symbols that non-GPL code can link against at runtime without needing to be re-licensed under the GPL. Mark such symbols with __export, so that it is explicitly clear which symbols in the core can be linked against by non-GPL code. Reduce the visibility of symbols in both the core and ldlinux.c32 with -fvisibility=hidden. __export changes the visibility to 'default'. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-05core: Fix 'NoHalt'Matt Fleming3-5/+3
Use the same variable in idle.c and ldlinux.c32. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-05com32: Delete unused malloc.c and friendsMatt Fleming4-383/+0
The memory alloc files haven't been referenced since commit 880f67714ec0 ("elflink: remove the malloc.c/free.c/realloc.c/zalloc.c from com32"). They live in the core now. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-05Reduce the number of global variablesMatt Fleming16-270/+28
In preparation for strictly limiting the list of variables that are exported (global) in the core, delete any unused variables, rewrite variable declarations in C that are not referenced by asm and delete files that are no longer included in other asm files. Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-05comboot: Mark API functions obsoleteMatt Fleming1-349/+37
Starting with Syslinux 5.00 the COMBOOT API is obsolete and should not be used by any modules. It is still used internally for some things, such as the ADV code in ldlinux.c32, but that will change in the future. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-04doc: Further explanation for the PATH directive and lookup rulesMatt Fleming1-1/+29
The PATH directive can be quite confusing when coupled with the fact that the current working directory is always searched first when opening files. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-04Revert "menu: Inherit parent menu title"Matt Fleming1-3/+0
This reverts commit 6387f043f7f870e4f0b402dae0b921d99eb82c39. We got reports of this change causing regressions. The reverted commit only goes half way to providing proper parent menu title inheritance, and breaks other configs where the menu label or submenu tagname are used for the title. Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-04ldlinux: Use get_msg_file() for F-keysMatt Fleming1-17/+2
The file that we display with the F-keys may contain background or foreground color codes and so needs to be interpreted by get_msg_file() instead of just printing the color codes as ascii to the screen with cat_file(). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-04ldlinux: Remove default bold attribute typoMatt Fleming1-1/+1
commit 82cbb1bd4133 ("ldlinux: Move DISPLAY file handling out of the core") introduced a typo where the foreground color was always bold when displaying a DISPLAY file. Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-04CLI: Don't always start the CLI at column 0Matt Fleming1-3/+9
If we print files with no newline then it looks better if the CLI prompt is printed immediately after the file content, rather than erasing the line and printing prompt at column 0. This mainly affects files with one line of text and no newline character. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-03ldlinux: Move DISPLAY file handling out of the coresyslinux-5.00-pre13Matt Fleming3-340/+215
The code that handles the DISPLAY directive was writing directly to the BIOS VGA page with __intcall(0x10). This caused corruption problems on the screen because the ansi library code was also writing to the screen. The correct way to fix this is to always use the ansi library code (via printf()) instead of going behind its back and using separate code paths to write to the screen. Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-12-03stdio: Fix unhexchar() for hex digits > 9Matt Fleming1-3/+3
There was a typographical error in commit 9f51b69d7c050 ("core: Reimplement lots asm code in C") which re-wrote the asm implementation of unhexchar() in C. We should be adding 10, not subtracting to get the equivalent decimal integer. Also be explicit about the sign of 'data' and 'num'. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-30Merge branch 'searchdir_leak-5' of git://git.zytor.com/users/sha0/syslinux ↵Matt Fleming1-108/+155
into elflink-searchdir-leak Pull a change that fixes a resource leak from Shao Miller, * 'searchdir_leak-5' of git://git.zytor.com/users/sha0/syslinux: fs: Fix searchdir resource leak
2012-11-30PATH: Use installation directory for 'PATH'Matt Fleming2-4/+2
Files in the installation directory should be able to be executed (along with their dependencies) from any directory in the file hierarchy. Using the installation directory as the default value for 'PATH' is the most sensible way to do this. The PATH config directive still allows other directories to be appended to the 'PATH' variable, which is useful when there are other directories containing modules. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-30ldlinux: Don't try reloading ldlinux.c32 unless it's likely to succeedMatt Fleming2-1/+13
If we can't access ldlinux.c32 with findpath(), reloading it isn't going to work so don't unload it or any of the other modules. Instead return control to the caller. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-30module: Fix incorrect list_entry() useMatt Fleming1-1/+1
Correct the bogus use of list_entry() that was introduced in commit 8f1c64acf9c6 ("module: Stop silently failing to load dependency modules"). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-29fs: Fix searchdir resource leakShao Miller1-108/+155
This is a significant rewrite of the generic lookup logic inside core/fs/fs.c's searchdir function. Previously, there was a memory leak if a path involved multiple directories. After a sufficiently large number of invocations, this could be observed. Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: Shao Miller <sha0.miller@gmail.com>
2012-11-29CLI: Delete 'temp_cmdline' and put 'cmdline' on the stackMatt Fleming1-17/+6
We don't need to preserve the contents of 'cmdline' across calls to edit_cmdline(). In fact, doing so causes things like the TAB key to not function properly because the previous command is used as a prefix to print_labels(), as though the user had typed it explicitly before hitting TAB. Delete 'temp_cmdline' because it no longer serves a purpose. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-29module: Stop silently failing to load dependency modulessyslinux-5.00-pre12Matt Fleming1-1/+11
We should be checking the return value of spawn_load() when loading a module's dependencies and printing some kind of an error message if they fail to load (for instance if the file is missing) and returning an error to the caller. Track the most recently loaded module in 'head' before we begin loading dependencies. That way we can unload any dependencies in the error path that were successfully loaded. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-29ldlinux: Complain to user on failure to perform file operationsMatt Fleming3-4/+4
If we fail to chdir or to execute a COM32 file we should inform the user so that they can debug the problem. We don't currently print anything if the user tries to execute a regular file, such as a config file, as an COM32 image. We also shouldn't be returning the exit value of the module from spawn_load(), because we have no way of doing anything useful with it, and just because a main() function returns -1 doesn't mean it failed to run. Modules need to take care of printing any error messages themselves. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-29module: Append '/' to PATH strings if missingMatt Fleming1-0/+4
We shouldn't be appending a filename to any path string that isn't terminated by a '/', otherwise we end up searching for files like '/isolinuxpwd.c32' Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-29ldlinux: Only append missing filename extensionsMatt Fleming1-3/+6
Don't append an extension like ".c32" if the command already has one! This bug lead to "config.c32" being executed as "config.c32.c32" with the below config snippet, LABEL config COM32 config.c32 /configs/isolinux.cfg Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27Merge branch 'coverity' into elflinksyslinux-5.00-pre11Matt Fleming10-25/+32
2012-11-27core/elflink: Fix off-by-one errorMatt Fleming1-2/+3
We need to remember to allocate space for the terminating NULL in create_args_and_load() otherwise we will write a NUL-byte past the bounds of 'argv[]' to some random part of the stack. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27module: Fix off-by-one error in findpath()Matt Fleming1-2/+2
We need to make sure that 'path' still has enough space to write the trailing NUL-byte. Without this patch it's possible to write a NUL-byte past the end of the on-stack buffer. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27module: Fix memory leak in spawn_load()Matt Fleming1-10/+12
If for some reason we fail to load a module then we need to free the memory allocated to that module. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27pxe: Don't leak inode on timeoutMatt Fleming1-1/+3
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27screensize: Dereference pointers when checking cols/rowsMatt Fleming1-1/+1
Dereference 'rows' and 'cols' to check whether the data they point to is zero, which would indicate the screen size is bogus, instead of checking if they point to NULL. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27hdt-cli: Correct malloc() size argumentMatt Fleming1-1/+1
We need to be allocating sizeof(char *) (4) not sizeof(char) (1) for 'new_argv'. Cc: Erwan Velu <erwanaliasr1@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27Merge branch 'xfs-for-hpa' of git://zytor.com/users/pcacjr/syslinux into ↵Matt Fleming23-40/+5011
merge/elflink/xfs Pull XFS filesystem driver from Paulo Alcantara, * 'xfs-for-hpa' of git://zytor.com/users/pcacjr/syslinux: (60 commits) xfs: Fix the way we check di_mode of an inode xfs: Cleanup previous commit xfs: Add xfs_readlink() xfs: Cleanup and remove some trailing whitespaces xfs: Add XFS_DINODE_FMT_BTREE support in xfs_next_extent() xfs: Cleanup and remove some trailing whitespaces xfs: Rework xfs_dir2_get_right_blk() xfs: cleanup unused structure xfs: Remove some trailing whitespaces xfs: Add full B+tree search support in xfs_dir2_node_find_entry() xfs: Add xfs_fmt_btree_find_entry() xfs: Fix memory leak in xfs_dir2_node_find_entry() function xfs: Cleanup xfs_readdir_dir2_leaf() function xfs: Implement xfs_readdir_dir2_node() function EXTLINUX: Add sanity check for XFS filesystems xfs: Add xfs_fmt_local_readdir() function xfs: Add xfs_fmt_local_find_entry() function xfs: Move readdir functions to another source file xfs: Remove trailing whitespace in xfs_dir2_isleaf() function xfs: Move dir2 functions to another source file ... Conflicts: extlinux/main.c
2012-11-27ldlinux: Reset the console whenever we execute a moduleMatt Fleming3-1/+17
Each module expects the console to start in text mode and will make explicit calls to openconsole() when another console is required, e.g. in vesamenu.c32. This mimics the behaviour found in 4.0x. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27Revert "menu: Make "menu clear" the default"Matt Fleming2-10/+4
This reverts commit 6ab02b6682c0b693b3e4f9afcc2ab8775f804f0a. People are reporting that the above commit causes a regression in behaviour between 4.0x and 5.0x. It also makes the MENU CLEAR directive obsolete and requires that users change their existing config files to restore the old behaviour. The commit was intended to solve the same bug that commit 87320b8de8f3 ("ldlinux: Disable VGA graphics when loading a kernel") addresses but without breaking vesacon, see, commit e04ee714164d ('Revert "ldlinux: Disable VGA graphics when loading a kernel"') for more details. Reported-by: Ady <ady-sf@hotmail.com> Cc: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27gpllib: Distribute libcom32gpl.c32 in releasesMatt Fleming2-2/+2
This is a partial revert of commit b26d1c8642a8 ("Clean up $(GPLLIB) leak"). While we do need to use $(C_LIBS) and respect $(NOGPL), we should also be distributing libcom32gpl.c32. Now that we have ELF modules, such as hdt.c32, that need to have some of their symbols dynamically resolved at runtime we need to distribute libcom32gpl.c32. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27module: Correct the size of the module symbol tableMatt Fleming1-7/+21
We were incorrectly grovelling around in the GNU hash table for the size of the symbol table. Instead we need to map the section headers and search for the SHT_DYNSYM entry. This bug caused hdt.c32 to refuse to load as some symbols were never resolved because not all of the SHT_UNDEF symbols in hdt.c32 were processed. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27cmenu: Delete __intcall()sMatt Fleming1-45/+7
We can dynamically resolve our symbols and so we don't need to jump through __intcall(), which is deprecated anyway in favour of dynamic resolution. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-27Makefile: Add libmenu.c32 to list of modulesMatt Fleming1-1/+1
We need to install libmenu.c32 as it is required by modules like hdt.c32. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-26isolinux: Make BIOSName globalMatt Fleming1-0/+1
commit 967ee8a1ed49 ("CLI: Add Ctrl + V support for printing the Syslinux version") should have made the BIOSName symbol global in core/isolinux.asm. Without this change ldlinux.c32 will hang because it cannot resolve the 'BIOSName' symbol. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-26ldlinux: Fix OnError behaviourMatt Fleming1-2/+8
If the ONERROR directive references a label we need to lookup the label's command line and type. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-26ldlinux: Automatically apply ".c32" extension for COM32 filesMatt Fleming3-2/+13
If a type-specifier is used on the command line, e.g. .com32 pwd we should apply the ".c32" filename extension automatically as this works elsewhere and this behaviour was present in 4.0x. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-26runimage.c: Actually pass arguments to execute()Matt Fleming1-15/+11
Fix the breakage from commit 8486142cf304 ("elflink: Replace __intcall() with direct function calls"), where we stopped passing 'cmdline' to execute(). This bug resulted in things like config.c32 not respecting the <directory> argument. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-26ldlinux: Don't return NULL on KEY_ESC.Matt Fleming1-6/+0
The old command line code in 4.06 ignores KEY_ESC and KEY_CTRL('C') so we should do the same. What currently happens if a user hits ESC is that we return from edit_cmdline() as though we'd timed out waiting for user input. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-26ldlinux: Never exit from ldlinux.c32Matt Fleming3-24/+30
If there's no DEFAULT directive in the config file and the user hits the ENTER key enough times, or we timeout waiting for input, ldlinux.c32 will exit. This should never be allowed to happen, and we need to keep doing the ldlinux_auto_boot()/boot prompt dance. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-15chainboot: Delete extraneous free() in chainboot_file()Matt Fleming1-3/+1
We don't need to call free(buf) if we're jumping to the 'bail' label because 'buf' is always free'd there. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-15vesa: Fix double close() bug in vesacon_load_background()Matt Fleming1-1/+0
We always call fclose() on 'fp' if fopen() was successful, so delete the extraneous fclose() call in read_jpeg_file(). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-15asprintf: Ensure we always call va_end(ap)Matt Fleming1-2/+3
There's currently the potential for us to exit early from asprintf() without calling va_end(ap). Rearrange things so that we always make the call. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-15bufprintf: Add va_end() for our va_copy()Matt Fleming1-2/+6
According to the stdarg(3) man page each invocation of va_copy() should be paired with an invocation of va_end(). Cc: Erwan Velu <erwanaliasr1@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-13ldlinux: Delete dead code and useless printfsyslinux-5.00-pre10Matt Fleming1-28/+0
Seeing the cmdline re-printed every time the user presses enter is very annoying, so delete the offending printf(). Also delete some code that has been commented out for ages. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-13ldlinux: Delete inaccurate 'insufficient memory' messageMatt Fleming1-3/+4
Instead, use strerror() to print a more useful message if we fail to load a kernel. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-12mk: Add Makefile variable for pythonMatt Fleming2-1/+2
Instead of hard-coding the python executable name use a make variable like we do for all other executables used during the build. This has the added bonus of allowing $(PYTHON) to be overridden on the command line, e.g. make PYTHON=python2 which is particularly useful for distributions where /usr/bin/python is actually python3. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-12menu: Inherit parent menu titleMatt Fleming1-0/+3
The documentation for the menu system clearly states that all properties of the parent are inherited in the submenu. Unfortunately there's a bug that means this isn't true for the parent's menu title, so fix that. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-07Merge branch 'strerror-for-mfleming' of git://github.com/geneC/syslinux into ↵Matt Fleming4-12/+122
elflink Pull klibc strerror() patches from Gene Cumm, Update strerror() to give english messages * 'strerror-for-mfleming' of git://github.com/geneC/syslinux: com32 strerror(): Remove macro WITH_ERRLIST use com32 strerror: add errlist.o to Make strerror: Use klibc version
2012-11-06com32 strerror(): Remove macro WITH_ERRLIST useGene Cumm1-2/+0
Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
2012-11-06com32 strerror: add errlist.o to MakeGene Cumm2-2/+6
Exclude in .gitignore Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
2012-11-06strerror: Use klibc versionGene Cumm2-10/+118
Remove old in favor of current klibc version Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
2012-11-06Merge branch 'hexdump' of git://git.zytor.com/users/sha0/syslinux into elflinkMatt Fleming2-1/+247
Pull new hexdump.c32 module from Shao Miller, * 'hexdump' of git://git.zytor.com/users/sha0/syslinux: hexdump.c32: Simple file hex-dumper
2012-11-05Merge branch 'multi_initrd2-5.00-pre9' of ↵Matt Fleming2-43/+172
git://git.zytor.com/users/sha0/syslinux into elflink Pull multi-initrd patches from Shao Miller, These patches provide two new options for the linux.c32 module. The "initrd+=" option allows you to append initramfs-style blobs (files which can be produced with 'cpio -o -H newc') to whatever "initrd" was specified via the "initrd=" option (or was specified indirectly via the INITRD directive). The "initrdfile=" option allows you to load a file and encapsulate it as though you had used 'cpio -o -H newc', and pass the resulting blob alongside the other items that might have been specified with "initrd=" or "initrd+=". * 'multi_initrd2-5.00-pre9' of git://git.zytor.com/users/sha0/syslinux: initramfs chain handling: Accounting fixes for padding, etc. linux.c32: Introduce initrdfile= option linux.c32: Add new initrd+= option for multiple initrds linux.c32: Move some initrd=x,y,z code out of main linux.c32: Add find_arguments function
2012-11-05core: Fix realloc() code transcription errorShao Miller1-2/+2
Commit 79459f631546eea83d4158f535c20ebd4ac18987 copied portions of com32/lib/realloc.c into core/mem/malloc.c, with minor changes for accessing allocation arena header attributes. The previous code used structure members and the current code uses bitmask macros. On a particular line in the original realloc(), there were two assignments in a single expression that included a compound assignment. This fact was missed when the code was copied and modified to use the bitmask macros. Signed-off-by: Shao Miller <sha0.miller@gmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-05extlinux: Avoid dereferencing a garbage pointerMatt Fleming1-3/+1
If opt.reset_adv is set the call to ext_read_adv() is skipped which would have initialised 'filename'. This means that a pointer containing random data from the stack is passed to ext_write_adv(). Just delete the opt.reset_adv logic since modify_adv() handles that case anyway. Reported-by: Frediano Ziglio <frediano.ziglio@citrix.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-04hexdump.c32: Simple file hex-dumperShao Miller2-1/+247
Usage: %s [<option> [...]] <filename> [<option> [...]] Options: -p --page . . . . . . . Pause output every 24 lines --no-buffer . . . . Load the entire file before dumping --extended-ascii . . Use extended ASCII chars in dump -? -h --help . . . . . . Display this help Signed-off-by: Shao Miller <sha0.miller@gmail.com>
2012-11-03initramfs chain handling: Accounting fixes for padding, etc.Shao Miller1-6/+9
Signed-off-by: Shao Miller <sha0.miller@gmail.com>
2012-11-03linux.c32: Introduce initrdfile= optionShao Miller1-0/+53
It is useful to be able to load a file and pass it into a kernel's rootfs via the initramfs scheme. Given "initrdfile=foo", we will load the file foo, encapsulate it with the initramfs cpio format, then pass it alongside any initramfs files that were specified by "initrd=" and "initrd+=" options. One can specify the desired path/filename for the file to have within the rootfs by using the at (@) sign, as in: initrdfile=foo@/goes/to/foo One can also specify multiple files, separated by commas, such as: initrdfile=foo,bar@/somewhere/bar,baz One can also use this option multiple times, as in: initrdfile=foo,bar initrdfile=baz@/somewhere/baz Signed-off-by: Shao Miller <sha0.miller@gmail.com>
2012-11-03linux.c32: Add new initrd+= option for multiple initrdsShao Miller1-0/+8
linux.c32 now processes the kernel's command-line for "initrd+=" options. Given "initrd+=foo", linux.c32 will concatenate the file "foo" to the initrds that it has already loaded due to the "initrd=" option. Given "initrd+=foo,bar", linux.c32 will concatenate both files "foo" and "bar" to the initrds that it has already loaded due to the "initrd=" option. That is, multiple filenames can be specified with comma separators. Given "initrd+=foo initrd+=bar", linux.c32 will concatenate both files "foo" and "bar" to the initrds that it has already loaded due to the "initrd=" option. That is, the "initrd+=" option can be specified multiple times. The position of any "initrd=" option relative to any "initrd+=" option is irrelevant. The "initrd=" option is always processed before all "initrd+=" options. PLEASE NOTE: It is important to note that there are NO SPACES involved in using the "initrd+=" option. "initrd += foo" will not work. Signed-off-by: Shao Miller <sha0.miller@gmail.com>
2012-11-03linux.c32: Move some initrd=x,y,z code out of mainShao Miller1-21/+61
In handling an "initrd=x,y,z" option, it seems reasonable to be able to handle similar options in a similar fashion, so some of the code has been moved out of 'main' and into a new 'process_initramfs_args' function. Signed-off-by: Shao Miller <sha0.miller@gmail.com>
2012-11-03linux.c32: Add find_arguments functionMatt Fleming1-16/+41
The 'find_argument' function already finds the last instance of a command-line option. For symmetry, we introduce a 'find_arguments' function which will help to iterate each instance of a command-line option. Also, this commit uses 'strncmp' in both, instead of 'memcmp'. Modified-by: Shao Miller <sha0.miller@gmail.com> Signed-off-by: Shao Miller <sha0.miller@gmail.com>
2012-11-02CLI: Add Ctrl + V support for printing the Syslinux versionMatt Fleming4-1/+14
The cli code is missing support for printing the version string that is available in Syslinux 4.06 and earlier. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-02win: Print error message if we fail to install to --directoryMatt Fleming1-2/+6
Instead of silently returning with no indication of error if we couldn't install to the --directory argument, print an error message that tells the user the files are not where they wanted. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-02win: Fix installing to a directoryMatt Fleming1-2/+2
commit bda54cb68067 ("installers: Install ldlinux.c32 automatically)" introduced a bug in the move_file() function. move_file() isn't deleting the destination path, including the --directory argument, that ldlinux.sys should be installed to ('new_name'), which means that the MoveFile() calls fails. What it's actually doing is deleting ldlinux.sys from the file destination system. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-02CLI: Fix command history traversalMatt Fleming1-4/+18
The up/down keys were broken with respect to traversing through the command history because it was dereferencing a NULL pointer on the first iteration. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-02com32: Include .init_array section in .ctors in linker scriptMatt Fleming3-27/+4
GCC 4.7 now places pointers to functions with the 'constructor' and 'destructor' function attributes in .init_array and .fini_array sections, respectively, whereas previously they were in the .ctors and .dtors sections. This change breaks the ctors/dtors code as it only expects function to be in the .ctors and .dtors sections, meaning the ctors and dtors functions are never executed. While a COM32_INIT() macro exists that places functions in the .init_array section, no function makes use of it, so there should be no fallout from this change. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-02ldlinux: get_key() requires raw access to user inputMatt Fleming3-2/+41
commit 4503e6260c0 ("ldlinux: Use stdcon instead of rawcon for the console") broke get_key() because it was no longer possible to read raw data from stdin. Provide a new function raw_read() that will return user input a character at a time. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-02ldlinux: Fix logic if no DEFAULT or UI directive is foundMatt Fleming3-30/+30
Somewhere along the way the code that prints, No DEFAULT or UI configuration directive found! was broken, and now no longer prints at all. While we're fixing this it's a good opportunity to rework the logic to be clearer. Now we only print the message if a config file was found, since these directives are obviously missing if there is no config file (a warning will be printed about the lack of config file anyway). Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-01ldlinux: Print a warning if no config file is foundMatt Fleming1-1/+4
This behaviour is taken from 4.06, where an error message is printed if no config file is found. A warning is a more user-friendly choice since Syslinux will still function without a config file. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-11-01pxe: Don't call open_config() from the pxe coreMatt Fleming1-12/+1
Delete some stale comments about ldlinux.c32 requiring ConfigName to be initialised before it's launched - this is no longer true. ldlinux.c32 takes care of opening the config files. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-10-31doc: Document the 'PATH' directivesyslinux-5.00-pre9Matt Fleming1-0/+7
The 'PATH' directive allows the user to specify a list of directories to search when loading modules. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-10-31NEWS: Document the major changes in 5.00Matt Fleming1-0/+24
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
2012-10-24Merge branch 'master' into elflinkMatt Fleming38-406/+1455
The following conflict is a result of the fact comapi_chainboot was only stubbed out on the 'elflink' branch but was properly marked as obsolete in 'master'. Conflicts: core/comboot.inc
2012-10-23diag/mbr: Fix typo in READMEMatt Fleming1-1/+1
Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>