Commit graph

3399 commits

Author SHA1 Message Date
Andrei Borzenkov
49426e9fd2 efinet: open Simple Network Protocol exclusively
EDK2 network stack is based on Managed Network Protocol which is layered
on top of Simple Management Protocol and does background polling. This
polling races with grub for received (and probably trasmitted) packets
which causes either serious slowdown or complete failure to load files.

Open SNP device exclusively.  This destroys all child MNP instances and
stops background polling.

Exclusive open cannot be done when enumerating cards, as it would destroy
PXE information we need to autoconfigure interface; and it cannot be done
during autoconfiguration as we need to do it for non-PXE boot as well. So
move SNP open to card ->open method and add matching ->close to clean up.

Based on patch from Mark Salter <msalter@redhat.com>

Also-By: Mark Salter <msalter@redhat.com>
Closes: 41731
2015-05-07 20:37:17 +03:00
Andrei Borzenkov
c52ae40570 efinet: skip virtual IPv4 and IPv6 devices when enumerating cards
EDK2 PXE driver creates two child devices - IPv4 and IPv6 - with
bound SNP instance. This means we get three cards for every physical
adapter when enumerating. Not only is this confusing, this may result
in grub ignoring packets that come in via the "wrong" card.

Example of device hierarchy is

 Ctrl[91] PciRoot(0x0)/Pci(0x3,0x0)
   Ctrl[95] PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)
     Ctrl[B4] PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv4(0.0.0.0)
     Ctrl[BC] PciRoot(0x0)/Pci(0x3,0x0)/MAC(525400123456,0x1)/IPv6(0000:0000:0000:0000:0000:0000:0000:0000)

Skip PXE created virtual devices when enumerating cards. Make sure to
find real card when applying initial autoconfiguration during PXE boot,
this information is associated with one of child devices.
2015-05-07 20:37:17 +03:00
Andrei Borzenkov
7b386b7031 efidisk: move device path helpers in core for efinet 2015-05-07 20:37:16 +03:00
Andrei Borzenkov
16a7e723ea convert to, not from, CPU byte order in DNS receive function 2015-05-07 20:33:28 +03:00
Andrei Borzenkov
a8c473288d loader/linux: do not pad initrd with zeroes at the end
Syslinux memdisk is using initrd image and needs to know uncompressed
size in advance. For gzip uncompressed size is at the end of compressed
stream. Grub padded each input file to 4 bytes at the end, which means
syslinux got wrong size.

Linux initramfs loader apparently does not care about trailing alignment.
So change code to align beginning of each file instead which atomatically
gives us the correct size for single file.

Reported-By: David Shaw <dshaw@jabberwocky.com>
2015-05-07 20:24:24 +03:00
Daniel Kiper
71783dc978 i386/relocator: Remove unused extern grub_relocator64_rip_addr
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
2015-05-07 18:00:47 +02:00
Vladimir Serbinenko
e5b4ba8c2b linux.c: Ensure that initrd is page-aligned. 2015-05-07 16:23:39 +02:00
Vladimir Serbinenko
9f731abc7f Revert parts accidentally committed 2 commits ago. 2015-05-07 16:21:34 +02:00
Fu Wei
f8451af825 arm64: Export useful functions from linux.c
Signed-off-by: Fu Wei <fu.wei@linaro.org>
2015-05-07 15:11:04 +02:00
Andrei Borzenkov
cc699535e5 Revert "efinet: memory leak on module removal"
This reverts commits 47b2bee3ef
and 8d3c4544ff. It is not safe
to free allocated cards, dangling pointers main remain. Such
cleanup requires more changes in net core.
2015-05-04 09:17:59 +03:00
Andrei Borzenkov
47b2bee3ef efinet: cannot free const char * pointer 2015-05-04 08:39:29 +03:00
Andrei Borzenkov
8d3c4544ff efinet: memory leak on module removal 2015-05-04 08:08:57 +03:00
Andrei Borzenkov
6210b8e8f7 zfs: add missing NULL check and fix incorrect buffer overwrite
grub_memset should zero out padding after data end. It is not clear
why it is needed at all - ZFS block is at least 512 bytes and power
of two, so it is always multiple of 16 bytes. This grub_memset
apparently never did anything.
2015-05-03 18:57:32 +03:00
Toomas Soome
4a7ea4003b zfs: com.delphix:embedded_data feature support 2015-05-03 18:45:40 +03:00
Toomas Soome
a1007c6af2 zfs: com.delphix:hole_birth feature support
In the past birth was always zero for holes. This feature started
to make use of birth for holes as well, so change code to test for
valid DVA address instead.
2015-05-03 18:11:29 +03:00
Toomas Soome
677dcaa92b getroot: include sys/mkdev.h for makedev
Solaris (like) systems need to include sys/mkdev.h for makedev() function.
2015-04-13 19:52:28 +03:00
Toomas Soome
5b5d8666a7 core/partmap: rename 'sun' to avoid clash with predefined symbol
the symbol “sun” is defined macro in solaris derived systems, from
gcc -dM -E:

