Commit graph

3763 commits

Author SHA1 Message Date
Pali Rohár
682b3134b6 * grub-core/fs/udf.c: Add support for UUID
Use same algorithm as in libblkid from util-linux v2.30.

1. Take first 16 bytes from UTF-8 encoded string of VolumeSetIdentifier
2. If all bytes are hexadecimal digits, convert to lowercase and use as UUID
3. If first 8 bytes are not all hexadecimal digits, convert those 8 bytes
   to their hexadecimal representation, resulting in 16 bytes for UUID
4. Otherwise, compose UUID from two parts:
   1. part: converted first 8 bytes (which are hexadecimal digits) to lowercase
   2. part: encoded following 4 bytes to their hexadecimal representation (16 bytes)

So UUID would always have 16 hexadecimal digits in lowercase variant.

According to UDF specification, first 16 Unicode characters of
VolumeSetIdentifier should be unique value and first 8 should be
hexadecimal characters.

In most cases all 16 characters are hexadecimal, but e.g. MS Windows
format.exe set only first 8 as hexadecimal and remaining as fixed
(non-unique) which violates specification.
2020-09-21 11:32:45 -04:00
Pali Rohár
ab444c54a7 udf: Fix reading label, lvd.ident is dstring
UDF dstring has stored length in the last byte of buffer. Therefore last
byte is not part of recorded characters. And empty string in dstring is
encoded as empty buffer, including first byte (compression id).
2020-09-21 11:32:45 -04:00
Pete Batard
e2296e205e zfs: remove size_t typedef and use grub_size_t instead
* Prevents some toolchains from issuing a warning on size_t redef.
2020-09-21 11:32:45 -04:00
Rob Clark
a74336596f Fix a segfault in lsefi
when protocols_per_handle returns error, we can't use the pointers we
passed to it, and that includes trusting num_protocols.

Signed-off-by: Peter Jones <pjones@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
21b3d3efee fdt: silence clang warning. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
0c4852ea0e arm-efi: Fix compilation 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
8efa8a0e94 ehci: Fix compilation on i386 2020-09-21 11:32:45 -04:00
phcoder
8d54a08733 ehci: Fix compilation for amd64 2020-09-21 11:32:45 -04:00
Eric Biggers
4aaa6b639d Allow GRUB to mount ext2/3/4 filesystems that have the encryption feature.
On such a filesystem, inodes may have EXT4_ENCRYPT_FLAG set.
For a regular file, this means its contents are encrypted; for a
directory, this means the filenames in its directory entries are
encrypted; and for a symlink, this means its target is encrypted.  Since
GRUB cannot decrypt encrypted contents or filenames, just issue an error
if it would need to do so.  This is sufficient to allow unencrypted boot
files to co-exist with encrypted files elsewhere on the filesystem.

(Note that encrypted regular files and symlinks will not normally be
encountered outside an encrypted directory; however, it's possible via
hard links, so they still need to be handled.)

Tested by booting from an ext4 /boot partition on which I had run
'tune2fs -O encrypt'.  I also verified that the expected error messages
are printed when trying to access encrypted directories, files, and
symlinks from the GRUB command line.  Also ran 'sudo ./grub-fs-tester
ext4_encrypt'; note that this requires e2fsprogs v1.43+ and Linux v4.1+.

Signed-off-by: Eric Biggers <ebiggers@google.com>
2020-09-21 11:32:45 -04:00
Eric Snowberg
da4e8334b2 sparc64: Don't use devspec to determine the OBP path
Don't use devspec to determine the OBP path on SPARC hardware.  Within all
versions of Linux on SPARC, the devspec returns one of three values:
"none", "vnet-port", or "vdisk".  Unlike on PPC, none of these values
are useful in determining the OBP path.

Before this patch grub-ofpathname always returned the wrong value
for a virtual disk. For example:

% grub-ofpathname /dev/vdiskc2
vdisk/disk@2:b

After this patch it now returns the correct value:

