]> git.proxmox.com Git - grub2.git/log
grub2.git
9 years agocommands/syslinux: Add missing free.
Vladimir Serbinenko [Sat, 24 Jan 2015 20:23:25 +0000 (21:23 +0100)]
commands/syslinux: Add missing free.

Found by: Coverity scan.

9 years agocommands/parttool: Add missing device close.
Vladimir Serbinenko [Sat, 24 Jan 2015 20:22:02 +0000 (21:22 +0100)]
commands/parttool: Add missing device close.

Found by: Coverity scan.

9 years agocommands/nativedisk: Add missing device_close.
Vladimir Serbinenko [Sat, 24 Jan 2015 20:18:36 +0000 (21:18 +0100)]
commands/nativedisk: Add missing device_close.

Found by: Coverity scan.

9 years agocommands/macbless: Handle device opening errors correctly.
Vladimir Serbinenko [Sat, 24 Jan 2015 20:15:14 +0000 (21:15 +0100)]
commands/macbless: Handle device opening errors correctly.

Wrong variable was checked for errors.

Found by: Coverity scan.

9 years agocommands/macbless: Fix potential overflow.
Vladimir Serbinenko [Sat, 24 Jan 2015 20:12:02 +0000 (21:12 +0100)]
commands/macbless: Fix potential overflow.

Is a minor concern as no such FS would be created under normal circumstances
and failure was benign.

Found by: Coverity scan.

9 years agocommands/macbless: Remove incorrect grub_free.
Vladimir Serbinenko [Sat, 24 Jan 2015 20:08:50 +0000 (21:08 +0100)]
commands/macbless: Remove incorrect grub_free.

Found by: Coverity Scan

9 years agocommands/legacycfg: Fix resource leaks.
Vladimir Serbinenko [Sat, 24 Jan 2015 20:06:23 +0000 (21:06 +0100)]
commands/legacycfg: Fix resource leaks.

9 years agozfs: Fix disk-matching logic.
Vladimir Serbinenko [Sat, 24 Jan 2015 19:57:26 +0000 (20:57 +0100)]
zfs: Fix disk-matching logic.

Reported by: Tim Chase <dweeezil>

9 years agocommands/hdparm: Add missing grub_disk_close.
Vladimir Serbinenko [Sat, 24 Jan 2015 19:55:06 +0000 (20:55 +0100)]
commands/hdparm: Add missing grub_disk_close.

Found by: Coverity scan.

9 years agogptsync: Add missing device_close.
Vladimir Serbinenko [Sat, 24 Jan 2015 19:52:02 +0000 (20:52 +0100)]
gptsync: Add missing device_close.

Found by: Coverity scan

9 years agocommands/fileXX: Fix memory leak.
Vladimir Serbinenko [Sat, 24 Jan 2015 19:50:35 +0000 (20:50 +0100)]
commands/fileXX: Fix memory leak.

Found by: Coverity Scan.

9 years agocommands/file: Change the confusing loop stop condition.
Vladimir Serbinenko [Sat, 24 Jan 2015 19:45:25 +0000 (20:45 +0100)]
commands/file: Change the confusing loop stop condition.

Old condition was used to zero-out header variable on exit of the loop.
This is correct but confusing. Replace with in-loop logic.

Found by: Coverity Scan.

9 years agocommands/acpi: Use ALIGN_UP rather than manual expression.
Vladimir Serbinenko [Sat, 24 Jan 2015 19:41:43 +0000 (20:41 +0100)]
commands/acpi: Use ALIGN_UP rather than manual expression.

Improves readability and hopefully automatic scanning.

Found by: Coverity Scan.

9 years agouhci: Fix null pointer dereference.
Vladimir Serbinenko [Sat, 24 Jan 2015 19:38:12 +0000 (20:38 +0100)]
uhci: Fix null pointer dereference.

Found by: Coverity scan.

9 years agoAlways add -msoft-float to avoid compiler generating float arithmetics.
Vladimir Serbinenko [Sat, 24 Jan 2015 19:37:08 +0000 (20:37 +0100)]
Always add -msoft-float to avoid compiler generating float arithmetics.

9 years agoGenerate empty ChangeLog if no .git is available.
Vladimir Serbinenko [Sat, 24 Jan 2015 19:14:59 +0000 (20:14 +0100)]
Generate empty ChangeLog if no .git is available.