and therefore can not be used as name.
2015-04-13 19:49:15 +03:00
Andrei Borzenkov
f11db3c7fc core: avoid NULL derefrence in grub_divmod64s
It can be called with NULL for third argument.  grub_divmod32* for
now are called only from within wrappers, so skip check.

Reported-By: Michael Zimmermann <sigmaepsilon92@gmail.com>
2015-04-06 19:30:51 +03:00
Sarah Newman
7d39938474 grub-core/loader/i386/xen.c: Initialized initrd_ctx so we don't free a random pointer from the stack.
Signed-off-by: Sarah Newman <srn@prgmr.com>
2015-03-28 07:14:17 +03:00
Andrei Borzenkov
ebd92af8c3 net: trivial grub_cpu_to_XX_compile_time cleanup 2015-03-27 18:58:57 +03:00
Lunar
c9ee9bedef syslinux: Support {vesa,}menu.c32. 2015-03-27 15:15:13 +01:00
Steve McIntyre
1a33de8b56 Recognize EFI platform even in case of mismatch between Linux and EFI.
Some x86 systems might be capable of running a 64-bit Linux kernel but
only use a 32-bit EFI (e.g. Intel Bay Trail systems). It's useful for
grub-install to be able to recognise such systems, to set the default
x86 platform correctly.

To allow grub-install to know the size of the firmware rather than
just the size of the kernel, there is now an extra EFI sysfs file to
describe the underlying firmware. Read that if possible, otherwise
fall back to the kernel type as before.

Signed-off-by: Steve McIntyre <steve@einval.com>
2015-03-27 14:51:51 +01:00
Michael Zimmermann
ed07b7e128 Add missing initializers to silence suprious warnings. 2015-03-27 14:44:41 +01:00
Leif Lindholm
d47e8ab4b9 dl_helper: Cleanup
Use the new thumb_get_instruction_word/thumb_set_instruction_word
helpers throughout.

Style cleanup (missing spaces).

Move Thumb MOVW/MOVT handlers into Thumb relocation section of file.
2015-03-27 14:37:16 +01:00
Martin Wilck
cf2b4a36c4 efinet: Check for immediate completition.
This both speeds GRUB up and workarounds unexpected EFI behaviour.
2015-03-27 14:27:56 +01:00
Vladimir Serbinenko
c14f8a9366 modinfo.sh.in: Add missing config variables. 2015-03-27 12:18:25 +01:00
Vladimir Serbinenko
94222b72b5 Makefile.core.def: Remove obsolete LDADD_KERNEL 2015-03-27 12:18:25 +01:00
Vladimir Serbinenko
63034d3261 arp, icmp: Fix handling in case of oversized or invalid packets.
This restrict ARP handling to MAC and IP addresses but in practice we need
only this case anyway and other cases are very rar if exist at all. It makes
code much simpler and less error-prone.
2015-03-27 12:18:25 +01:00
Colin Watson
5974d4ba65 hostfs: Drop unnecessary feature test macros
_BSD_SOURCE was added to allow the use of DT_DIR, but that was removed
in e768b77068.  While adding
_DEFAULT_SOURCE as well works around problems with current glibc,
neither is in fact needed nowadays.
2015-03-23 14:32:30 +00:00
Vladimir Serbinenko
fe6695b7d6 emunet: Fix init error checking.
Otherwise emunet doesn't expose any cards.
2015-03-20 12:59:00 +01:00
Vladimir Serbinenko
9c07daaf91 cacheinfo: Add missing license information. 2015-03-20 11:13:58 +01:00
Andrei Borzenkov
527eeeeee6 core: add LVM RAID1 support
Closes 44534.
2015-03-19 21:30:27 +03:00
Vladimir Serbinenko
5fe21c9968 hfsplus: Fix potential access to uninited memory on invalid FS 2015-03-06 22:33:20 +01:00
Andrei Borzenkov
8842991a56 update gnulib/argp-help.c to fix garbage in grub-mknetdir --help output
argp_help attempts to translate empty string, which results in printing
meta information about translation, like in