% grub-ofpathname /dev/vdiskc2
/virtual-devices@100/channel-devices@200/disk@2:b

Orabug: 24459765

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-09-21 11:32:45 -04:00
Fu Wei
3418e2bd52 arm64: Add "--nounzip" option support in xen_module command
This patch adds "--nounzip" option support in order to
be compatible with the module command of multiboot on other architecture,
by this way we can simplify grub-mkconfig support code.

This patch also allow us to use zip compressed module(like Linux kernel
for Dom0).

Signed-off-by: Fu Wei <fu.wei@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-09-21 11:32:45 -04:00
Julien Grall
bf4d71848f arm64/xen_boot: Fix Xen boot using GRUB2 on AARCH64
Xen is currently crashing because of malformed compatible property for
the boot module. This is because the property string is not
null-terminated as requested by the ePAR spec.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Tested-by: Fu Wei <fu.wei@linaro.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-09-21 11:32:45 -04:00
Eric Snowberg
53d00ac6ef sparc64: Close cdboot ihandle
The ihandle is left open with a cd-core image.  This will cause a delay
booting grub from a virtual cdrom in a LDOM.  It will also cause problems
as Linux boots, since it expects the ihandle to be closed during init.

Orabug: 25911275

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
6ff34a6a81 at_keyboard: Fix falco chromebook case.
EC is slow, so we need few delays for it to toggle the bits correctly.

Command to enable clock and keyboard were not sent.
2020-09-21 11:32:45 -04:00
Julius Werner
4ffbbeca95 coreboot: Changed cbmemc to support updated console format from coreboot. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
4ff15188e3 Missing parts of previous commit 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
366dee1f7f arm_coreboot: Add Chromebook keyboard driver. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
aad5863e98 rk3288_spi: Add SPI driver 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
eaa55f4a23 fdtbus: Add ability to send/receive messages on parent busses. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
212c93aa36 Fix bug on FDT nodes with compatible property 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
25a88d14dd arm_coreboot: Support EHCI. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
56c0a46068 ehci: Split core code from PCI part.
On ARM often EHCI is present without PCI and just declared in device
tree. So splitcore from PCI part.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
d4529d5d02 arm_coreboot: Support DMA.
This is needed to support USB and some other busses.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
5e1a343a37 arm_coreboot: Support loading linux images. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
f66206989f arm_coreboot: Support keyboard for vexpress. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
7948b1a398 at_keyboard: Split protocol from controller code.
On vexpress controller is different but protocol is the same, so reuse the
code.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
ed5c6e9385 arm-coreboot: Export FDT routines.
We need to use them from modules as well.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
7b6c1ca1ac arm-coreboot: Support for vexpress timer. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
1895c3806b Add support for device-tree-based drivers. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
aa7585d04b arm-coreboot: Start new port. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
2f061fac71 Rename uboot/datetime to dummy/datetime.
It's just a stub and is not UBoot-specific.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
ff7416a848 Rename uboot/halt.c to dummy/halt.c.
It's not U-Boot specific and it's a stub.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
9ec5094213 coreboot: Split parts that are platform-independent.
We currently assume that coreboot is always i386, it's no longer the case,
so split i386-coreboot parts from generic coreboot code.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
25cd7a7df9 Refactor arm-uboot code to make it genereic.
arm-coreboot startup code can be very similar to arm-uboot but current code has
U-Boot specific references. So split U-Boot part from generic part.
2020-09-21 11:32:45 -04:00
Paulo Flabiano Smorigo
5696d56d33 Add Virtual LAN support.
This patch adds support for virtual LAN (VLAN) tagging. VLAN tagging allows
multiple VLANs in a bridged network to share the same physical network link
but maintain isolation:

http://en.wikipedia.org/wiki/IEEE_802.1Q