When making dist from a git snapshot without repo available make dist would
fail to find ChangeLog. Generate empty ChangeLog if no ChangeLog is already
present and repo is not available.

Reported by: Andrei Borzenkov <arvidjaar@gmail.com>

9 years agoMakefile.am: Fix Changelog cutoff address.
Vladimir Serbinenko [Sat, 24 Jan 2015 19:12:51 +0000 (20:12 +0100)]
Makefile.am: Fix Changelog cutoff address.

gitlog-to-changelog Doesn't generate entries for cutoff day, only
for days after the cutoff date, adjust by one to compensate.

9 years agoefidisk: Return the determined root disk even if partition is unknown.
Vladimir Serbinenko [Sat, 24 Jan 2015 18:53:13 +0000 (19:53 +0100)]
efidisk: Return the determined root disk even if partition is unknown.

9 years agoutil/grub-mkrescue.c: Always include part_msdos and part_gpt on EFI.
Vladimir Serbinenko [Sat, 24 Jan 2015 16:45:16 +0000 (17:45 +0100)]
util/grub-mkrescue.c: Always include part_msdos and part_gpt on EFI.

When booted from stick, EFI would use GPT partition and our root
device detection algortihm depends on GRUB's ability to see the same
partitions. Hence include msdos and gpt partmap modules on EFI even when
they're not needed to access root filesystem.

9 years agoconf/Makefile.common: Remove unused {LD,C}FLAGS_CPU.
Vladimir Serbinenko [Sat, 24 Jan 2015 16:44:19 +0000 (17:44 +0100)]
conf/Makefile.common: Remove unused {LD,C}FLAGS_CPU.

9 years agoAutogenerate ChangeLog from git changelog.
Vladimir Serbinenko [Sat, 24 Jan 2015 16:29:50 +0000 (17:29 +0100)]
Autogenerate ChangeLog from git changelog.

Old ChangeLog is moved to ChangeLog-2015. For all changes starting from
this one ChangeLog will be generated from gitlog only on explicit make
invocation and make dist.

9 years ago * tests/file_filter/file: Really add missing file.
Vladimir Serbinenko [Fri, 23 Jan 2015 18:46:02 +0000 (19:46 +0100)]
* tests/file_filter/file: Really add missing file.

9 years agoMention platform "none" in NEWS
Andrei Borzenkov [Fri, 23 Jan 2015 18:06:16 +0000 (21:06 +0300)]
Mention platform "none" in NEWS

9 years agoaccept also hdX as alias to native Xen disk name
Andrey Borzenkov [Fri, 23 Jan 2015 16:52:45 +0000 (19:52 +0300)]
accept also hdX as alias to native Xen disk name

To be compatible with legacy pv-grub, sort disks by increasing order of handle
value. This allows reusing legacy pv-grub menu.lst which is using hdX names.

Suggested-By: Michael Chang <mchang@suse.com>
Closes: 44026
9 years agoRemove direct _llseek code and require long filesystem libc.
Felix Janda [Thu, 22 Jan 2015 18:54:36 +0000 (19:54 +0100)]
Remove direct _llseek code and require long filesystem libc.

9 years ago Remove potential division by 0 in gfxmenu.
Vladimir Serbinenko [Wed, 21 Jan 2015 14:56:53 +0000 (15:56 +0100)]
Remove potential division by 0 in gfxmenu.

9 years agogrub_menu_init_page: Avoid returning 0 geometry to avoid divisions by 0.
Vladimir Serbinenko [Wed, 21 Jan 2015 14:51:49 +0000 (15:51 +0100)]
grub_menu_init_page: Avoid returning 0 geometry to avoid divisions by 0.

9 years agounix/cputime.c: Cache sc_clk_tck and check it for sanity.
Vladimir Serbinenko [Wed, 21 Jan 2015 09:28:52 +0000 (10:28 +0100)]
unix/cputime.c: Cache sc_clk_tck and check it for sanity.

9 years ago * grub-core/kern/efi/mm.c (grub_efi_get_memory_map): Never return a
Vladimir Serbinenko [Wed, 21 Jan 2015 09:17:36 +0000 (10:17 +0100)]
* grub-core/kern/efi/mm.c (grub_efi_get_memory_map): Never return a
descriptor_size==0 to avoid potential divisions by zero.