bor@opensuse:~/build/grub> grub2-mknetdir --help
Использование: grub2-mknetdir [ПАРАМЕТР…]
Project-Id-Version: grub 2.02-pre2
Report-Msgid-Bugs-To: bug-grub@gnu.org
...

Update gnulib/argp-help.c to the current version which fixes this
(commit b9bfe78424b871f5b92e5ee9e7d21ef951a6801d).
2015-03-05 20:19:47 +03:00
Vladimir Serbinenko
dc06aa949b syslinux_parse: Fix the case of unknown localboot.
Reported by: Jordan Uggla
2015-03-04 14:19:29 +01:00
Vladimir Serbinenko
27d1a67f8a Fix canonicalize_file_name clash.
canonicalize_file_name clashed with gnulib function. Additionally
it was declared in 2 places: emu/misc.h and util/misc.h. Added
grub_ prefix and removed second declaration.
2015-03-04 01:00:19 +01:00
Vladimir Serbinenko
9d25b0da9a Remove emu libusb support.
It's disabled by default and has been broken for a long time.
As nobody is interested in fixing and maintaining it, remove it.
2015-03-03 20:59:36 +01:00
Vladimir Serbinenko
064360e667 Remove libgcc dependency.
libgcc for boot environment isn't always present and compatible.
libgcc is often absent if endianness or bit-size at boot is different
from running OS.
libgcc may use optimised opcodes that aren't available on boot time.
So instead of relying on libgcc shipped with the compiler, supply
the functions in GRUB directly.
Tests are present to ensure that those replacement functions behave the
way compiler expects them to.
2015-03-03 20:50:37 +01:00
Vladimir Serbinenko
87ec3b7fa9 Don't continue to query block-size if disk doesn't have it.
Stops poluting screen with a lot of "block-size: exception -21".
2015-03-03 20:50:37 +01:00
Vladimir Serbinenko
66b0e6649b emu/cache: Change declaration of __clear_cache to match builtin declaration.
Fixes compile of arm64-emu.
2015-02-26 22:20:59 +01:00
Vladimir Serbinenko
38b7a30269 arm/dl: Fix handling of nonstandard relocation sizes 2015-02-26 22:10:29 +01:00
Vladimir Serbinenko
7ba066419a gzio: Optimize by removing division. 2015-02-26 22:10:09 +01:00
Vladimir Serbinenko
67a6a9512a raid6: Optimize by removing division. 2015-02-26 22:07:22 +01:00
Vladimir Serbinenko
f76c98b79e dmraid_nvidia: Fix division by 0 and missing byte-swap. 2015-02-26 22:06:19 +01:00
Vladimir Serbinenko
94f701a826 crypto: restrict cipher block size to power of 2.
All current ciphers have blocks which are power of 2 and it's
unlikely to change. Other block length would be tricky to handle anyway.
This restriction allows avoiding extra divisions.
2015-02-26 22:04:40 +01:00
Vladimir Serbinenko
7213c1e028 jpeg: Optimise by replacing division with shifts. 2015-02-26 21:27:32 +01:00
Vladimir Serbinenko
18125877ee png: Optimize by avoiding divisions. 2015-02-26 18:27:43 +01:00
Vladimir Serbinenko
80310ad07d Add missing lib/division.c 2015-02-26 18:22:40 +01:00
Vladimir Serbinenko
f51218bc15 fbblit: Optimize by replacing division with additions and shifts. 2015-02-26 18:14:28 +01:00
Vladimir Serbinenko
dd4889f727 bitmap_scale: Optimize by moving division out of the loop. 2015-02-26 18:13:36 +01:00
Vladimir Serbinenko
6a4ecd276e mips: Fix soft-float handling.
Add -msoft-float alongside clang arguments to specify ABI.
Specify ABI in asm files explicitly.
This trigers asm warning due to gcc failing to propagate -msoft-float
but it's tolerable.
2015-02-23 22:33:28 +01:00
Vladimir Serbinenko
7ea452a142 Add missing grub_ prefix in memcpy invocation 2015-02-23 22:29:33 +01:00
Vladimir Serbinenko
f034fab620 Supply signed division to fix ARM compilation.
Previously we supplied only unsigned divisions on platforms that need software
division.
Yet compiler may itself use a signed division. A typical example would be a
difference between 2 pointers which involves division by object size.
2015-02-23 04:12:04 +01:00
Vladimir Serbinenko
e1d4520bfb acpi: Fix unused function warning. 2015-02-22 14:42:43 +01:00
Vladimir Serbinenko
50ebc8f5f3 i386/tsc: Fix unused function warning on xen. 2015-02-22 13:12:44 +01:00
Vladimir Serbinenko
da9f30b455 mips: Switch to more portable .org
Binary is unchanged.
2015-02-21 20:43:57 +01:00
Vladimir Serbinenko
49e5fcb9fb sparc64: Switch to more portable .org.
Binaries are unchanged.
2015-02-21 20:32:03 +01:00
Vladimir Serbinenko
e77dc3d9a0 kernel-8086: Switch to more portable .org. 2015-02-21 20:24:59 +01:00
Vladimir Serbinenko
3c6043245e qemu: Switch to more portable .org
Binary is checked identical.
2015-02-21 20:13:58 +01:00
Vladimir Serbinenko
8afd8f3b64 qemu: Fix GateA20 enabling.
GateA20 code was inactive due to address error.
2015-02-21 20:00:18 +01:00
Vladimir Serbinenko
e62ca2a870 qemu: Fix compilation 2015-02-21 19:55:53 +01:00
Vladimir Serbinenko
44ff462e83 Remove realmode.S from coreboot and qemu.
It's not used there.
2015-02-21 19:53:18 +01:00
Vladimir Serbinenko
6505b241fd Remove obsolete ADDR32 and DATA32 checks. 2015-02-21 17:44:41 +01:00
Vladimir Serbinenko
37353f0ae5 i386: Remove needless ADDR32 prefixes when address is known and fixed.
Shaves off 6 bytes in lzma_decompress.img.
2015-02-21 17:38:56 +01:00
Vladimir Serbinenko
1998d63688 i386-pc/boot: Explicitly mark kernel_address[_high] as local.
Otherwise apple asm might try to make accesses relocatable.
2015-02-21 17:20:10 +01:00
Vladimir Serbinenko
bc29c6d019 Change dot assignmnet to more portable .org.
Binary is unchanged (verified)
2015-02-21 17:19:01 +01:00
Vladimir Serbinenko
f571dc1af8 i386: Move from explicit ADDR32/DATA32 prefixes to instruction suffixes.
Is more portable.
Binary is unchanged (verified).
2015-02-21 17:13:23 +01:00
Vladimir Serbinenko
87a04adb65 zfs/mzap_lookup: Fix argument types 2015-02-21 16:22:01 +01:00
Vladimir Serbinenko
ec65605af4 wildcard: Mark unused argument as such. 2015-02-21 16:19:09 +01:00
Vladimir Serbinenko
967e5aa591 ofdisk: Exclude floppies from scanning.
It causes similar hang as CD on at least the qemu.
2015-02-21 16:16:48 +01:00
Vladimir Serbinenko
e5851b63e0 mips/startup_raw: Use more portable .asciz 2015-02-21 16:09:46 +01:00
Vladimir Serbinenko
aee2502cb5 Provide __aeabi_mem{cpy,set}
Fixes ARM compilation
2015-02-21 16:07:59 +01:00
Vladimir Serbinenko
2426ac36d3 div_test: Don't try to divide by zero 2015-02-21 16:05:45 +01:00
Vladimir Serbinenko
5537a586e0 ext2: Ignore INCOMPAT_MMP.
It's not really incompatible as long as driver never writes to FS.
2015-02-16 21:08:37 +01:00
Vladimir Serbinenko
e20aa39ea4 ext2: Support META_BG.
This fixes bug that system would become unbootable after ext*
online resize if no resize_inode was created at ext* format time.
2015-02-16 20:53:26 +01:00
Vladimir Serbinenko
e29af836d0 Don't remove initrd= parameter.
Based on simplified patch by Lunar.

