lede/package/boot
Beginner 678606b603
grub2: update to 2.06-rc1 (#6855)
* grub2: update to 2.06-rc1

When building GRUB with binutils 2.35.2 or later, an error occurs due to
a section .note.gnu.property that is placed at an offset such that
objcopy needs to pad the img file with zeros. This in turn causes the
following error: "error: Decompressor is too big.".

The fix accepted by upstream patches a python script that isn't executed
at all when building GRUB with OpenWrt buildroot. There's another patch
that patches the files generated by that python script directly, but by
including it we would deviate further from upstream. Instead of doing
that, simply bump to the latest release candidate.

As one of the fixes for the CVEs causes grub to crash on some x86
hardware using legacy BIOS when compiled with -O2, filter -O2 and
-O3 out of TARGET_CFLAGS.

Fixes the following CVEs:
- CVE-2020-14372
- CVE-2020-25632
- CVE-2020-25647
- CVE-2020-27749
- CVE-2020-27779
- CVE-2021-3418
- CVE-2021-20225
- CVE-2021-20233

Runtime-tested on x86/64.

Fixes: FS#3790

Suggested-by: Dirk Neukirchen <plntyk.lede@plntyk.name>
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Acked-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>

* grub2: disable liblzma dependency

Florian Ekert reported:

"I have build a fresh master branch recently, Since your last change [1]
on grub2, I have now a new dependency on liblzma for the install package
grub2-editenv.

root@st-dev-07 /usr/lib # ldd /root/grub-editenv
       /lib/ld-musl-x86_64.so.1 (0x7f684b088000)
       liblzma.so.5 => /usr/lib/liblzma.so.5 (0x7f684b06d000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x7f684b059000)
       libc.so => /lib/ld-musl-x86_64.so.1 (0x7f684b088000)

This was not the case before your update.

root@st-dev-07 /usr/sbin # ldd /usr/sbin/grub-editenv
       /lib/ld-musl-x86_64.so.1 (0x7fd970176000)
       libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x7fd970162000)
       libc.so => /lib/ld-musl-x86_64.so.1 (0x7fd970176000)

My build complains that it cannot satisfy the runtime package dependency
for grub2-editenv.

install -d -m0755 /home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/build_dir/target-x86_64_musl/linux-x86_64/grub-pc/grub-2.06~rc1/ipkg-x86_64/grub2-editenv/usr/sbin
install -m0755 /home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/build_dir/target-x86_64_musl/linux-x86_64/grub-pc/grub-2.06~rc1/grub-editenv /home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/build_dir/target-x86_64_musl/linux-x86_64/grub-pc/grub-2.06~rc1/ipkg-x86_64/grub2-editenv/usr/sbin/
find /home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/build_dir/target-x86_64_musl/linux-x86_64/grub-pc/grub-2.06~rc1/ipkg-x86_64/grub2-editenv -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf
Package grub2-editenv is missing dependencies for the following libraries:
liblzma.so.5
make[2]: *** [Makefile:166: /home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/bin/APOS/feckert/master/master-Maggie-455-ga5edc0e8e/x86_64/targets/x86/64/packages/grub2-editenv_2.06~rc1-1_x86_64.ipk] Error 1
make[2]: Leaving directory '/home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/package/boot/grub2'
time: package/boot/grub2/pc/compile#78.64#9.79#83.88
   ERROR: package/boot/grub2 failed to build (build variant: pc).
make[1]: *** [package/Makefile:116: package/boot/grub2/compile] Error 1
make[1]: Leaving directory '/home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt'
make: *** [/home/feckert/workspace/openwrt/LDM-master-x86_64/build/openwrt/include/toplevel.mk:230: package/boot/grub2/compile] Error 2

If I add the following changes to the package all works as expected.

<snip>
-  DEPENDS:=@TARGET_x86
+  DEPENDS:=@TARGET_x86 +liblzma
  VARIANT:=pc
endef

This is a hotfix but I dont´t think this is the final solution, because lzma is provided by the package xz.
And This is maintained in the package feed [not the core]"

Dirk stated & offered his patch to disable liblzma and thus resolve the
'out of core dependency' problem:

"LZMA is used in mkimage.c
disabling it prints
Without liblzma (no support for XZ-compressed mips images) (explicitly disabled)
(see configure.ac)

liblzma is autodetected so this issue was present but hidden somehow