9 years agohaiku/getroot.c (grub_util_find_partition_start_os): Avoid division by zero.
Vladimir Serbinenko [Tue, 20 Jan 2015 20:12:46 +0000 (21:12 +0100)]
haiku/getroot.c (grub_util_find_partition_start_os): Avoid division by zero.

9 years agortc_get_time_ms.c (grub_rtc_get_time_ms): Avoid division by zero.
Vladimir Serbinenko [Tue, 20 Jan 2015 20:10:55 +0000 (21:10 +0100)]
rtc_get_time_ms.c (grub_rtc_get_time_ms): Avoid division by zero.

9 years ago * grub-core/loader/i386/xnu.c (guessfsb): Avoid division by 0.
Vladimir Serbinenko [Tue, 20 Jan 2015 20:07:41 +0000 (21:07 +0100)]
* grub-core/loader/i386/xnu.c (guessfsb): Avoid division by 0.

9 years ago * grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that
Vladimir Serbinenko [Tue, 20 Jan 2015 20:07:08 +0000 (21:07 +0100)]
* grub-core/kern/i386/tsc.c (calibrate_tsc): Ensure that
no division by 0 occurs.

9 years ago * include/grub/misc.h (grub_div_roundup): Remove as it's unused.
Vladimir Serbinenko [Tue, 20 Jan 2015 19:52:41 +0000 (20:52 +0100)]
* include/grub/misc.h (grub_div_roundup): Remove as it's unused.

9 years ago * grub-core/term/gfxterm.c: Avoid division by zero.
Vladimir Serbinenko [Tue, 20 Jan 2015 19:50:35 +0000 (20:50 +0100)]
* grub-core/term/gfxterm.c: Avoid division by zero.

9 years agoAvoid division by zero in serial.
Vladimir Serbinenko [Tue, 20 Jan 2015 19:41:36 +0000 (20:41 +0100)]
Avoid division by zero in serial.

9 years ago * grub-core/video/readers/jpeg.c: Avoid division by zero.
Vladimir Serbinenko [Tue, 20 Jan 2015 18:35:49 +0000 (19:35 +0100)]
* grub-core/video/readers/jpeg.c: Avoid division by zero.

9 years ago* grub-core/disk/diskfilter.c: Validate volumes to avoid division by zero.
Vladimir Serbinenko [Tue, 20 Jan 2015 18:33:20 +0000 (19:33 +0100)]
* grub-core/disk/diskfilter.c: Validate volumes to avoid division by zero.

9 years agoterm.h: Avoid returining 0-sized terminal as it may lead to division by zero.
Vladimir Serbinenko [Tue, 20 Jan 2015 16:55:41 +0000 (17:55 +0100)]
term.h: Avoid returining 0-sized terminal as it may lead to division by zero.

9 years ago * grub-core/fs/zfs.c: Avoid divisions by zero.
Vladimir Serbinenko [Tue, 20 Jan 2015 16:46:55 +0000 (17:46 +0100)]
* grub-core/fs/zfs.c: Avoid divisions by zero.

9 years ago * grub-core/fs/btrfs.c: Avoid divisions by zero.
Vladimir Serbinenko [Tue, 20 Jan 2015 16:36:29 +0000 (17:36 +0100)]
* grub-core/fs/btrfs.c: Avoid divisions by zero.

9 years agogrub-core/lib/pbkdf2.c (grub_crypto_pbkdf2): Check that hash len is not 0.
Vladimir Serbinenko [Tue, 20 Jan 2015 14:26:09 +0000 (15:26 +0100)]
grub-core/lib/pbkdf2.c (grub_crypto_pbkdf2): Check that hash len is not 0.

9 years agoosdep/linux/blocklist.c (grub_install_get_blocklist): Check blocksize validity.
Vladimir Serbinenko [Tue, 20 Jan 2015 14:19:35 +0000 (15:19 +0100)]
osdep/linux/blocklist.c (grub_install_get_blocklist): Check blocksize validity.