Reported by: Lunar
2015-02-16 15:56:26 +01:00
Vladimir Serbinenko
b23635fcff syslinux_parse: Always output comments even if no entries are found. 2015-02-16 10:54:20 +01:00
Andrei Borzenkov
8f5ebb1245 diskfilter_make_raid: more memory leaks in failure path 2015-02-15 10:14:07 +03:00
Vladimir Serbinenko
2ae9457e6e disk/lvm: Use zalloc to ensure that segments are initialised to sane value.
Reported by: EmanueL Czirai.
2015-02-14 20:31:00 +01:00
Daniel Kiper
8e5bc2f4d3 multiboot2: Fix information request tag size calculation
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
2015-02-14 19:26:04 +03:00
Andrei Borzenkov
fc535b32b9 diskfilter: fix double free of lv names for mdraid
Avoid micro-optimization in grub_diskfilter_make_raid and make sure
name and fullname are independent strings. This avoids need to special
case it everywhere else.

Also fix memory leak in failure case in grub_diskfilter_make_raid.

Closes: 41582
2015-02-14 19:08:58 +03:00
Andrei Borzenkov
e27fdbd686 diskfilter: fix crash in validate_lv for mdraid arrays
Commit 750f4bacd3 put LV validation before
actual vg assignment. Make grub_diskfilter_make_raid to assign ->vg as
happens in other cases for consistency. Also clean up redundant code and add
explicit NULL lv->vg check in validate_lv.