[unsure: grep/image generation does not use grub with that option]
OpenWrt does not use that feature currently

[!] some scripts and examples use --compression=xz or -C xz and those will break

grub has an internal xzlib for different "lzma" functionality
(ext. LIBLZMA from XZ (GRUB_COMPRESSION_XZ) vs. GRUB_COMPRESSION_LZMA)"

Hopefully fixes e74d81e and doesn't
break anything else.

Signed-off-by: Dirk Neukirchen <plntyk.lede@plntyk.name>
[include Florian's description of how problem 1st encountered]
[bump package release]
Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>

Co-authored-by: Stijn Tintel <stijn@linux-ipv6.be>
Co-authored-by: Dirk Neukirchen <plntyk.lede@plntyk.name>
2021-05-22 12:07:40 +08:00
..
arm-trusted-firmware-mvebu kernel: bump 5.4 to 5.4.75 (#5780) 2020-11-14 00:52:35 +08:00
arm-trusted-firmware-rockchip rockchip: add support for NanoPi R2S arm64 router board 2020-07-02 23:34:55 +08:00
arm-trusted-firmware-sunxi kernel: bump to 4.14.169, 4.19.101 (#2963) 2020-02-06 21:45:40 +08:00
at91bootstrap kernel: bump 5.4 to 5.4.95 (#6340) 2021-02-08 17:13:28 +08:00
fconfig kernel: bump to 4.14.169, 4.19.101 (#2963) 2020-02-06 21:45:40 +08:00
grub2 grub2: update to 2.06-rc1 (#6855) 2021-05-22 12:07:40 +08:00
imx-bootlets update source 2017-09-06 19:19:45 +08:00
kexec-tools Sync to snapshot kernel 5.4 version 2020-07-02 23:30:56 +08:00
kobs-ng update to R7.5.4 2018-01-15 18:26:41 +08:00
mt7623n-preloader kernel: bump 5.4 to 5.4.68 (#5555) 2020-10-03 00:36:16 +08:00
tfa-layerscape kernel: bump 5.4 to 5.4.75 (#5780) 2020-11-14 00:52:35 +08:00
uboot-ar71xx kernel: bump to 4.14.169, 4.19.101 (#2963) 2020-02-06 21:45:40 +08:00
uboot-at91 kernel: bump 5.4 to 5.4.95 (#6340) 2021-02-08 17:13:28 +08:00
uboot-envtools ramips: add support for JCG Q20 (#6850) 2021-05-21 13:44:01 +08:00
uboot-fritz4040 kernel: bump to 4.14.169, 4.19.101 (#2963) 2020-02-06 21:45:40 +08:00
uboot-imx6 Sync to snapshot kernel 5.4 version 2020-07-02 23:30:56 +08:00
uboot-kirkwood kernel: bump 5.4 to 5.4.85 (#6105) 2020-12-28 14:24:26 +08:00
uboot-lantiq Merge branch master of https://github.com/coolsnowwolf/lede 2019-01-03 19:29:28 +08:00
uboot-layerscape kernel: bump 5.4 to 5.4.79 and add mt7620-nand driver (#5830) 2020-11-28 16:43:16 +08:00
uboot-mediatek kernel: bump 5.4 to 5.4.75 (#5780) 2020-11-14 00:52:35 +08:00
uboot-mvebu kernel: bump 5.4 to 5.4.75 (#5780) 2020-11-14 00:52:35 +08:00
uboot-mxs Sync to snapshot kernel 5.4 version 2020-07-02 23:30:56 +08:00
uboot-omap kernel: bump 5.4 to 5.4.75 (#5780) 2020-11-14 00:52:35 +08:00
uboot-oxnas Sync to snapshot kernel 5.4 version 2020-07-02 23:30:56 +08:00
uboot-ramips Sync to snapshot kernel 5.4 version 2020-07-02 23:30:56 +08:00
uboot-rockchip fix Orangepi R1 Plus boot (#6707) 2021-04-18 10:08:57 +08:00
uboot-sunxi kernel: bump 5.4 to 5.4.75 (#5780) 2020-11-14 00:52:35 +08:00
uboot-tegra kernel: bump 5.4 to 5.4.85 (#6105) 2020-12-28 14:24:26 +08:00
uboot-zynq kernel: bump 5.4 to 5.4.83 (#6040) 2020-12-17 23:29:07 +08:00