9 years ago * grub-core/disk/i386/pc/biosdisk.c: Check disk size sanity.
Vladimir Serbinenko [Tue, 20 Jan 2015 14:10:34 +0000 (15:10 +0100)]
* grub-core/disk/i386/pc/biosdisk.c: Check disk size sanity.

9 years ago * grub-core/disk/ieee1275/nand.c (grub_nand_open): Check block size
Vladimir Serbinenko [Tue, 20 Jan 2015 14:09:42 +0000 (15:09 +0100)]
* grub-core/disk/ieee1275/nand.c (grub_nand_open): Check block size
validity.

9 years agogrub_dmraid_nv_detect: Do not divide by zero.
Vladimir Serbinenko [Tue, 20 Jan 2015 14:01:58 +0000 (15:01 +0100)]
grub_dmraid_nv_detect: Do not divide by zero.

9 years ago* grub-core/fs/hfs.c (grub_hfs_mount): Additional filesystem sanity checks.
Vladimir Serbinenko [Tue, 20 Jan 2015 13:59:40 +0000 (14:59 +0100)]
* grub-core/fs/hfs.c (grub_hfs_mount): Additional filesystem sanity checks.

9 years ago * grub-core/fs/minix.c: Additional filesystem sanity checks.
Vladimir Serbinenko [Tue, 20 Jan 2015 13:53:09 +0000 (14:53 +0100)]
* grub-core/fs/minix.c: Additional filesystem sanity checks.

9 years ago* grub-core/fs/ext2.c (grub_ext2_mount): Additional checks for superblock validity.
Vladimir Serbinenko [Tue, 20 Jan 2015 13:40:27 +0000 (14:40 +0100)]
* grub-core/fs/ext2.c (grub_ext2_mount): Additional checks for superblock validity.

9 years agogrub_ufs_mount: Check that sblock.ino_per_group is not 0.
Vladimir Serbinenko [Tue, 20 Jan 2015 13:30:05 +0000 (14:30 +0100)]
grub_ufs_mount: Check that sblock.ino_per_group is not 0.

9 years agoReject NILFS2 superblocks with over 1GiB blocks.
Vladimir Serbinenko [Tue, 20 Jan 2015 13:27:27 +0000 (14:27 +0100)]
Reject NILFS2 superblocks with over 1GiB blocks.

* grub-core/fs/nilfs2.c (grub_nilfs2_valid_sb): Check that
block size is <= 1GiB.

9 years agogrub_ata_setaddress: Check that geometry is sane when using CHS addressing.
Vladimir Serbinenko [Tue, 20 Jan 2015 13:16:22 +0000 (14:16 +0100)]
grub_ata_setaddress: Check that geometry is sane when using CHS addressing.

9 years ago* grub-core/disk/AFSplitter.c (AF_merge): Check that mdlen is not 0.
Vladimir Serbinenko [Tue, 20 Jan 2015 13:12:30 +0000 (14:12 +0100)]
* grub-core/disk/AFSplitter.c (AF_merge): Check that mdlen is not 0.

9 years agogrub_cmd_play: Avoid division by zero.
Vladimir Serbinenko [Tue, 20 Jan 2015 13:11:32 +0000 (14:11 +0100)]
grub_cmd_play: Avoid division by zero.

9 years agogrub-core/fs/minix.c (grub_minix_read_file): Avoid reading past the end of file.
Vladimir Serbinenko [Tue, 20 Jan 2015 12:55:55 +0000 (13:55 +0100)]
grub-core/fs/minix.c (grub_minix_read_file): Avoid reading past the end of file.

9 years agogrub_fshelp_read_file: Don't attempt to read past the end of file.
Vladimir Serbinenko [Tue, 20 Jan 2015 11:58:17 +0000 (12:58 +0100)]
grub_fshelp_read_file: Don't attempt to read past the end of file.

9 years agogrub_script_lexer_yywrap: Update len synchronously with line.
Vladimir Serbinenko [Tue, 20 Jan 2015 11:53:20 +0000 (12:53 +0100)]
grub_script_lexer_yywrap: Update len synchronously with line.

9 years agoReplace explicit sizeof divisions by ARRAY_SIZE.
Vladimir Serbinenko [Tue, 20 Jan 2015 11:45:45 +0000 (12:45 +0100)]
Replace explicit sizeof divisions by ARRAY_SIZE.