Also fix segment validation in validate_lv; it became obvious when crash
was fixed.

Closes: 44199
2015-02-14 17:56:01 +03:00
Leif Lindholm
c0f529ea67 arm: implement additional relocations generated by gcc 4.9 at -O3
GCC 4.9 also generates R_ARM_THM_MOVW_ABS_NC and R_ARM_THM_MOVT_ABS,
as an alternative to ABS32.

Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org>
2015-02-03 22:50:08 +00:00
Andrei Borzenkov
12abe75aa0 net/pxe: fix error condition
Test return value of grub_netbuff_reserve(), buf itself cannot be
NULL here.

Found by: Coverity scan.
2015-01-30 22:39:11 +03:00
Andrei Borzenkov
b40fde29a4 net/ip: check result of grub_netbuff_push
Found by: Coverity scan.
2015-01-30 22:09:51 +03:00
Andrei Borzenkov
958167b91c test: fix previous commit - we need to return from subexpression
( ... ) was processed recursively, we need to return from it. Revert
this change.
2015-01-30 20:21:56 +03:00
Andrei Borzenkov
d29259b134 test: do not stop after first file test or closing bracket
Closes: 44115
2015-01-30 20:10:43 +03:00
Andrei Borzenkov
9883307a52 script/execute.c: fix memory leak.
Make sure to continue loop over array after failure to free
allocated strings.

Found by: Coverity scan.
2015-01-28 20:35:28 +03:00
Andrei Borzenkov
2efab86d5a syslinux_parse: fix memory leak.
Found by: Coverity scan.
2015-01-28 20:09:25 +03:00
Andrei Borzenkov
fbb4aa1c05 loader/xnu: fix memory leak.
Foound by: Coverity scan.
2015-01-27 22:12:06 +03:00
Andrei Borzenkov
edc94e4b0b fs/hfsplus: fix memory leak.
Found by: Coverity scan.
2015-01-27 21:19:28 +03:00
Andrei Borzenkov
3900726fa8 fs/zfs/zfscrypt.c: fix indentation. 2015-01-27 21:13:10 +03:00
Andrei Borzenkov
fa13e60527 fs/zfs/zfscrypt.c: fix memory leaks.
Found by: Coverity scan.
2015-01-27 21:12:19 +03:00
Andrei Borzenkov
3db4f05a10 commands/parttool: fix memory leak.
Found by: Coverity scan.
2015-01-27 20:55:25 +03:00
Andrei Borzenkov
e871994849 fs/zfs/zfs.c: fix memory leak.
Found by: Coverity scan.
2015-01-27 20:52:27 +03:00
Andrei Borzenkov
637fc62699 linux/ofpath: fix descriptor leak
Found by: Coverity scan
2015-01-27 20:29:00 +03:00
Andrei Borzenkov
7ba137f628 linux/hostdisk: use strncpy instead of strlcpy
strlcpy is not available on Linux as part of standard libraries.
It probably is not worth extra configure checks espicially as we
need to handle missing function anyway.
2015-01-27 20:00:23 +03:00
Vladimir Serbinenko
9ee5ae1fae Document intentional fallthroughs.
Found by: Coverity scan.
2015-01-27 17:17:58 +01:00
Vladimir Serbinenko
8f95eae423 linux/ofpath: Fix error handling.
Found by: Coverity Scan.
2015-01-27 16:49:49 +01:00
Vladimir Serbinenko
c2fc41990a linux/hostdisk: Limit strcpy size to buffer size.
Found by: Coverity scan.
2015-01-27 16:48:53 +01:00