* grub-core/net/ethernet.c: Add check, get, and set vlan tag id.
* grub-core/net/drivers/ieee1275/ofnet.c: Get vlan tag id from bootargs.
* grub-core/net/arp.c: Add check.
* grub-core/net/ip.c: Likewise.
* include/grub/net/arp.h: Add vlantag attribute.
* include/grub/net/ip.h: Likewise.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
99ab28563b strtoull: Fix behaviour on chars between '9' and 'a'.
Reported by: Aaron Miller <aaronmiller@fb.com>
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
61f4f2d4ef Add strtoull test. 2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
a567ab3d9e Fix shebang for termux.
Termux doesn't have a /bin/sh. So we needto use $SHELL.
Keep /bin/sh as much as possible.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
01415074da Use $(SHELL) rather than /bin/sh.
/bin/sh doesn't exist under termux.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
4152833f0c Support lseek64.
Android doesn't have 64-bit off_t, so use off64_t instead.
2020-09-21 11:32:45 -04:00
Vladimir Serbinenko
d3bccdbd12 Bump version to 2.03 2020-09-21 11:19:14 -04:00
H.J. Lu
1c4dc293df x86-64: Treat R_X86_64_PLT32 as R_X86_64_PC32
Starting from binutils commit bd7ab16b4537788ad53521c45469a1bdae84ad4a:

https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=bd7ab16b4537788ad53521c45469a1bdae84ad4a

x86-64 assembler generates R_X86_64_PLT32, instead of R_X86_64_PC32, for
32-bit PC-relative branches.  Grub2 should treat R_X86_64_PLT32 as
R_X86_64_PC32.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
(cherry picked from commit 842c390469)
2019-10-24 16:59:37 +02:00
Michael Chang
721b4677ab Fix packed-not-aligned error on GCC 8
When building with GCC 8, there are several errors regarding packed-not-aligned.

./include/grub/gpt_partition.h:79:1: error: alignment 1 of ‘struct grub_gpt_partentry’ is less than 8 [-Werror=packed-not-aligned]

This patch fixes the build error by cleaning up the ambiguity of placing
aligned structure in a packed one. In "struct grub_btrfs_time" and "struct
grub_gpt_part_type", the aligned attribute seems to be superfluous, and also
has to be packed, to ensure the structure is bit-to-bit mapped to the format
laid on disk. I think we could blame to copy and paste error here for the
mistake. In "struct efi_variable", we have to use grub_efi_packed_guid_t, as
the name suggests. :)

Signed-off-by: Michael Chang <mchang@suse.com>
Tested-by: Michael Chang <mchang@suse.com>
Tested-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
(cherry picked from commit 563b1da6e6)
2019-10-24 16:59:37 +02:00
Luca Bruno
750c71975e loader/i386: fix out of bound memory copy on non-UEFI linux
Ref: https://bugzilla.opensuse.org/show_bug.cgi?id=1029187
Ref: https://build.opensuse.org/package/rdiff/openSUSE:Factory/grub2?linkrev=base&rev=159
2019-10-24 16:59:37 +02:00
David Michael
d3fd939f18
Merge pull request #48 from arm64b/build-issue-fixing
TPM: build issue fixing
2017-11-08 21:59:01 -05:00
Dennis Chen
63818e7800 Remove the deprecated 'Event' struct
'Event' struct will be not used any more, instead we use the
'TCG_PCR_EVENT', so this patch remove the older 'Event' data struct.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
2017-11-08 09:45:39 +00:00
Dennis Chen
7cf67f22fd Fix the build issue in TPM module
The original code use deprecated 'Event' data structure with the wrong
member variable names, which result in the build error. This patch
fix it by using 'TCG_PCR_EVENT'.

Signed-off-by: Dennis Chen <dennis.chen@arm.com>
2017-11-08 09:28:49 +00:00
1337ninja
1624d0ffc6 Fix use after free 2017-07-09 18:38:15 +05:30
David Michael
f89e1cf69a Merge branch 'gnu' into sync 2017-04-27 12:05:22 -07:00
Vladimir Serbinenko
e54c99aaff Increase version to 2.02. 2017-04-25 16:23:16 +02:00