9 years agoSupport GELI v6 and v7
Kris Moore [Mon, 19 Jan 2015 18:56:41 +0000 (21:56 +0300)]
Support GELI v6 and v7

9 years agoFix serial --rtscts option processing
Andrei Borzenkov [Tue, 9 Dec 2014 18:41:49 +0000 (21:41 +0300)]
Fix serial --rtscts option processing

9 years agogrub-core/kern/arm/misc.S: fix unaligned grub_uint64_t local variable
David Kozub [Thu, 20 Nov 2014 20:53:14 +0000 (21:53 +0100)]
grub-core/kern/arm/misc.S: fix unaligned grub_uint64_t local variable

The unaligned local in __aeabi_uidivmod leads to a store to a 64bit
value at an address that is not divisible by 8 (in grub_divmod64).
The compiler most likely generates a STRD instruction to store it and
this causes an exception.

Fixes Savannah bug #43632.

This includes improvements done by Leif Lindholm.

9 years ago* grub-core/fs/ext2.c (grub_ext2_read_block): Support large sparse chunks.
Peter Nelson [Sun, 7 Dec 2014 16:57:49 +0000 (17:57 +0100)]
* grub-core/fs/ext2.c (grub_ext2_read_block): Support large sparse chunks.

9 years agoAvoid use of non-portable echo -n in grub-mkconfig
Andrei Borzenkov [Sun, 7 Dec 2014 11:56:17 +0000 (14:56 +0300)]
Avoid use of non-portable echo -n in grub-mkconfig

util/grub-mkconfig_lib.in(version_test_gt): "echo -n" is not really needed,
final newline is stripped by command substitution.

util/grub.d/10_kfreebsd.in, util/grub.d/10_linux.in,
util/grub.d/20_linux_xen.in: change how list is built, to avoid echo -n
completely.

util/grub.d/30_os-prober.in: add spaces to printed line directly

Closes 43668.

9 years agofix double free in grub_net_recv_tcp_packet
Curtis Larsen [Sun, 7 Dec 2014 08:28:57 +0000 (11:28 +0300)]
fix double free in grub_net_recv_tcp_packet

Using the http module to download config files, produces memory errors,
after the config file is downloaded.

The error was traced to the tcp stack in grub-core/net/tcp.c. The wrong
netbuff pointer was being freed in the clean up loop.

Changing the code to free the correct netbuff pointer removes the runtime
error.

Closes 42765.

9 years agofix memory corruption in pubkey filter over network
Andrei Borzenkov [Fri, 5 Dec 2014 18:17:08 +0000 (21:17 +0300)]
fix memory corruption in pubkey filter over network

grub_pubkey_open closed original file after it was read; it set
io->device to NULL to prevent grub_file_close from trying to close device.
But network device itself is stacked (net -> bufio); and bufio preserved
original netfs file which hold reference to device. grub_file_close(io)
called grub_bufio_close which called grub_file_close for original file.
grub_file_close(netfs-file) now also called grub_device_close which
freed file->device->net. So file structure returned by grub_pubkey_open
now had device->net pointed to freed memory. When later file was closed,
it was attempted to be freed again.

Change grub_pubkey_open to behave like other filters - preserve original
parent file and pass grub_file_close down to parent. In this way only the
original file will close device. We really need to move this logic into
core instead.

Also plug memory leaks in error paths on the way.

Reported-By: Robert Kliewer <robert.kliewer@gmail.com>
Closes: bug #43601
9 years agoadd file filters tests
Andrei Borzenkov [Fri, 5 Dec 2014 17:19:58 +0000 (20:19 +0300)]
add file filters tests

Tests file access with all filters enabled. It does it both for local
and network access, due to regression in signature checking over network.

This includes all files in distribution to not depend on existence
of compression tools and gpg. Test preloads all required modules to
avoid having to provide signatures for them.

Still not implemented is file offset filter (is not available in grub
script, needs extra module)

9 years agogrub-shell: support --files also for net boot
Andrei Borzenkov [Fri, 5 Dec 2014 16:55:59 +0000 (19:55 +0300)]
grub-shell: support --files also for net boot

This allows running tests that require extra files using netboot as well.

9 years agogrub-core/loader/i386/xen_fileXX.c: memory leak in grub_xen_get_infoXX
Andrei Borzenkov [Mon, 1 Dec 2014 18:23:54 +0000 (21:23 +0300)]
grub-core/loader/i386/xen_fileXX.c: memory leak in grub_xen_get_infoXX

CID: 73645, 73782

9 years agogrub-core/fs/zfs/zfsinfo.c: memory leak in print_vdev_info
Andrei Borzenkov [Mon, 1 Dec 2014 17:54:12 +0000 (20:54 +0300)]
grub-core/fs/zfs/zfsinfo.c: memory leak in print_vdev_info

CID: 73635

9 years agogrub-core/lib/syslinux_parse.c: do not free array
Andrei Borzenkov [Sun, 30 Nov 2014 15:48:42 +0000 (18:48 +0300)]
grub-core/lib/syslinux_parse.c: do not free array

say->msg is inline array in a structure and should not be freed.
CID: 73610

9 years agogrub-core/disk/lzopio.c: fix double free in error path
Andrei Borzenkov [Fri, 28 Nov 2014 19:37:00 +0000 (22:37 +0300)]
grub-core/disk/lzopio.c: fix double free in error path

CID: 73665

9 years agoFix ChangeLog
Andrei Borzenkov [Fri, 28 Nov 2014 19:35:01 +0000 (22:35 +0300)]
Fix ChangeLog

9 years agogrub-core/disk/geli.c: fix memory leaks in error paths
Andrei Borzenkov [Fri, 28 Nov 2014 19:23:30 +0000 (22:23 +0300)]
grub-core/disk/geli.c: fix memory leaks in error paths

CID: 73813, 73710

9 years agoUse ssize_t for grub_util_fd_read result
Andrei Borzenkov [Fri, 28 Nov 2014 18:43:07 +0000 (21:43 +0300)]
Use ssize_t for grub_util_fd_read result

Fixes commit 0415dbe28f3dc3520b70745b3bd78073f094fb4d.

9 years agogrub-core/disk/luks.c: fix use after free and memory leaks
Andrei Borzenkov [Fri, 28 Nov 2014 18:12:00 +0000 (21:12 +0300)]
grub-core/disk/luks.c: fix use after free and memory leaks

configure_ciphers:

- several memory leaks where allocated ciphers were not freed. CID: 73813,
73710

- use after free. It is probably quite innocent as grub is single threaded,
but could potentially be a problem with memory allocator debugger turned on.
CID: 73730

luks_recover_key:

- memory leak. CID: 73854

9 years agogrub-install-common: avoid out of bound access when read failed
Andrei Borzenkov [Fri, 28 Nov 2014 17:45:27 +0000 (20:45 +0300)]
grub-install-common: avoid out of bound access when read failed

Check that modinfo.sh could be read successfully; abort on error. Avoids
potential out-of-bound array access.

CID: 73819

9 years agogrub-mkstandalone: out of bound access to tar header magic
Andrei Borzenkov [Fri, 28 Nov 2014 17:39:22 +0000 (20:39 +0300)]
grub-mkstandalone: out of bound access to tar header magic

Magic size is 6 bytes and we copied 7 bytes in it.

CID: 73587, 73888
Closes bug 43690

9 years agosend router solicitation for ipv6 address autoconf v2
Michael Chang [Tue, 18 Nov 2014 08:03:08 +0000 (16:03 +0800)]
send router solicitation for ipv6 address autoconf v2

Many routers have long router advertisment interval configured by
default. The Neighbor Discovery protocol (RFC4861) has defined default
MaxRtrAdvInterval value as 600 seconds and
MinRtrAdvInterval as 0.33*MaxRtrAdvInterval. This makes
net_ipv6_autoconf fails more often than not as currently it passively
listens the RA message to perfom address autoconfiguration.

This patch tries to send router solicitation to overcome the problem of
long RA interval.

v2:
use cpu_to_be macro for network byte order conversion
add missing error handling

9 years agogrub-fs-tester: consistently print output of grub ls if test fails
Andrei Borzenkov [Thu, 20 Nov 2014 17:56:51 +0000 (20:56 +0300)]
grub-fs-tester: consistently print output of grub ls if test fails

9 years agoFix date in last ChangeLog entry
Andrei Borzenkov [Thu, 20 Nov 2014 17:54:49 +0000 (20:54 +0300)]
Fix date in last ChangeLog entry

9 years agoefi: check *path non-null before grub_strrchr
Leif Lindholm [Mon, 17 Nov 2014 14:11:01 +0000 (14:11 +0000)]
efi: check *path non-null before grub_strrchr

The EFI version of grub_machine_get_bootlocation crops the boot image
name back to the last / in order to get a directory path. However, it
does not check that *name is actually set before calling grub_strrchr
to do this, and neither does grub_strrchr before dereferencing a NULL
pointer.

Parent function, grub_set_prefix_and_root, does check the pointer
before using.

9 years agoicmp6 fix no respond to neighbor solicit message
Michael Chang [Mon, 3 Nov 2014 08:27:45 +0000 (16:27 +0800)]
icmp6 fix no respond to neighbor solicit message

The structure size used in grub_netbuff_pull to get the pointer to
option header is apparently wrong, which leads to subsequent range check
failed and therefore not responding to any neighbor solicit message in my
testing.

9 years agoUse full initializer for initrd_ctx to avoid fatal warnings with older GCC
Andrei Borzenkov [Tue, 14 Oct 2014 16:12:15 +0000 (20:12 +0400)]
Use full initializer for initrd_ctx to avoid fatal warnings with older GCC

struct ... foo = { 0, } is valid initializer, but older GCC emits
warning which is fatal error due to -Werror=missing-field-initializer.
So simply use full initializer to avoid these errors. This was fixed
probably in GCC 4.7.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36750

10 years agoFix in-tree --platform=none
Colin Watson [Thu, 25 Sep 2014 19:59:26 +0000 (20:59 +0100)]
Fix in-tree --platform=none

* configure.ac: Only remove include/grub/cpu and
include/grub/machine in the --platform=none case, not all of
include/grub.

10 years agoAdd a new "none" platform that only builds utilities
Colin Watson [Tue, 23 Sep 2014 11:06:30 +0000 (12:06 +0100)]
Add a new "none" platform that only builds utilities

This makes it possible to build generally-useful utilities such as
grub-mount even if the rest of GRUB has not been ported to the target
CPU.

* configure.ac: Add "none" platform.  Default to it for unsupported
CPUs rather than stopping with a fatal error.  Don't downgrade
x86_64-none to i386.  Define COND_real_platform Automake conditional
if the platform is anything other than "none".  Don't do any include
directory linking for "none".
* Makefile.am: Skip building grub-core and all bootcheck targets if
!COND_real_platform.
* include/grub/time.h: Don't include <grub/cpu/time.h> if GRUB_UTIL
is defined.

10 years agocleanup: grub_cpu_to_XXX_compile_time for constants
Andrey Borzenkov [Mon, 22 Sep 2014 16:47:10 +0000 (20:47 +0400)]
cleanup: grub_cpu_to_XXX_compile_time for constants

This tries to catch all cases where grub_cpu_to_XXX was used for constant
expressions (including sizeof).

10 years agoRevert " Use -Wl,--no-relax rather than -mno-relax for uniformity."
Vladimir Serbinenko [Sun, 21 Sep 2014 17:02:11 +0000 (19:02 +0200)]
Revert " Use -Wl,--no-relax rather than -mno-relax for uniformity."

This reverts commit 063f2a04d158ec1b275a925dfbae74b124708cde.

10 years agoACPIhalt: Add more ACPI opcodes.
Valentin Dornauer [Sun, 21 Sep 2014 16:58:14 +0000 (18:58 +0200)]
ACPIhalt: Add more ACPI opcodes.

The AML parser implements only a small subset of possible AML
opcodes. On the Fujitsu Lifebook E744 this and another bug in
the parser (incorrect handling of TermArg data types) would lead
to the laptop not turning off (_S5 not found).

* grub-core/commands/acpihalt.c: Support OpAlias in the AML parser;
in skip_ext_op(), handle some Type2Opcodes more correctly (TermArgs
aren't always simply strings!); Add function to skip TermArgs
* include/grub/acpi.h: Add new opcodes

10 years ago * grub-core/normal/main.c: Don't drop to rescue console in
Vladimir Serbinenko [Sun, 21 Sep 2014 16:51:09 +0000 (18:51 +0200)]
* grub-core/normal/main.c: Don't drop to rescue console in
case of password-protected prompt and no menu entries.

10 years ago * grub-core/commands/keylayouts.c: Ignore unknown keys.
Vladimir Serbinenko [Sun, 21 Sep 2014 16:49:49 +0000 (18:49 +0200)]
* grub-core/commands/keylayouts.c: Ignore unknown keys.

10 years ago * grub-core/gmodule.pl.in: Accept newer binutils which output
Vladimir Serbinenko [Sun, 21 Sep 2014 16:23:23 +0000 (18:23 +0200)]
* grub-core/gmodule.pl.in: Accept newer binutils which output
empty column rather than 0x0.

10 years agoFix wrong commit
Vladimir Serbinenko [Sun, 21 Sep 2014 16:18:03 +0000 (18:18 +0200)]
Fix wrong commit

10 years ago * grub-core/osdep/unix/config.c: Remove extraneous comma.
Michael Chang [Sun, 21 Sep 2014 15:49:13 +0000 (17:49 +0200)]
* grub-core/osdep/unix/config.c: Remove extraneous comma.

10 years agoInitialized initrd_ctx so we don't free a random pointer from the stack.
Peter Jones [Wed, 17 Sep 2014 20:30:11 +0000 (16:30 -0400)]
Initialized initrd_ctx so we don't free a random pointer from the stack.

Currently, if "linux" fails, the "goto fail;" in grub_cmd_initrd sends us
into grub_initrd_close() without grub_initrd_init() being called, and thus
it never clears initrd_ctx->components.  grub_initrd_close() then frees that
address, which is stale data from the stack.  If the stack happens to have a
stale *address* there that matches a recent allocation, then you'll get a
double free later.

So initialize the memory up front.

Signed-off-by: Peter Jones <pjones@redhat.com>
10 years agoTidy up ChangeLog formatting.
Colin Watson [Fri, 19 Sep 2014 13:50:51 +0000 (14:50 +0100)]
Tidy up ChangeLog formatting.

10 years agoFix build with glibc 2.20
Khem Raj [Wed, 3 Sep 2014 08:15:08 +0000 (01:15 -0700)]
Fix build with glibc 2.20

* grub-core/kern/emu/hostfs.c: squahes below warning
  warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Upstream-Status: Submitted

10 years agoFix incorrect address reference in btrfs
Michael Chang [Thu, 14 Aug 2014 10:17:45 +0000 (18:17 +0800)]
Fix incorrect address reference in btrfs

We encountered a weird random kernel initrd unpacking error on btrfs
and finally found it was caused by incorrect address reference in range
check for type GRUB_BTRFS_EXTENT_REGULAR and the entire result is
unpredictable.

This is a quick fix to make the address reference to the
grub_btrfs_extent_data structure correctly, not the pointer variable
to it.

Any suggestions to this patch is welcome.

10 years agoSupport grub-emu on x32 (ILP32 but with x86-64 instruction set)
Colin Watson [Sun, 7 Sep 2014 22:04:35 +0000 (23:04 +0100)]
Support grub-emu on x32 (ILP32 but with x86-64 instruction set)

* configure.ac: Remove -m64 from checks for -mcmodel=large and
-mno-red-zone.  These are always either unnecessary (x86_64-emu) or
already in TARGET_CFLAGS at this point, and they produce incorrect
results when building for x32.
* grub-core/kern/x86_64/dl.c (grub_arch_dl_relocate_symbols): Cast
pointers to Elf64_Xword via grub_addr_t, in order to work on x32.
* include/grub/x86_64/types.h (GRUB_TARGET_SIZEOF_VOID_P,
GRUB_TARGET_SIZEOF_LONG): Define to 4 on x32.

10 years ago* configure.ac: Remove several unnecessary semicolons.
Colin Watson [Sun, 7 Sep 2014 19:47:43 +0000 (20:47 +0100)]
* configure.ac: Remove several unnecessary semicolons.

10 years ago* grub-core/kern/mips/arc/init.c (grub_machine_get_bootlocation):
Colin Watson [Mon, 25 Aug 2014 22:19:48 +0000 (15:19 -0700)]
* grub-core/kern/mips/arc/init.c (grub_machine_get_bootlocation):
Initialise pend to pacify GCC.