mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-08-01 09:17:42 +00:00
commit
c152fdeba0
@ -10,6 +10,8 @@ Only a manual configuration using NetworkManager connection files is supported.
|
||||
|
||||
You can read the [NetworkManager manual][nm-manual] or find many configuration examples across the internet. Keep in mind that the system is read-only. If you don't want the IP address to change on every boot, you should modify the UUID property to a generic [UUID4][uuid]. Inside the `\CONFIG\network\` directory on the USB drive or SD card, create a file called `my-network` and add the appropriate contents below:
|
||||
|
||||
**NOTE: Please make sure to save this file with UNIX line endings (LF, and not Windows' default CRLF endings). You can do this using Notepad these days!**
|
||||
|
||||
### Default
|
||||
|
||||
A preinstalled connection profile is provided by default:
|
||||
|
@ -51,15 +51,7 @@ Log in as `root` to get to the Home Assistant CLI and then enter `login` to cont
|
||||
|
||||
Confirm your USB SSD/HD is connected and recognized using `fdisk -l`.
|
||||
|
||||
It is recommended to use fdisk to remove the existing partition(s) before proceeding.
|
||||
|
||||
- Type `fdisk /dev/XXX` (replacing XXX with your drive)
|
||||
- Type `d` to delete a partition.
|
||||
- Continue if needed, then write the changes.
|
||||
|
||||
Creating a new partition is not necessary.
|
||||
|
||||
With the drive now prepared, use the below command (again, replacing XXX with your drive)
|
||||
Make sure the drive has no partition named `hassos-data` (or no partition at all). With the drive, use the below command (again, replacing XXX with your drive)
|
||||
|
||||
```sh
|
||||
$ datactl move /dev/xxx
|
||||
|
@ -1,43 +0,0 @@
|
||||
From e2b93751cfd0722801b65b4603b588ab9df4c12b Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Tue, 21 Apr 2020 18:39:30 +0200
|
||||
Subject: [PATCH 2/8] arm64: defconfig: enable meson gx audio as module
|
||||
|
||||
Enable the module config for the Amlogic GX audio card.
|
||||
This module will imply the internal components usually associated
|
||||
with it to make a functional sound card on these platforms.
|
||||
|
||||
Also enable the simple amplifier module which often used on the
|
||||
output stage of those cards.
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
Tested-by: Christian Hewitt <christianshewitt@gmail.com>
|
||||
Link: https://lore.kernel.org/r/20200421163935.775935-2-jbrunet@baylibre.com
|
||||
---
|
||||
arch/arm64/configs/defconfig | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
|
||||
index 03d0189f7d68..ceb60ee9c340 100644
|
||||
--- a/arch/arm64/configs/defconfig
|
||||
+++ b/arch/arm64/configs/defconfig
|
||||
@@ -644,6 +644,7 @@ CONFIG_SND_HDA_CODEC_HDMI=m
|
||||
CONFIG_SND_SOC=y
|
||||
CONFIG_SND_BCM2835_SOC_I2S=m
|
||||
CONFIG_SND_MESON_AXG_SOUND_CARD=m
|
||||
+CONFIG_SND_MESON_GX_SOUND_CARD=m
|
||||
CONFIG_SND_SOC_SDM845=m
|
||||
CONFIG_SND_SOC_ROCKCHIP=m
|
||||
CONFIG_SND_SOC_ROCKCHIP_SPDIF=m
|
||||
@@ -656,6 +657,7 @@ CONFIG_SND_SOC_AK4613=m
|
||||
CONFIG_SND_SOC_ES7134=m
|
||||
CONFIG_SND_SOC_ES7241=m
|
||||
CONFIG_SND_SOC_PCM3168A_I2C=m
|
||||
+CONFIG_SND_SOC_SIMPLE_AMPLIFIER=m
|
||||
CONFIG_SND_SOC_TAS571X=m
|
||||
CONFIG_SND_SOC_WCD934X=m
|
||||
CONFIG_SND_SOC_WSA881X=m
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,10 +1,8 @@
|
||||
From 9443f2cd21a8ebd08f0fb64f5b3a8ccb6cd77d8e Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <9443f2cd21a8ebd08f0fb64f5b3a8ccb6cd77d8e.1596660075.git.stefan@agner.ch>
|
||||
In-Reply-To: <f72fc1866396fed30036e0f06007c15217e47f22.1596660075.git.stefan@agner.ch>
|
||||
References: <f72fc1866396fed30036e0f06007c15217e47f22.1596660075.git.stefan@agner.ch>
|
||||
From d35db3d5f943fea569dde8e83f15565254643385 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
|
||||
From: Christian Hewitt <christianshewitt@gmail.com>
|
||||
Date: Sun, 19 Jul 2020 14:10:32 +0000
|
||||
Subject: [PATCH 08/10] arm64: dts: meson: convert ODROID-N2 to dtsi
|
||||
Subject: [PATCH 1/4] arm64: dts: meson: convert ODROID-N2 to dtsi
|
||||
|
||||
Convert the current ODROID-N2 dts into a common dtsi in preparation
|
||||
for adding ODROID-N2+ support.
|
||||
@ -1283,5 +1281,5 @@ index 000000000000..e5bc132ce7d5
|
||||
+ phy-supply = <&hub_5v>;
|
||||
+};
|
||||
--
|
||||
2.27.0
|
||||
2.28.0
|
||||
|
@ -0,0 +1,124 @@
|
||||
From f6fce2e974fe091fd233301bd7c127ca18304039 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <f6fce2e974fe091fd233301bd7c127ca18304039.1603303549.git.stefan@agner.ch>
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Mon, 19 Oct 2020 19:07:02 +0200
|
||||
Subject: [PATCH] usb: cdc-acm: fix cooldown mechanism
|
||||
|
||||
Commit a4e7279cd1d1 ("cdc-acm: introduce a cool down") is causing
|
||||
regression if there is some USB error, such as -EPROTO.
|
||||
|
||||
This has been reported on some samples of the Odroid-N2 using the Combee II
|
||||
Zibgee USB dongle.
|
||||
|
||||
> struct acm *acm = container_of(work, struct acm, work)
|
||||
|
||||
is incorrect in case of a delayed work and causes warnings, usually from
|
||||
the workqueue:
|
||||
|
||||
> WARNING: CPU: 0 PID: 0 at kernel/workqueue.c:1474 __queue_work+0x480/0x528.
|
||||
|
||||
When this happens, USB eventually stops working completely after a while.
|
||||
Also the ACM_ERROR_DELAY bit is never set, so the cooldown mechanism
|
||||
previously introduced cannot be triggered and acm_submit_read_urb() is
|
||||
never called.
|
||||
|
||||
This changes makes the cdc-acm driver use a single delayed work, fixing the
|
||||
pointer arithmetic in acm_softint() and set the ACM_ERROR_DELAY when the
|
||||
cooldown mechanism appear to be needed.
|
||||
|
||||
Fixes: a4e7279cd1d1 ("cdc-acm: introduce a cool down")
|
||||
Reported-by: Pascal Vizeli <pascal.vizeli@nabucasa.com>
|
||||
Cc: Oliver Neukum <oneukum@suse.com>
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
drivers/usb/class/cdc-acm.c | 12 +++++-------
|
||||
drivers/usb/class/cdc-acm.h | 3 +--
|
||||
2 files changed, 6 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c
|
||||
index 7f6f3ab5b8a6..8f087499196a 100644
|
||||
--- a/drivers/usb/class/cdc-acm.c
|
||||
+++ b/drivers/usb/class/cdc-acm.c
|
||||
@@ -507,6 +507,7 @@ static void acm_read_bulk_callback(struct urb *urb)
|
||||
"%s - cooling babbling device\n", __func__);
|
||||
usb_mark_last_busy(acm->dev);
|
||||
set_bit(rb->index, &acm->urbs_in_error_delay);
|
||||
+ set_bit(ACM_ERROR_DELAY, &acm->flags);
|
||||
cooldown = true;
|
||||
break;
|
||||
default:
|
||||
@@ -532,7 +533,7 @@ static void acm_read_bulk_callback(struct urb *urb)
|
||||
|
||||
if (stopped || stalled || cooldown) {
|
||||
if (stalled)
|
||||
- schedule_work(&acm->work);
|
||||
+ schedule_delayed_work(&acm->dwork, 0);
|
||||
else if (cooldown)
|
||||
schedule_delayed_work(&acm->dwork, HZ / 2);
|
||||
return;
|
||||
@@ -562,13 +563,13 @@ static void acm_write_bulk(struct urb *urb)
|
||||
acm_write_done(acm, wb);
|
||||
spin_unlock_irqrestore(&acm->write_lock, flags);
|
||||
set_bit(EVENT_TTY_WAKEUP, &acm->flags);
|
||||
- schedule_work(&acm->work);
|
||||
+ schedule_delayed_work(&acm->dwork, 0);
|
||||
}
|
||||
|
||||
static void acm_softint(struct work_struct *work)
|
||||
{
|
||||
int i;
|
||||
- struct acm *acm = container_of(work, struct acm, work);
|
||||
+ struct acm *acm = container_of(work, struct acm, dwork.work);
|
||||
|
||||
if (test_bit(EVENT_RX_STALL, &acm->flags)) {
|
||||
smp_mb(); /* against acm_suspend() */
|
||||
@@ -584,7 +585,7 @@ static void acm_softint(struct work_struct *work)
|
||||
if (test_and_clear_bit(ACM_ERROR_DELAY, &acm->flags)) {
|
||||
for (i = 0; i < acm->rx_buflimit; i++)
|
||||
if (test_and_clear_bit(i, &acm->urbs_in_error_delay))
|
||||
- acm_submit_read_urb(acm, i, GFP_NOIO);
|
||||
+ acm_submit_read_urb(acm, i, GFP_KERNEL);
|
||||
}
|
||||
|
||||
if (test_and_clear_bit(EVENT_TTY_WAKEUP, &acm->flags))
|
||||
@@ -1352,7 +1353,6 @@ static int acm_probe(struct usb_interface *intf,
|
||||
acm->ctrlsize = ctrlsize;
|
||||
acm->readsize = readsize;
|
||||
acm->rx_buflimit = num_rx_buf;
|
||||
- INIT_WORK(&acm->work, acm_softint);
|
||||
INIT_DELAYED_WORK(&acm->dwork, acm_softint);
|
||||
init_waitqueue_head(&acm->wioctl);
|
||||
spin_lock_init(&acm->write_lock);
|
||||
@@ -1562,7 +1562,6 @@ static void acm_disconnect(struct usb_interface *intf)
|
||||
}
|
||||
|
||||
acm_kill_urbs(acm);
|
||||
- cancel_work_sync(&acm->work);
|
||||
cancel_delayed_work_sync(&acm->dwork);
|
||||
|
||||
tty_unregister_device(acm_tty_driver, acm->minor);
|
||||
@@ -1605,7 +1604,6 @@ static int acm_suspend(struct usb_interface *intf, pm_message_t message)
|
||||
return 0;
|
||||
|
||||
acm_kill_urbs(acm);
|
||||
- cancel_work_sync(&acm->work);
|
||||
cancel_delayed_work_sync(&acm->dwork);
|
||||
acm->urbs_in_error_delay = 0;
|
||||
|
||||
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h
|
||||
index cd5e9d8ab237..b95ff769072e 100644
|
||||
--- a/drivers/usb/class/cdc-acm.h
|
||||
+++ b/drivers/usb/class/cdc-acm.h
|
||||
@@ -112,8 +112,7 @@ struct acm {
|
||||
# define ACM_ERROR_DELAY 3
|
||||
unsigned long urbs_in_error_delay; /* these need to be restarted after a delay */
|
||||
struct usb_cdc_line_coding line; /* bits, stop, parity */
|
||||
- struct work_struct work; /* work queue entry for various purposes*/
|
||||
- struct delayed_work dwork; /* for cool downs needed in error recovery */
|
||||
+ struct delayed_work dwork; /* work queue entry for various purposes */
|
||||
unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */
|
||||
unsigned int ctrlout; /* output control lines (DTR, RTS) */
|
||||
struct async_icount iocount; /* counters for control line changes */
|
||||
--
|
||||
2.28.0
|
||||
|
@ -1,28 +0,0 @@
|
||||
From 821b8ac21b1675910423ee69d37cb1977b8f271e Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Mon, 30 Mar 2020 17:39:04 +0200
|
||||
Subject: [PATCH 3/8] ASoC: meson: imply acodec glue on axg sound card
|
||||
|
||||
When axg card driver support is enabled, lets enable the related
|
||||
internal DAC glue by default.
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
sound/soc/meson/Kconfig | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/sound/soc/meson/Kconfig b/sound/soc/meson/Kconfig
|
||||
index 8b6295283989..363dc3b1bbe4 100644
|
||||
--- a/sound/soc/meson/Kconfig
|
||||
+++ b/sound/soc/meson/Kconfig
|
||||
@@ -68,6 +68,7 @@ config SND_MESON_AXG_SOUND_CARD
|
||||
imply SND_MESON_AXG_SPDIFOUT
|
||||
imply SND_MESON_AXG_SPDIFIN
|
||||
imply SND_MESON_AXG_PDM
|
||||
+ imply SND_MESON_G12A_TOACODEC
|
||||
imply SND_MESON_G12A_TOHDMITX if DRM_MESON_DW_HDMI
|
||||
help
|
||||
Select Y or M to add support for the AXG SoC sound card
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,11 +1,10 @@
|
||||
From 54d8ae2ae7a10dab6998b2d4ac507aec96c6f1da Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <54d8ae2ae7a10dab6998b2d4ac507aec96c6f1da.1595882680.git.stefan@agner.ch>
|
||||
In-Reply-To: <d83d79b085486a605462fa91e3c6746e4ff0b263.1595882680.git.stefan@agner.ch>
|
||||
References: <d83d79b085486a605462fa91e3c6746e4ff0b263.1595882680.git.stefan@agner.ch>
|
||||
From 4b9d9159ed5a79ceac5b831012b3cb44cce2516c Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <4b9d9159ed5a79ceac5b831012b3cb44cce2516c.1602360581.git.stefan@agner.ch>
|
||||
In-Reply-To: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
|
||||
References: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
|
||||
From: Christian Hewitt <christianshewitt@gmail.com>
|
||||
Date: Sun, 19 Jul 2020 14:10:33 +0000
|
||||
Subject: [PATCH 09/10] dt-bindings: arm: amlogic: add support for the
|
||||
ODROID-N2+
|
||||
Subject: [PATCH 2/4] dt-bindings: arm: amlogic: add support for the ODROID-N2+
|
||||
|
||||
HardKernel ODROID-N2+ uses a revised Amlogic S922X v2 chip that supports
|
||||
higher cpu clock speeds than the original ODROID-N2.
|
||||
@ -16,17 +15,17 @@ Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/arm/amlogic.yaml b/Documentation/devicetree/bindings/arm/amlogic.yaml
|
||||
index f74aba48cec1..915ef4f355ad 100644
|
||||
index 5eba9f48823e..12ba8d074370 100644
|
||||
--- a/Documentation/devicetree/bindings/arm/amlogic.yaml
|
||||
+++ b/Documentation/devicetree/bindings/arm/amlogic.yaml
|
||||
@@ -149,6 +149,7 @@ properties:
|
||||
items:
|
||||
- enum:
|
||||
@@ -153,6 +153,7 @@ properties:
|
||||
- azw,gtking
|
||||
- azw,gtking-pro
|
||||
- hardkernel,odroid-n2
|
||||
+ - hardkernel,odroid-n2-plus
|
||||
- khadas,vim3
|
||||
- ugoos,am6
|
||||
- const: amlogic,s922x
|
||||
--
|
||||
2.27.0
|
||||
2.28.0
|
||||
|
@ -1,47 +0,0 @@
|
||||
From 60164df03c6314d8f5f3afef56b0bf97962ec9ee Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Mon, 24 Feb 2020 14:35:17 +0100
|
||||
Subject: [PATCH 4/8] ASoC: meson: gx-card: fix sound-dai dt schema
|
||||
|
||||
There is a fair amount of warnings when running 'make dtbs_check' with
|
||||
amlogic,gx-sound-card.yaml.
|
||||
|
||||
Ex:
|
||||
arch/arm64/boot/dts/amlogic/meson-gxm-q200.dt.yaml: sound: dai-link-0:sound-dai:0:1: missing phandle tag in 0
|
||||
arch/arm64/boot/dts/amlogic/meson-gxm-q200.dt.yaml: sound: dai-link-0:sound-dai:0:2: missing phandle tag in 0
|
||||
arch/arm64/boot/dts/amlogic/meson-gxm-q200.dt.yaml: sound: dai-link-0:sound-dai:0: [66, 0, 0] is too long
|
||||
|
||||
The reason is that the sound-dai phandle provided has cells, and in such
|
||||
case the schema should use 'phandle-array' instead of 'phandle'.
|
||||
|
||||
Fixes: fd00366b8e41 ("ASoC: meson: gx: add sound card dt-binding documentation")
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
.../devicetree/bindings/sound/amlogic,gx-sound-card.yaml | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
|
||||
index fb374c659be1..a48222e8cd08 100644
|
||||
--- a/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
|
||||
+++ b/Documentation/devicetree/bindings/sound/amlogic,gx-sound-card.yaml
|
||||
@@ -57,7 +57,7 @@ patternProperties:
|
||||
rate
|
||||
|
||||
sound-dai:
|
||||
- $ref: /schemas/types.yaml#/definitions/phandle
|
||||
+ $ref: /schemas/types.yaml#/definitions/phandle-array
|
||||
description: phandle of the CPU DAI
|
||||
|
||||
patternProperties:
|
||||
@@ -71,7 +71,7 @@ patternProperties:
|
||||
|
||||
properties:
|
||||
sound-dai:
|
||||
- $ref: /schemas/types.yaml#/definitions/phandle
|
||||
+ $ref: /schemas/types.yaml#/definitions/phandle-array
|
||||
description: phandle of the codec DAI
|
||||
|
||||
required:
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,10 +1,10 @@
|
||||
From 188bc924b34b7d845324eb2e0e7493a9eaeb2cb5 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <188bc924b34b7d845324eb2e0e7493a9eaeb2cb5.1595882680.git.stefan@agner.ch>
|
||||
In-Reply-To: <d83d79b085486a605462fa91e3c6746e4ff0b263.1595882680.git.stefan@agner.ch>
|
||||
References: <d83d79b085486a605462fa91e3c6746e4ff0b263.1595882680.git.stefan@agner.ch>
|
||||
From 81b5af6c3ce3e0f312be0897bec0b3c942e2ce97 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <81b5af6c3ce3e0f312be0897bec0b3c942e2ce97.1602360581.git.stefan@agner.ch>
|
||||
In-Reply-To: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
|
||||
References: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
|
||||
From: Christian Hewitt <christianshewitt@gmail.com>
|
||||
Date: Sun, 19 Jul 2020 14:10:34 +0000
|
||||
Subject: [PATCH 10/10] arm64: dts: meson: add support for the ODROID-N2+
|
||||
Subject: [PATCH 3/4] arm64: dts: meson: add support for the ODROID-N2+
|
||||
|
||||
HardKernel ODROID-N2+ uses an Amlogic S922X rev. C chip capable of higher
|
||||
clock speeds than the original ODROID-N2. Hardkernel supports the big cpu
|
||||
@ -22,10 +22,10 @@ Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||
create mode 100644 arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/Makefile b/arch/arm64/boot/dts/amlogic/Makefile
|
||||
index eef0045320f2..7524cf9680f5 100644
|
||||
index 4e2239ffcaa5..b0b3d6791499 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/Makefile
|
||||
+++ b/arch/arm64/boot/dts/amlogic/Makefile
|
||||
@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x96-max.dtb
|
||||
@@ -8,6 +8,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12b-gtking-pro.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb
|
||||
dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb
|
||||
@ -93,5 +93,5 @@ index 000000000000..4ebb448d233f
|
||||
+};
|
||||
+
|
||||
--
|
||||
2.27.0
|
||||
2.28.0
|
||||
|
@ -1,39 +0,0 @@
|
||||
From e128dd1ca079c5ee558ab100387d9f81bd4f3980 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 7 May 2020 00:16:55 +0200
|
||||
Subject: [PATCH 5/8] arm64: dts: meson: g12: add internal DAC
|
||||
|
||||
add internal audio DAC support on the g12 and sm1 SoC family
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
Link: https://lore.kernel.org/r/20200506221656.477379-7-jbrunet@baylibre.com
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
index c0aef7d69117..593a006f4b7b 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi
|
||||
@@ -250,6 +250,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ acodec: audio-controller@32000 {
|
||||
+ compatible = "amlogic,t9015";
|
||||
+ reg = <0x0 0x32000 0x0 0x14>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ sound-name-prefix = "ACODEC";
|
||||
+ clocks = <&clkc CLKID_AUDIO_CODEC>;
|
||||
+ clock-names = "pclk";
|
||||
+ resets = <&reset RESET_AUDIO_CODEC>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
periphs: bus@34400 {
|
||||
compatible = "simple-bus";
|
||||
reg = <0x0 0x34400 0x0 0x400>;
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,10 +1,10 @@
|
||||
From c33df0ebe8be16b56741ce7f873221ab9087a0a6 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <c33df0ebe8be16b56741ce7f873221ab9087a0a6.1598564789.git.stefan@agner.ch>
|
||||
In-Reply-To: <f72fc1866396fed30036e0f06007c15217e47f22.1598564789.git.stefan@agner.ch>
|
||||
References: <f72fc1866396fed30036e0f06007c15217e47f22.1598564789.git.stefan@agner.ch>
|
||||
From 6a7c42785788faa862aeb7902cb2b3b08f033ca0 Mon Sep 17 00:00:00 2001
|
||||
Message-Id: <6a7c42785788faa862aeb7902cb2b3b08f033ca0.1602360581.git.stefan@agner.ch>
|
||||
In-Reply-To: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
|
||||
References: <d35db3d5f943fea569dde8e83f15565254643385.1602360581.git.stefan@agner.ch>
|
||||
From: Stefan Agner <stefan@agner.ch>
|
||||
Date: Thu, 27 Aug 2020 23:29:57 +0200
|
||||
Subject: [PATCH 11/11] clk: meson: g12a: mark fclk_div2 as critical
|
||||
Subject: [PATCH 4/4] clk: meson: g12a: mark fclk_div2 as critical
|
||||
|
||||
On Amlogic Meson G12b platform, similar to fclk_div3, the fclk_div2
|
||||
seems to be necessary for the system to operate correctly as well.
|
||||
@ -22,7 +22,7 @@ Signed-off-by: Stefan Agner <stefan@agner.ch>
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c
|
||||
index fad616cac01e..2214b974f748 100644
|
||||
index 9803d44bb157..9a6722a1dc19 100644
|
||||
--- a/drivers/clk/meson/g12a.c
|
||||
+++ b/drivers/clk/meson/g12a.c
|
||||
@@ -298,6 +298,7 @@ static struct clk_regmap g12a_fclk_div2 = {
|
@ -1,39 +0,0 @@
|
||||
From 5ea4085da165fd3f3aa211cb3664dd166d0d5fd7 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Thu, 7 May 2020 00:16:56 +0200
|
||||
Subject: [PATCH 6/8] arm64: dts: meson: g12: add internal DAC glue
|
||||
|
||||
add the internal DAC glue support on the g12 and sm1 family
|
||||
This glue connects the different TDM interfaces of the SoC to
|
||||
the internal audio DAC codec.
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
|
||||
Link: https://lore.kernel.org/r/20200506221656.477379-8-jbrunet@baylibre.com
|
||||
---
|
||||
arch/arm64/boot/dts/amlogic/meson-g12.dtsi | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
index 55d39020ec72..0d14409f509c 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12.dtsi
|
||||
@@ -343,6 +343,15 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ toacodec: audio-controller@740 {
|
||||
+ compatible = "amlogic,g12a-toacodec";
|
||||
+ reg = <0x0 0x740 0x0 0x4>;
|
||||
+ #sound-dai-cells = <1>;
|
||||
+ sound-name-prefix = "TOACODEC";
|
||||
+ resets = <&clkc_audio AUD_RESET_TOACODEC>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
tohdmitx: audio-controller@744 {
|
||||
compatible = "amlogic,g12a-tohdmitx";
|
||||
reg = <0x0 0x744 0x0 0x4>;
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,123 +0,0 @@
|
||||
From 15b3cef2ea75c4d81cb067264be1cf49c49f81b1 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Mon, 15 Jun 2020 15:38:44 +0200
|
||||
Subject: [PATCH 7/8] arm64: dts: meson-g12b: odroid-n2: enable audio loopback
|
||||
|
||||
Add capture pcm interfaces and loopback routes to the odroid-n2
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
.../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 65 +++++++++++++++++--
|
||||
1 file changed, 61 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
index 169ea283d4ee..d4421ad164bd 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
@@ -209,11 +209,28 @@
|
||||
sound {
|
||||
compatible = "amlogic,axg-sound-card";
|
||||
model = "G12B-ODROID-N2";
|
||||
- audio-aux-devs = <&tdmout_b>;
|
||||
+ audio-aux-devs = <&tdmout_b>, <&tdmin_a>, <&tdmin_b>,
|
||||
+ <&tdmin_c>, <&tdmin_lb>;
|
||||
audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
|
||||
"TDMOUT_B IN 1", "FRDDR_B OUT 1",
|
||||
"TDMOUT_B IN 2", "FRDDR_C OUT 1",
|
||||
- "TDM_B Playback", "TDMOUT_B OUT";
|
||||
+ "TDM_B Playback", "TDMOUT_B OUT",
|
||||
+ "TDMIN_A IN 4", "TDM_B Loopback",
|
||||
+ "TDMIN_B IN 4", "TDM_B Loopback",
|
||||
+ "TDMIN_C IN 4", "TDM_B Loopback",
|
||||
+ "TDMIN_LB IN 1", "TDM_B Loopback",
|
||||
+ "TODDR_A IN 0", "TDMIN_A OUT",
|
||||
+ "TODDR_B IN 0", "TDMIN_A OUT",
|
||||
+ "TODDR_C IN 0", "TDMIN_A OUT",
|
||||
+ "TODDR_A IN 1", "TDMIN_B OUT",
|
||||
+ "TODDR_B IN 1", "TDMIN_B OUT",
|
||||
+ "TODDR_C IN 1", "TDMIN_B OUT",
|
||||
+ "TODDR_A IN 2", "TDMIN_C OUT",
|
||||
+ "TODDR_B IN 2", "TDMIN_C OUT",
|
||||
+ "TODDR_C IN 2", "TDMIN_C OUT",
|
||||
+ "TODDR_A IN 6", "TDMIN_LB OUT",
|
||||
+ "TODDR_B IN 6", "TDMIN_LB OUT",
|
||||
+ "TODDR_C IN 6", "TDMIN_LB OUT";
|
||||
|
||||
assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
<&clkc CLKID_MPLL0>,
|
||||
@@ -236,8 +253,20 @@
|
||||
sound-dai = <&frddr_c>;
|
||||
};
|
||||
|
||||
- /* 8ch hdmi interface */
|
||||
dai-link-3 {
|
||||
+ sound-dai = <&toddr_a>;
|
||||
+ };
|
||||
+
|
||||
+ dai-link-4 {
|
||||
+ sound-dai = <&toddr_b>;
|
||||
+ };
|
||||
+
|
||||
+ dai-link-5 {
|
||||
+ sound-dai = <&toddr_c>;
|
||||
+ };
|
||||
+
|
||||
+ /* 8ch hdmi interface */
|
||||
+ dai-link-6 {
|
||||
sound-dai = <&tdmif_b>;
|
||||
dai-format = "i2s";
|
||||
dai-tdm-slot-tx-mask-0 = <1 1>;
|
||||
@@ -252,7 +281,7 @@
|
||||
};
|
||||
|
||||
/* hdmi glue */
|
||||
- dai-link-4 {
|
||||
+ dai-link-7 {
|
||||
sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
|
||||
|
||||
codec {
|
||||
@@ -476,6 +505,22 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&tdmin_a {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&tdmin_b {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&tdmin_c {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&tdmin_lb {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&tdmout_b {
|
||||
status = "okay";
|
||||
};
|
||||
@@ -484,6 +529,18 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&toddr_a {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&toddr_b {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&toddr_c {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&uart_AO {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&uart_ao_a_pins>;
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,168 +0,0 @@
|
||||
From 978cc250574b7f1ab45f494cc2a094e3c9fd1fa4 Mon Sep 17 00:00:00 2001
|
||||
From: Jerome Brunet <jbrunet@baylibre.com>
|
||||
Date: Mon, 15 Jun 2020 16:34:37 +0200
|
||||
Subject: [PATCH 8/8] arm64: dts: meson: odroid-n2: add jack audio output
|
||||
support
|
||||
|
||||
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
|
||||
---
|
||||
.../boot/dts/amlogic/meson-g12b-odroid-n2.dts | 79 +++++++++++++++++--
|
||||
1 file changed, 74 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
index d4421ad164bd..34fffa6d859d 100644
|
||||
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dts
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "meson-g12b-s922x.dtsi"
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/gpio/meson-g12a-gpio.h>
|
||||
+#include <dt-bindings/sound/meson-g12a-toacodec.h>
|
||||
#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
|
||||
|
||||
/ {
|
||||
@@ -20,6 +21,14 @@
|
||||
ethernet0 = ðmac;
|
||||
};
|
||||
|
||||
+ dioo2133: audio-amplifier-0 {
|
||||
+ compatible = "simple-audio-amplifier";
|
||||
+ enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
|
||||
+ VCC-supply = <&vcc_5v>;
|
||||
+ sound-name-prefix = "U19";
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+
|
||||
chosen {
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
@@ -209,16 +218,26 @@
|
||||
sound {
|
||||
compatible = "amlogic,axg-sound-card";
|
||||
model = "G12B-ODROID-N2";
|
||||
- audio-aux-devs = <&tdmout_b>, <&tdmin_a>, <&tdmin_b>,
|
||||
- <&tdmin_c>, <&tdmin_lb>;
|
||||
+ audio-widgets = "Line", "Lineout";
|
||||
+ audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&tdmin_a>,
|
||||
+ <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>,
|
||||
+ <&dioo2133>;
|
||||
audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
|
||||
"TDMOUT_B IN 1", "FRDDR_B OUT 1",
|
||||
"TDMOUT_B IN 2", "FRDDR_C OUT 1",
|
||||
"TDM_B Playback", "TDMOUT_B OUT",
|
||||
+ "TDMOUT_C IN 0", "FRDDR_A OUT 2",
|
||||
+ "TDMOUT_C IN 1", "FRDDR_B OUT 2",
|
||||
+ "TDMOUT_C IN 2", "FRDDR_C OUT 2",
|
||||
+ "TDM_C Playback", "TDMOUT_C OUT",
|
||||
"TDMIN_A IN 4", "TDM_B Loopback",
|
||||
"TDMIN_B IN 4", "TDM_B Loopback",
|
||||
"TDMIN_C IN 4", "TDM_B Loopback",
|
||||
"TDMIN_LB IN 1", "TDM_B Loopback",
|
||||
+ "TDMIN_A IN 5", "TDM_C Loopback",
|
||||
+ "TDMIN_B IN 5", "TDM_C Loopback",
|
||||
+ "TDMIN_C IN 5", "TDM_C Loopback",
|
||||
+ "TDMIN_LB IN 2", "TDM_C Loopback",
|
||||
"TODDR_A IN 0", "TDMIN_A OUT",
|
||||
"TODDR_B IN 0", "TDMIN_A OUT",
|
||||
"TODDR_C IN 0", "TDMIN_A OUT",
|
||||
@@ -230,7 +249,11 @@
|
||||
"TODDR_C IN 2", "TDMIN_C OUT",
|
||||
"TODDR_A IN 6", "TDMIN_LB OUT",
|
||||
"TODDR_B IN 6", "TDMIN_LB OUT",
|
||||
- "TODDR_C IN 6", "TDMIN_LB OUT";
|
||||
+ "TODDR_C IN 6", "TDMIN_LB OUT",
|
||||
+ "U19 INL", "ACODEC LOLP",
|
||||
+ "U19 INR", "ACODEC LORP",
|
||||
+ "Lineout", "U19 OUTL",
|
||||
+ "Lineout", "U19 OUTR";
|
||||
|
||||
assigned-clocks = <&clkc CLKID_MPLL2>,
|
||||
<&clkc CLKID_MPLL0>,
|
||||
@@ -275,22 +298,56 @@
|
||||
dai-tdm-slot-tx-mask-3 = <1 1>;
|
||||
mclk-fs = <256>;
|
||||
|
||||
- codec {
|
||||
+ codec-0 {
|
||||
sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
|
||||
};
|
||||
+
|
||||
+ codec-1 {
|
||||
+ sound-dai = <&toacodec TOACODEC_IN_B>;
|
||||
+ };
|
||||
};
|
||||
|
||||
- /* hdmi glue */
|
||||
+ /* i2s jack output interface */
|
||||
dai-link-7 {
|
||||
+ sound-dai = <&tdmif_c>;
|
||||
+ dai-format = "i2s";
|
||||
+ dai-tdm-slot-tx-mask-0 = <1 1>;
|
||||
+ mclk-fs = <256>;
|
||||
+
|
||||
+ codec-0 {
|
||||
+ sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>;
|
||||
+ };
|
||||
+
|
||||
+ codec-1 {
|
||||
+ sound-dai = <&toacodec TOACODEC_IN_C>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ /* hdmi glue */
|
||||
+ dai-link-8 {
|
||||
sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
|
||||
|
||||
codec {
|
||||
sound-dai = <&hdmi_tx>;
|
||||
};
|
||||
};
|
||||
+
|
||||
+ /* acodec glue */
|
||||
+ dai-link-9 {
|
||||
+ sound-dai = <&toacodec TOACODEC_OUT>;
|
||||
+
|
||||
+ codec {
|
||||
+ sound-dai = <&acodec>;
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
};
|
||||
|
||||
+&acodec {
|
||||
+ AVDD-supply = <&vddao_1v8>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&arb {
|
||||
status = "okay";
|
||||
};
|
||||
@@ -505,6 +562,10 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&tdmif_c {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&tdmin_a {
|
||||
status = "okay";
|
||||
};
|
||||
@@ -525,6 +586,14 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&tdmout_c {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&toacodec {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&tohdmitx {
|
||||
status = "okay";
|
||||
};
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,4 +1,5 @@
|
||||
KERNEL=="ttyAMA[01]", ATTR{iomem_base}=="0xFE201000", PROGRAM="/bin/sh -c '\
|
||||
|
||||
KERNEL=="ttyAMA0", PROGRAM="/bin/sh -c '\
|
||||
ALIASES=/proc/device-tree/aliases; \
|
||||
if cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
|
||||
echo 0;\
|
||||
@ -9,6 +10,19 @@ KERNEL=="ttyAMA[01]", ATTR{iomem_base}=="0xFE201000", PROGRAM="/bin/sh -c '\
|
||||
fi\
|
||||
'", SYMLINK+="serial%c"
|
||||
|
||||
KERNEL=="ttyAMA1", PROGRAM="/bin/sh -c '\
|
||||
ALIASES=/proc/device-tree/aliases; \
|
||||
if [ -e /dev/ttyAMA0 ]; then \
|
||||
exit 1; \
|
||||
elif cmp -s $ALIASES/uart0 $ALIASES/serial0; then \
|
||||
echo 0;\
|
||||
elif cmp -s $ALIASES/uart0 $ALIASES/serial1; then \
|
||||
echo 1; \
|
||||
else \
|
||||
exit 1; \
|
||||
fi\
|
||||
'", SYMLINK+="serial%c"
|
||||
|
||||
KERNEL=="ttyS0", PROGRAM="/bin/sh -c '\
|
||||
ALIASES=/proc/device-tree/aliases; \
|
||||
if cmp -s $ALIASES/uart1 $ALIASES/serial0; then \
|
@ -22,7 +22,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-c2 $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-c2/hassos-hook.sh"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.7.19"
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.9.1"
|
||||
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/kernel-amlogic.config"
|
||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config"
|
||||
@ -89,7 +89,7 @@ BR2_TARGET_UBOOT_BOARD_DEFCONFIG="odroid-c2"
|
||||
BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/bootloader/uboot.config $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-c2/uboot.config"
|
||||
BR2_TARGET_UBOOT_BOOT_SCRIPT=y
|
||||
BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-c2/uboot-boot.ush"
|
||||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_7=y
|
||||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_E2FSPROGS=y
|
||||
BR2_PACKAGE_HOST_GPTFDISK=y
|
||||
|
@ -22,7 +22,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-n2 $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-n2/hassos-hook.sh"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.7.19"
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.9.1"
|
||||
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/kernel-amlogic.config"
|
||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config"
|
||||
@ -89,7 +89,7 @@ BR2_TARGET_UBOOT_BOARD_DEFCONFIG="odroid-n2"
|
||||
BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/bootloader/uboot.config $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-n2/uboot.config"
|
||||
BR2_TARGET_UBOOT_BOOT_SCRIPT=y
|
||||
BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-n2/uboot-boot.ush"
|
||||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_7=y
|
||||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_E2FSPROGS=y
|
||||
BR2_PACKAGE_HOST_GPTFDISK=y
|
||||
|
@ -23,7 +23,7 @@ BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_HASSOS_PATH)/scripts/post-image.sh"
|
||||
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-xu4 $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-xu4/hassos-hook.sh"
|
||||
BR2_LINUX_KERNEL=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.7.19"
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.9.1"
|
||||
BR2_LINUX_KERNEL_DEFCONFIG="exynos"
|
||||
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/kernel/hassos.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/docker.config $(BR2_EXTERNAL_HASSOS_PATH)/kernel/device-support.config"
|
||||
BR2_LINUX_KERNEL_LZ4=y
|
||||
@ -93,7 +93,7 @@ BR2_TARGET_UBOOT_FORMAT_DTB_BIN=y
|
||||
BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_HASSOS_PATH)/bootloader/uboot.config $(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-xu4/uboot.config"
|
||||
BR2_TARGET_UBOOT_BOOT_SCRIPT=y
|
||||
BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="$(BR2_EXTERNAL_HASSOS_PATH)/board/hardkernel/odroid-xu4/uboot-boot.ush"
|
||||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_7=y
|
||||
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y
|
||||
BR2_PACKAGE_HOST_DOSFSTOOLS=y
|
||||
BR2_PACKAGE_HOST_E2FSPROGS=y
|
||||
BR2_PACKAGE_HOST_GPTFDISK=y
|
||||
|
@ -1,5 +1,5 @@
|
||||
VERSION_MAJOR=5
|
||||
VERSION_BUILD=3
|
||||
VERSION_BUILD=4
|
||||
|
||||
HASSOS_NAME="HassOS"
|
||||
HASSOS_ID="hassos"
|
||||
|
@ -11,8 +11,8 @@ BLUETOOTH_BCM43XX_SITE = $(BR2_EXTERNAL_HASSOS_PATH)/package/bluetooth-bcm43xx
|
||||
BLUETOOTH_BCM43XX_SITE_METHOD = local
|
||||
|
||||
define BLUETOOTH_BCM43XX_BUILD_CMDS
|
||||
curl -L -o $(@D)/BCM43430A1.hcd https://raw.githubusercontent.com/RPi-Distro/bluez-firmware/fff76cb15527c435ce99a9787848eacd6288282c/broadcom/BCM43430A1.hcd
|
||||
curl -L -o $(@D)/BCM4345C0.hcd https://raw.githubusercontent.com/RPi-Distro/bluez-firmware/fff76cb15527c435ce99a9787848eacd6288282c/broadcom/BCM4345C0.hcd
|
||||
curl -L -o $(@D)/BCM43430A1.hcd https://raw.githubusercontent.com/RPi-Distro/bluez-firmware/a4e08822e3f24a6211f6ac94bc98b7ef87700c70/broadcom/BCM43430A1.hcd
|
||||
curl -L -o $(@D)/BCM4345C0.hcd https://raw.githubusercontent.com/RPi-Distro/bluez-firmware/a4e08822e3f24a6211f6ac94bc98b7ef87700c70/broadcom/BCM4345C0.hcd
|
||||
curl -L -o $(@D)/btuart https://raw.githubusercontent.com/RPi-Distro/pi-bluetooth/cbdbcb66bcc5b9af05f1a9fffe2254c872bb0ace/usr/bin/btuart
|
||||
curl -L -o $(@D)/bthelper https://raw.githubusercontent.com/RPi-Distro/pi-bluetooth/cbdbcb66bcc5b9af05f1a9fffe2254c872bb0ace/usr/bin/bthelper
|
||||
curl -L -o $(@D)/90-pi-bluetooth.rules https://raw.githubusercontent.com/RPi-Distro/pi-bluetooth/cbdbcb66bcc5b9af05f1a9fffe2254c872bb0ace/lib/udev/rules.d/90-pi-bluetooth.rules
|
||||
|
@ -0,0 +1,23 @@
|
||||
From 4a4298ef78e943d36f3b8d8e78bfa21b1506961e Mon Sep 17 00:00:00 2001
|
||||
From: Aman Gupta Karmani <aman@tmm1.net>
|
||||
Date: Mon, 12 Oct 2020 13:39:26 -0700
|
||||
Subject: [PATCH] time-wait-sync: log errors trying to watch
|
||||
/run/systemd/timesync
|
||||
|
||||
---
|
||||
src/time-wait-sync/time-wait-sync.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/time-wait-sync/time-wait-sync.c b/src/time-wait-sync/time-wait-sync.c
|
||||
index 96072445f6e..c8ec4850426 100644
|
||||
--- a/src/time-wait-sync/time-wait-sync.c
|
||||
+++ b/src/time-wait-sync/time-wait-sync.c
|
||||
@@ -50,7 +50,7 @@ static void clock_state_release(ClockState *sp) {
|
||||
static int clock_state_update(ClockState *sp, sd_event *event);
|
||||
|
||||
static int update_notify_run_systemd_timesync(ClockState *sp) {
|
||||
- sp->run_systemd_timesync_wd = inotify_add_watch(sp->inotify_fd, "/run/systemd/timesync", IN_CREATE|IN_DELETE_SELF);
|
||||
+ sp->run_systemd_timesync_wd = inotify_add_watch_and_warn(sp->inotify_fd, "/run/systemd/timesync", IN_CREATE|IN_DELETE_SELF);
|
||||
return sp->run_systemd_timesync_wd;
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
From f6f4f5fe5395a57f10dd446c7266c53f0673eaac Mon Sep 17 00:00:00 2001
|
||||
From: Balaji Punnuru <balaji_punnuru@cable.comcast.com>
|
||||
Date: Thu, 9 Apr 2020 12:21:49 -0400
|
||||
Subject: [PATCH] util: return the correct correct wd from inotify helpers
|
||||
|
||||
We need to propagate the acquired watch descriptors because our callers
|
||||
are counting on them.
|
||||
|
||||
[Lennart: this is split out of #15381 and simplified]
|
||||
---
|
||||
src/basic/fs-util.c | 14 ++++++++------
|
||||
1 file changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
|
||||
index 558cafbcaf5..ef3b5a51842 100644
|
||||
--- a/src/basic/fs-util.c
|
||||
+++ b/src/basic/fs-util.c
|
||||
@@ -692,28 +692,30 @@ int unlink_or_warn(const char *filename) {
|
||||
|
||||
int inotify_add_watch_fd(int fd, int what, uint32_t mask) {
|
||||
char path[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int) + 1];
|
||||
- int r;
|
||||
+ int wd;
|
||||
|
||||
/* This is like inotify_add_watch(), except that the file to watch is not referenced by a path, but by an fd */
|
||||
xsprintf(path, "/proc/self/fd/%i", what);
|
||||
|
||||
- r = inotify_add_watch(fd, path, mask);
|
||||
- if (r < 0)
|
||||
+ wd = inotify_add_watch(fd, path, mask);
|
||||
+ if (wd < 0)
|
||||
return -errno;
|
||||
|
||||
- return r;
|
||||
+ return wd;
|
||||
}
|
||||
|
||||
int inotify_add_watch_and_warn(int fd, const char *pathname, uint32_t mask) {
|
||||
+ int wd;
|
||||
|
||||
- if (inotify_add_watch(fd, pathname, mask) < 0) {
|
||||
+ wd = inotify_add_watch(fd, pathname, mask);
|
||||
+ if (wd < 0) {
|
||||
if (errno == ENOSPC)
|
||||
return log_error_errno(errno, "Failed to add a watch for %s: inotify watch limit reached", pathname);
|
||||
|
||||
return log_error_errno(errno, "Failed to add a watch for %s: %m", pathname);
|
||||
}
|
||||
|
||||
- return 0;
|
||||
+ return wd;
|
||||
}
|
||||
|
||||
static bool unsafe_transition(const struct stat *a, const struct stat *b) {
|
@ -1,7 +1,7 @@
|
||||
[Unit]
|
||||
Description=NetworkManager persistent data
|
||||
Requires=mnt-data.mount
|
||||
After=mnt-data.mount
|
||||
Requires=mnt-overlay.mount
|
||||
After=mnt-overlay.mount hassos-overlay.service
|
||||
Before=NetworkManager.service
|
||||
|
||||
[Mount]
|
||||
|
@ -16,7 +16,7 @@ index 59ab1da0c6..e3ba1bf99c 100644
|
||||
@@ -1,3 +1,3 @@
|
||||
# Locally computed
|
||||
-sha256 31a84340be08be319570a9d1439f25c0e3513fed73065a56aa5dd61dd605d5d9 rpi-firmware-01ecfd2ba2b7cf3a2f4aa75ada895ee4a3e729f5.tar.gz
|
||||
+sha256 4789d4422b3bc7eab157471ba36aebd54efc2a6de4c937f5cfdb4392af04fe80 rpi-firmware-7caead9416f64b2d33361c703fb243b8e157eba4.tar.gz
|
||||
+sha256 6e5f1bf068995078d4d6a01899a7f7fe094b92a4f5cc19f0d4f67040a3175aa9 rpi-firmware-2b41f509710d99758a5b8efa88d95dd0e9169c0a.tar.gz
|
||||
sha256 c7283ff51f863d93a275c66e3b4cb08021a5dd4d8c1e7acc47d872fbe52d3d6b boot/LICENCE.broadcom
|
||||
diff --git a/package/rpi-firmware/rpi-firmware.mk b/package/rpi-firmware/rpi-firmware.mk
|
||||
index 6fee60b08c..2177ca9859 100644
|
||||
@ -27,7 +27,7 @@ index 6fee60b08c..2177ca9859 100644
|
||||
################################################################################
|
||||
|
||||
-RPI_FIRMWARE_VERSION = 01ecfd2ba2b7cf3a2f4aa75ada895ee4a3e729f5
|
||||
+RPI_FIRMWARE_VERSION = 7caead9416f64b2d33361c703fb243b8e157eba4
|
||||
+RPI_FIRMWARE_VERSION = 2b41f509710d99758a5b8efa88d95dd0e9169c0a
|
||||
RPI_FIRMWARE_SITE = $(call github,raspberrypi,firmware,$(RPI_FIRMWARE_VERSION))
|
||||
RPI_FIRMWARE_LICENSE = BSD-3-Clause
|
||||
RPI_FIRMWARE_LICENSE_FILES = boot/LICENCE.broadcom
|
||||
|
@ -1,68 +0,0 @@
|
||||
From e36dc9a2a030204b5b6c6868348878b596f88de3 Mon Sep 17 00:00:00 2001
|
||||
From: Pascal Vizeli <pvizeli@syshack.ch>
|
||||
Date: Fri, 5 Jun 2020 14:18:26 +0000
|
||||
Subject: [PATCH 1/1] Linux 5.7
|
||||
|
||||
Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
|
||||
---
|
||||
package/linux-headers/Config.in.host | 4 ++++
|
||||
toolchain/Config.in | 5 +++++
|
||||
.../toolchain-external-custom/Config.in.options | 4 ++++
|
||||
3 files changed, 13 insertions(+)
|
||||
|
||||
diff --git a/package/linux-headers/Config.in.host b/package/linux-headers/Config.in.host
|
||||
index 95e85a00..88b9ff99 100644
|
||||
--- a/package/linux-headers/Config.in.host
|
||||
+++ b/package/linux-headers/Config.in.host
|
||||
@@ -127,6 +127,10 @@ choice
|
||||
If your kernel headers are more recent than the latest version
|
||||
in the choice, then select the latest version.
|
||||
|
||||
+config BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_7
|
||||
+ bool "5.7.x or later"
|
||||
+ select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_7
|
||||
+
|
||||
config BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4
|
||||
bool "5.4.x or later"
|
||||
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4
|
||||
diff --git a/toolchain/Config.in b/toolchain/Config.in
|
||||
index bff57280..c07a92ce 100644
|
||||
--- a/toolchain/Config.in
|
||||
+++ b/toolchain/Config.in
|
||||
@@ -470,6 +470,10 @@ config BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4
|
||||
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_3
|
||||
select BR2_TOOLCHAIN_HEADERS_LATEST
|
||||
|
||||
+config BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_7
|
||||
+ bool
|
||||
+ select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4
|
||||
+
|
||||
# This should be selected by the latest version, above, to indicate that
|
||||
# Buildroot does not know of more recent headers than the ones selected.
|
||||
# This allows using toolchains with headers more recent than Buildroot
|
||||
@@ -481,6 +485,7 @@ config BR2_TOOLCHAIN_HEADERS_LATEST
|
||||
# stops affecting a value on the first matching default.
|
||||
config BR2_TOOLCHAIN_HEADERS_AT_LEAST
|
||||
string
|
||||
+ default "5.7" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_7
|
||||
default "5.4" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4
|
||||
default "5.3" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_3
|
||||
default "5.2" if BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_2
|
||||
diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
|
||||
index 8c38dd9f..b49231e1 100644
|
||||
--- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
|
||||
+++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
|
||||
@@ -115,6 +115,10 @@ choice
|
||||
If your toolchain uses headers newer than the latest version
|
||||
in the choice, then select the latest version.
|
||||
|
||||
+config BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_7
|
||||
+ bool "5.7.x or later"
|
||||
+ select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_7
|
||||
+
|
||||
config BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_4
|
||||
bool "5.4.x or later"
|
||||
select BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_4
|
||||
--
|
||||
2.17.1
|
||||
|
@ -4,12 +4,13 @@
|
||||
# It needs to be regenerated every time a defconfig is added, using
|
||||
# "make .gitlab-ci.yml".
|
||||
|
||||
image: buildroot/base:20191027.2027
|
||||
image: buildroot/base:20200814.2228
|
||||
|
||||
.check_base:
|
||||
except:
|
||||
- /^.*-.*_defconfig$/
|
||||
- /^.*-tests\..*$/
|
||||
rules:
|
||||
- if: '$CI_COMMIT_REF_NAME =~ /^.*-.*_defconfig$/ || $CI_COMMIT_REF_NAME =~ /^.*-tests\..*$/'
|
||||
when: never
|
||||
- when: always
|
||||
|
||||
check-DEVELOPERS:
|
||||
extends: .check_base
|
||||
@ -27,7 +28,7 @@ check-flake8:
|
||||
- find * -type f -print0 | xargs -0 file | grep 'Python script' | cut -d':' -f1 >> files.txt
|
||||
- sort -u files.txt | tee files.processed
|
||||
script:
|
||||
- python -m flake8 --statistics --count --max-line-length=132 $(cat files.processed)
|
||||
- python3 -m flake8 --statistics --count --max-line-length=132 $(cat files.processed)
|
||||
after_script:
|
||||
- wc -l files.processed
|
||||
|
||||
@ -69,17 +70,21 @@ check-package:
|
||||
extends: .defconfig_base
|
||||
# Running the defconfigs for every push is too much, so limit to
|
||||
# explicit triggers through the API.
|
||||
only:
|
||||
- triggers
|
||||
- tags
|
||||
- /-defconfigs$/
|
||||
rules:
|
||||
# For tags, create a pipeline.
|
||||
- if: '$CI_COMMIT_TAG'
|
||||
# For pipeline created by using a trigger token.
|
||||
- if: '$CI_PIPELINE_TRIGGERED'
|
||||
# For the branch or tag name named *-defconfigs, create a pipeline.
|
||||
- if: '$CI_COMMIT_REF_NAME =~ /^.*-defconfigs$/'
|
||||
before_script:
|
||||
- DEFCONFIG_NAME=${CI_JOB_NAME}
|
||||
|
||||
one-defconfig:
|
||||
extends: .defconfig_base
|
||||
only:
|
||||
- /^.*-.*_defconfig$/
|
||||
rules:
|
||||
# For the branch or tag name named *-*_defconfigs, create a pipeline.
|
||||
- if: '$CI_COMMIT_REF_NAME =~ /^.*-.*_defconfig$/'
|
||||
before_script:
|
||||
- DEFCONFIG_NAME=$(echo ${CI_COMMIT_REF_NAME} | sed -e 's,^.*-,,g')
|
||||
|
||||
@ -103,17 +108,20 @@ one-defconfig:
|
||||
extends: .runtime_test_base
|
||||
# Running the runtime tests for every push is too much, so limit to
|
||||
# explicit triggers through the API.
|
||||
only:
|
||||
- triggers
|
||||
- tags
|
||||
- /-runtime-tests$/
|
||||
rules:
|
||||
# For tags, create a pipeline.
|
||||
- if: '$CI_COMMIT_TAG'
|
||||
# For pipeline created by using a trigger token.
|
||||
- if: '$CI_PIPELINE_TRIGGERED'
|
||||
# For the branch or tag name named *-runtime-tests, create a pipeline.
|
||||
- if: '$CI_COMMIT_REF_NAME =~ /^.*-runtime-tests$/'
|
||||
before_script:
|
||||
- TEST_CASE_NAME=${CI_JOB_NAME}
|
||||
|
||||
one-runtime_test:
|
||||
extends: .runtime_test_base
|
||||
only:
|
||||
- /^.*-tests\..*$/
|
||||
rules:
|
||||
- if: '$CI_COMMIT_REF_NAME =~ /^.*-tests\..*$/'
|
||||
before_script:
|
||||
- TEST_CASE_NAME=$(echo ${CI_COMMIT_REF_NAME} | sed -e 's,^.*-,,g')
|
||||
aarch64_efi_defconfig: { extends: .defconfig }
|
||||
|
@ -4,12 +4,13 @@
|
||||
# It needs to be regenerated every time a defconfig is added, using
|
||||
# "make .gitlab-ci.yml".
|
||||
|
||||
image: buildroot/base:20191027.2027
|
||||
image: buildroot/base:20200814.2228
|
||||
|
||||
.check_base:
|
||||
except:
|
||||
- /^.*-.*_defconfig$/
|
||||
- /^.*-tests\..*$/
|
||||
rules:
|
||||
- if: '$CI_COMMIT_REF_NAME =~ /^.*-.*_defconfig$/ || $CI_COMMIT_REF_NAME =~ /^.*-tests\..*$/'
|
||||
when: never
|
||||
- when: always
|
||||
|
||||
check-DEVELOPERS:
|
||||
extends: .check_base
|
||||
@ -27,7 +28,7 @@ check-flake8:
|
||||
- find * -type f -print0 | xargs -0 file | grep 'Python script' | cut -d':' -f1 >> files.txt
|
||||
- sort -u files.txt | tee files.processed
|
||||
script:
|
||||
- python -m flake8 --statistics --count --max-line-length=132 $(cat files.processed)
|
||||
- python3 -m flake8 --statistics --count --max-line-length=132 $(cat files.processed)
|
||||
after_script:
|
||||
- wc -l files.processed
|
||||
|
||||
@ -69,17 +70,21 @@ check-package:
|
||||
extends: .defconfig_base
|
||||
# Running the defconfigs for every push is too much, so limit to
|
||||
# explicit triggers through the API.
|
||||
only:
|
||||
- triggers
|
||||
- tags
|
||||
- /-defconfigs$/
|
||||
rules:
|
||||
# For tags, create a pipeline.
|
||||
- if: '$CI_COMMIT_TAG'
|
||||
# For pipeline created by using a trigger token.
|
||||
- if: '$CI_PIPELINE_TRIGGERED'
|
||||
# For the branch or tag name named *-defconfigs, create a pipeline.
|
||||
- if: '$CI_COMMIT_REF_NAME =~ /^.*-defconfigs$/'
|
||||
before_script:
|
||||
- DEFCONFIG_NAME=${CI_JOB_NAME}
|
||||
|
||||
one-defconfig:
|
||||
extends: .defconfig_base
|
||||
only:
|
||||
- /^.*-.*_defconfig$/
|
||||
rules:
|
||||
# For the branch or tag name named *-*_defconfigs, create a pipeline.
|
||||
- if: '$CI_COMMIT_REF_NAME =~ /^.*-.*_defconfig$/'
|
||||
before_script:
|
||||
- DEFCONFIG_NAME=$(echo ${CI_COMMIT_REF_NAME} | sed -e 's,^.*-,,g')
|
||||
|
||||
@ -103,16 +108,19 @@ one-defconfig:
|
||||
extends: .runtime_test_base
|
||||
# Running the runtime tests for every push is too much, so limit to
|
||||
# explicit triggers through the API.
|
||||
only:
|
||||
- triggers
|
||||
- tags
|
||||
- /-runtime-tests$/
|
||||
rules:
|
||||
# For tags, create a pipeline.
|
||||
- if: '$CI_COMMIT_TAG'
|
||||
# For pipeline created by using a trigger token.
|
||||
- if: '$CI_PIPELINE_TRIGGERED'
|
||||
# For the branch or tag name named *-runtime-tests, create a pipeline.
|
||||
- if: '$CI_COMMIT_REF_NAME =~ /^.*-runtime-tests$/'
|
||||
before_script:
|
||||
- TEST_CASE_NAME=${CI_JOB_NAME}
|
||||
|
||||
one-runtime_test:
|
||||
extends: .runtime_test_base
|
||||
only:
|
||||
- /^.*-tests\..*$/
|
||||
rules:
|
||||
- if: '$CI_COMMIT_REF_NAME =~ /^.*-tests\..*$/'
|
||||
before_script:
|
||||
- TEST_CASE_NAME=$(echo ${CI_COMMIT_REF_NAME} | sed -e 's,^.*-,,g')
|
||||
|
@ -1,3 +1,94 @@
|
||||
2020.02.7, released October 12th, 2020
|
||||
|
||||
Important / security related fixes.
|
||||
|
||||
meson: Correct SDK cross-compilation.conf file when
|
||||
per-package builds were used to build SDK.
|
||||
|
||||
systemd: Use /run rather than /var/run for PID files in units.
|
||||
|
||||
Toolchain: use Secure-PLT rather than BSS-PLT for PowerPC 32.
|
||||
|
||||
support/script/pycompile: Rework logic to ensure .pyc files
|
||||
contain absolute target paths, fixing code inspection at
|
||||
runtime when executed with cwd != '/'.
|
||||
|
||||
support/scripts/setlocalversion: Correct Mercurial output to
|
||||
match behaviour with Git.
|
||||
|
||||
support/scripts/apply-patches.sh: Use patch
|
||||
--no-backup-if-mismatch, so we no longer blindly have to
|
||||
remove *.orig files after patching, fixing issues with
|
||||
packages containing such files.
|
||||
|
||||
Updated/fixed packages: bandwidthd, barebox, bash, bison,
|
||||
brotli, cifs-utils, cryptsetup, dhcpcd, dhcpdump, docker-cli,
|
||||
docker-engine, ecryptfs-utils, efl, fail2ban, freetype, gcc,
|
||||
gdb, ghostscript, gnutls, go, gst1-plugins-base,
|
||||
gst1-plugins-ugly, ipmitool, libhtp, libraw, libssh, libxml2,
|
||||
libxml-parser-perl, localedef, lua, memcached, mesa3d, meson,
|
||||
minidlna, nginx, nodejs, nss-pam-ldapd, openvmtools, php,
|
||||
postgresql, python, python-aenum, python-autobahn,
|
||||
python-engineio, python-fire, python-pymodbus, python-scapy,
|
||||
python-semver, python-sentry-sdk, python-socketio,
|
||||
python-texttable, python-tinyrpc, python-txtorcon, python3,
|
||||
qt5base, runc, samba4, strace, supertux, suricata, systemd,
|
||||
vlc, wayland-protocols, wireguard-linux-compat, wireshark,
|
||||
xserver_xorg-server, zeromq, zstd
|
||||
|
||||
Issues resolved (http://bugs.uclibc.org):
|
||||
|
||||
#12911: usb_modeswitch installation race condition
|
||||
#13251: cryptsetup does not work on branch 2020.02 following..
|
||||
|
||||
2020.02.6, released September 5th, 2020
|
||||
|
||||
Important / security related fixes.
|
||||
|
||||
Fix a 2020.02.5 build regression in busybox when systemd (and
|
||||
not less) are enabled because of missing infrastructure.
|
||||
|
||||
Updated/fixed packages: alsa-utils, avahi, busybox, cups,
|
||||
docker-cli, graphite2, imagemagick, libeXosip2, mbedtls,
|
||||
nvidia-driver, paho-mqtt-c, python-django, systemd, uclibc,
|
||||
usb_modeswitch, wolfssl
|
||||
|
||||
Issues resolved (http://bugs.uclibc.org):
|
||||
|
||||
#12911: usb_modeswitch installation race condition
|
||||
|
||||
2020.02.5, released August 29th, 2020
|
||||
|
||||
Important / security related fixes.
|
||||
|
||||
Infrastructure: Ensure RPATH entries that may be needed for
|
||||
dlopen() are not dropped by patchelf.
|
||||
|
||||
BR_VERSION_FULL/setlocalversion (used by make print-version
|
||||
and /etc/os-release): Properly handle local git tags
|
||||
|
||||
Updated/fixed packages: apache, at91bootstrap3, bind, boost,
|
||||
busybox, capnproto, chrony, collectd, cpio, cryptsetup, cups,
|
||||
cvs, dbus, docker-engine, domoticz, dovecot,
|
||||
dovecot-pigeonhole, dropbear, efl, elixir, f2fs-tools, ffmpeg,
|
||||
gd, gdk-pixbuf, ghostscript, glibc, grub2, gst1-plugins-bad,
|
||||
hostapd, iputils, jasper, json-c, libcurl, libwebsockets,
|
||||
linux, live555, mesa3d, mosquitto, mpv, nodejs, opencv,
|
||||
opencv3, openjpeg, patchelf, perl, php, postgresql,
|
||||
python-django, python-gunicorn, python-matplotlib, ripgrep,
|
||||
rtl8188eu, rtl8821au, ruby, shadowsocks-libev, squid,
|
||||
tpm2-abrmd, tpm2-tools, trousers, uacme, webkitgtk, wireshark,
|
||||
wolfssl, wpa_supplicant, wpewebkit, xen, xlib_libX11,
|
||||
xserver_xorg-server
|
||||
|
||||
Issues resolved (http://bugs.uclibc.org):
|
||||
|
||||
#12876: nodejs fails to build when host-icu has been built before
|
||||
#13111: python-gunicorn: missing dependency on python-setuptools
|
||||
#13121: wpa_supplicant fails to build without libopenssl enabled
|
||||
#13141: Target-finalize fail with "depmod: ERROR: Bad version passed"
|
||||
#13156: package live555 new license
|
||||
|
||||
2020.02.4, released July 26th, 2020
|
||||
|
||||
Important / security related fixes.
|
||||
|
@ -186,18 +186,25 @@ F: package/rauc/
|
||||
|
||||
N: Angelo Compagnucci <angelo.compagnucci@gmail.com>
|
||||
F: package/corkscrew/
|
||||
F: package/cups/
|
||||
F: package/cups-filters/
|
||||
F: package/fail2ban/
|
||||
F: package/grep/
|
||||
F: package/i2c-tools/
|
||||
F: package/jq/
|
||||
F: package/libb64/
|
||||
F: package/mender/
|
||||
F: package/mender-artifact/
|
||||
F: package/mono/
|
||||
F: package/mono-gtksharp3/
|
||||
F: package/monolite/
|
||||
F: package/openjpeg/
|
||||
F: package/python-can/
|
||||
F: package/python-pillow/
|
||||
F: package/python-pydal/
|
||||
F: package/python-spidev/
|
||||
F: package/python-web2py/
|
||||
F: package/sam-ba/
|
||||
F: package/sshguard/
|
||||
F: package/sunwait/
|
||||
F: package/sysdig/
|
||||
@ -211,6 +218,8 @@ N: Anthony Viallard <viallard@syscom-instruments.com>
|
||||
F: package/gnuplot/
|
||||
|
||||
N: Antoine Ténart <antoine.tenart@bootlin.com>
|
||||
F: package/libselinux/
|
||||
F: package/refpolicy/
|
||||
F: package/wf111/
|
||||
|
||||
N: Antony Pavlov <antonynpavlov@gmail.com>
|
||||
@ -1035,6 +1044,7 @@ N: Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
|
||||
F: package/gnuradio/
|
||||
F: package/gqrx/
|
||||
F: package/gr-osmosdr/
|
||||
F: package/librtlsdr/
|
||||
F: package/libusbgx/
|
||||
F: package/python-cheetah/
|
||||
F: package/python-markdown/
|
||||
@ -1713,9 +1723,6 @@ F: package/systemd-bootchart/
|
||||
F: package/tinyalsa/
|
||||
F: package/tinyxml/
|
||||
|
||||
N: Maxime Ripard <maxime.ripard@bootlin.com>
|
||||
F: package/kmsxx/
|
||||
|
||||
N: Michael Durrant <mdurrant@arcturusnetworks.com>
|
||||
F: board/arcturus/
|
||||
F: configs/arcturus_ucp1020_defconfig
|
||||
@ -1810,6 +1817,7 @@ F: package/tpm-tools/
|
||||
F: package/trousers/
|
||||
|
||||
N: Norbert Lange <nolange79@gmail.com>
|
||||
F: package/systemd/
|
||||
F: package/tcf-agent/
|
||||
|
||||
N: Nylon Chen <nylon7@andestech.com>
|
||||
@ -2135,6 +2143,7 @@ F: package/davfs2/
|
||||
|
||||
N: Ryan Barnett <ryan.barnett@rockwellcollins.com>
|
||||
F: package/atftp/
|
||||
F: package/c-periphery/
|
||||
F: package/miraclecast/
|
||||
F: package/python-pyasn/
|
||||
F: package/python-pysnmp/
|
||||
|
@ -92,9 +92,9 @@ all:
|
||||
.PHONY: all
|
||||
|
||||
# Set and export the version string
|
||||
export BR2_VERSION := 2020.02.4
|
||||
export BR2_VERSION := 2020.02.7
|
||||
# Actual time the release is cut (for reproducible builds)
|
||||
BR2_VERSION_EPOCH = 1595750000
|
||||
BR2_VERSION_EPOCH = 1602538000
|
||||
|
||||
# Save running make version since it's clobbered by the make package
|
||||
RUNNING_MAKE_VERSION := $(MAKE_VERSION)
|
||||
@ -113,7 +113,13 @@ DATE := $(shell date +%Y%m%d)
|
||||
|
||||
# Compute the full local version string so packages can use it as-is
|
||||
# Need to export it, so it can be got from environment in children (eg. mconf)
|
||||
export BR2_VERSION_FULL := $(BR2_VERSION)$(shell $(TOPDIR)/support/scripts/setlocalversion)
|
||||
|
||||
BR2_LOCALVERSION := $(shell $(TOPDIR)/support/scripts/setlocalversion)
|
||||
ifeq ($(BR2_LOCALVERSION),)
|
||||
export BR2_VERSION_FULL := $(BR2_VERSION)
|
||||
else
|
||||
export BR2_VERSION_FULL := $(BR2_LOCALVERSION)
|
||||
endif
|
||||
|
||||
# List of targets and target patterns for which .config doesn't need to be read in
|
||||
noconfig_targets := menuconfig nconfig gconfig xconfig config oldconfig randconfig \
|
||||
@ -793,9 +799,9 @@ endif
|
||||
# counterparts are appropriately setup as symlinks ones to the others.
|
||||
ifeq ($(BR2_ROOTFS_MERGED_USR),y)
|
||||
|
||||
@$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
|
||||
$(call MESSAGE,"Sanity check in overlay $(d)"); \
|
||||
not_merged_dirs="$$(support/scripts/check-merged-usr.sh $(d))"; \
|
||||
$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
|
||||
@$(call MESSAGE,"Sanity check in overlay $(d)")$(sep) \
|
||||
$(Q)not_merged_dirs="$$(support/scripts/check-merged-usr.sh $(d))"; \
|
||||
test -n "$$not_merged_dirs" && { \
|
||||
echo "ERROR: The overlay in $(d) is not" \
|
||||
"using a merged /usr for the following directories:" \
|
||||
@ -805,20 +811,20 @@ ifeq ($(BR2_ROOTFS_MERGED_USR),y)
|
||||
|
||||
endif # merged /usr
|
||||
|
||||
@$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
|
||||
$(call MESSAGE,"Copying overlay $(d)"); \
|
||||
$(call SYSTEM_RSYNC,$(d),$(TARGET_DIR))$(sep))
|
||||
$(foreach d, $(call qstrip,$(BR2_ROOTFS_OVERLAY)), \
|
||||
@$(call MESSAGE,"Copying overlay $(d)")$(sep) \
|
||||
$(Q)$(call SYSTEM_RSYNC,$(d),$(TARGET_DIR))$(sep))
|
||||
|
||||
$(if $(TARGET_DIR_FILES_LISTS), \
|
||||
$(Q)$(if $(TARGET_DIR_FILES_LISTS), \
|
||||
cat $(TARGET_DIR_FILES_LISTS)) > $(BUILD_DIR)/packages-file-list.txt
|
||||
$(if $(HOST_DIR_FILES_LISTS), \
|
||||
$(Q)$(if $(HOST_DIR_FILES_LISTS), \
|
||||
cat $(HOST_DIR_FILES_LISTS)) > $(BUILD_DIR)/packages-file-list-host.txt
|
||||
$(if $(STAGING_DIR_FILES_LISTS), \
|
||||
$(Q)$(if $(STAGING_DIR_FILES_LISTS), \
|
||||
cat $(STAGING_DIR_FILES_LISTS)) > $(BUILD_DIR)/packages-file-list-staging.txt
|
||||
|
||||
@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
|
||||
$(call MESSAGE,"Executing post-build script $(s)"); \
|
||||
$(EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
|
||||
$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
|
||||
@$(call MESSAGE,"Executing post-build script $(s)")$(sep) \
|
||||
$(Q)$(EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
|
||||
|
||||
touch $(TARGET_DIR)/usr
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
config BR2_TARGET_AT91BOOTSTRAP3
|
||||
bool "AT91 Bootstrap 3"
|
||||
depends on BR2_arm926t || BR2_cortex_a5
|
||||
depends on BR2_arm926t || BR2_cortex_a5 || BR2_cortex_a7
|
||||
help
|
||||
AT91Bootstrap is a first level bootloader for the Atmel AT91
|
||||
devices. It integrates algorithms for:
|
||||
|
@ -88,13 +88,6 @@ $(1)_KCONFIG_DEPENDENCIES = \
|
||||
$(BR2_BISON_HOST_DEPENDENCY) \
|
||||
$(BR2_FLEX_HOST_DEPENDENCY)
|
||||
|
||||
ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
|
||||
define $(1)_BUILD_BAREBOXENV_CMDS
|
||||
$$(TARGET_CC) $$(TARGET_CFLAGS) $$(TARGET_LDFLAGS) -o $$(@D)/bareboxenv \
|
||||
$$(@D)/scripts/bareboxenv.c
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($$(BR2_TARGET_$(1)_CUSTOM_ENV),y)
|
||||
$(1)_ENV_NAME = $$(notdir $$(call qstrip,\
|
||||
$$(BR2_TARGET_$(1)_CUSTOM_ENV_PATH)))
|
||||
@ -109,12 +102,23 @@ endef
|
||||
endif
|
||||
|
||||
ifneq ($$($(1)_CUSTOM_EMBEDDED_ENV_PATH),)
|
||||
define $(1)_KCONFIG_FIXUP_CMDS
|
||||
$$(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_ENVIRONMENT,$$(@D)/.config)
|
||||
$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,"$$($(1)_CUSTOM_EMBEDDED_ENV_PATH)",$$(@D)/.config)
|
||||
define $(1)_KCONFIG_FIXUP_CUSTOM_EMBEDDED_ENV_PATH
|
||||
$$(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_ENVIRONMENT)
|
||||
$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,"$$($(1)_CUSTOM_EMBEDDED_ENV_PATH)")
|
||||
endef
|
||||
endif
|
||||
|
||||
define $(1)_KCONFIG_FIXUP_BAREBOXENV
|
||||
$$(if $$(BR2_TARGET_$(1)_BAREBOXENV),\
|
||||
$$(call KCONFIG_ENABLE_OPT,CONFIG_BAREBOXENV_TARGET),\
|
||||
$$(call KCONFIG_DISABLE_OPT,CONFIG_BAREBOXENV_TARGET))
|
||||
endef
|
||||
|
||||
define $(1)_KCONFIG_FIXUP_CMDS
|
||||
$$($(1)_KCONFIG_FIXUP_CUSTOM_EMBEDDED_ENV_PATH)
|
||||
$$($(1)_KCONFIG_FIXUP_BAREBOXENV)
|
||||
endef
|
||||
|
||||
define $(1)_BUILD_CMDS
|
||||
$$($(1)_BUILD_BAREBOXENV_CMDS)
|
||||
$$(TARGET_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
|
||||
@ -136,7 +140,7 @@ endef
|
||||
|
||||
ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
|
||||
define $(1)_INSTALL_TARGET_CMDS
|
||||
cp $$(@D)/bareboxenv $$(TARGET_DIR)/usr/bin
|
||||
cp $$(@D)/scripts/bareboxenv-target $$(TARGET_DIR)/usr/bin/bareboxenv
|
||||
endef
|
||||
endif
|
||||
|
||||
|
@ -0,0 +1,73 @@
|
||||
From a7ab0cc98fa89a3d5098c29cbe44bcd24b0a6454 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Wed, 15 Apr 2020 15:45:02 -0400
|
||||
Subject: [PATCH] yylex: Make lexer fatal errors actually be fatal
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
When presented with a command that can't be tokenized to anything
|
||||
smaller than YYLMAX characters, the parser calls YY_FATAL_ERROR(errmsg),
|
||||
expecting that will stop further processing, as such:
|
||||
|
||||
#define YY_DO_BEFORE_ACTION \
|
||||
yyg->yytext_ptr = yy_bp; \
|
||||
yyleng = (int) (yy_cp - yy_bp); \
|
||||
yyg->yy_hold_char = *yy_cp; \
|
||||
*yy_cp = '\0'; \
|
||||
if ( yyleng >= YYLMAX ) \
|
||||
YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
|
||||
yy_flex_strncpy( yytext, yyg->yytext_ptr, yyleng + 1 , yyscanner); \
|
||||
yyg->yy_c_buf_p = yy_cp;
|
||||
|
||||
The code flex generates expects that YY_FATAL_ERROR() will either return
|
||||
for it or do some form of longjmp(), or handle the error in some way at
|
||||
least, and so the strncpy() call isn't in an "else" clause, and thus if
|
||||
YY_FATAL_ERROR() is *not* actually fatal, it does the call with the
|
||||
questionable limit, and predictable results ensue.
|
||||
|
||||
Unfortunately, our implementation of YY_FATAL_ERROR() is:
|
||||
|
||||
#define YY_FATAL_ERROR(msg) \
|
||||
do { \
|
||||
grub_printf (_("fatal error: %s\n"), _(msg)); \
|
||||
} while (0)
|
||||
|
||||
The same pattern exists in yyless(), and similar problems exist in users
|
||||
of YY_INPUT(), several places in the main parsing loop,
|
||||
yy_get_next_buffer(), yy_load_buffer_state(), yyensure_buffer_stack,
|
||||
yy_scan_buffer(), etc.
|
||||
|
||||
All of these callers expect YY_FATAL_ERROR() to actually be fatal, and
|
||||
the things they do if it returns after calling it are wildly unsafe.
|
||||
|
||||
Fixes: CVE-2020-10713
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/script/yylex.l | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/script/yylex.l b/grub-core/script/yylex.l
|
||||
index 7b44c37b7..b7203c823 100644
|
||||
--- a/grub-core/script/yylex.l
|
||||
+++ b/grub-core/script/yylex.l
|
||||
@@ -37,11 +37,11 @@
|
||||
|
||||
/*
|
||||
* As we don't have access to yyscanner, we cannot do much except to
|
||||
- * print the fatal error.
|
||||
+ * print the fatal error and exit.
|
||||
*/
|
||||
#define YY_FATAL_ERROR(msg) \
|
||||
do { \
|
||||
- grub_printf (_("fatal error: %s\n"), _(msg)); \
|
||||
+ grub_fatal (_("fatal error: %s\n"), _(msg));\
|
||||
} while (0)
|
||||
|
||||
#define COPY(str, hint) \
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,128 @@
|
||||
From 782a4580a5e347793443aa8e9152db1bf4a0fff8 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 15 Jun 2020 10:58:42 -0400
|
||||
Subject: [PATCH] safemath: Add some arithmetic primitives that check for
|
||||
overflow
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This adds a new header, include/grub/safemath.h, that includes easy to
|
||||
use wrappers for __builtin_{add,sub,mul}_overflow() declared like:
|
||||
|
||||
bool OP(a, b, res)
|
||||
|
||||
where OP is grub_add, grub_sub or grub_mul. OP() returns true in the
|
||||
case where the operation would overflow and res is not modified.
|
||||
Otherwise, false is returned and the operation is executed.
|
||||
|
||||
These arithmetic primitives require newer compiler versions. So, bump
|
||||
these requirements in the INSTALL file too.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
INSTALL | 22 ++--------------------
|
||||
include/grub/compiler.h | 8 ++++++++
|
||||
include/grub/safemath.h | 37 +++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 47 insertions(+), 20 deletions(-)
|
||||
create mode 100644 include/grub/safemath.h
|
||||
|
||||
diff --git a/INSTALL b/INSTALL
|
||||
index 8acb40902..dcb9b7d7b 100644
|
||||
--- a/INSTALL
|
||||
+++ b/INSTALL
|
||||
@@ -11,27 +11,9 @@ GRUB depends on some software packages installed into your system. If
|
||||
you don't have any of them, please obtain and install them before
|
||||
configuring the GRUB.
|
||||
|
||||
-* GCC 4.1.3 or later
|
||||
- Note: older versions may work but support is limited
|
||||
-
|
||||
- Experimental support for clang 3.3 or later (results in much bigger binaries)
|
||||
+* GCC 5.1.0 or later
|
||||
+ Experimental support for clang 3.8.0 or later (results in much bigger binaries)
|
||||
for i386, x86_64, arm (including thumb), arm64, mips(el), powerpc, sparc64
|
||||
- Note: clang 3.2 or later works for i386 and x86_64 targets but results in
|
||||
- much bigger binaries.
|
||||
- earlier versions not tested
|
||||
- Note: clang 3.2 or later works for arm
|
||||
- earlier versions not tested
|
||||
- Note: clang on arm64 is not supported due to
|
||||
- https://llvm.org/bugs/show_bug.cgi?id=26030
|
||||
- Note: clang 3.3 or later works for mips(el)
|
||||
- earlier versions fail to generate .reginfo and hence gprel relocations
|
||||
- fail.
|
||||
- Note: clang 3.2 or later works for powerpc
|
||||
- earlier versions not tested
|
||||
- Note: clang 3.5 or later works for sparc64
|
||||
- earlier versions return "error: unable to interface with target machine"
|
||||
- Note: clang has no support for ia64 and hence you can't compile GRUB
|
||||
- for ia64 with clang
|
||||
* GNU Make
|
||||
* GNU Bison 2.3 or later
|
||||
* GNU gettext 0.17 or later
|
||||
diff --git a/include/grub/compiler.h b/include/grub/compiler.h
|
||||
index c9e1d7a73..8f3be3ae7 100644
|
||||
--- a/include/grub/compiler.h
|
||||
+++ b/include/grub/compiler.h
|
||||
@@ -48,4 +48,12 @@
|
||||
# define WARN_UNUSED_RESULT
|
||||
#endif
|
||||
|
||||
+#if defined(__clang__) && defined(__clang_major__) && defined(__clang_minor__)
|
||||
+# define CLANG_PREREQ(maj,min) \
|
||||
+ ((__clang_major__ > (maj)) || \
|
||||
+ (__clang_major__ == (maj) && __clang_minor__ >= (min)))
|
||||
+#else
|
||||
+# define CLANG_PREREQ(maj,min) 0
|
||||
+#endif
|
||||
+
|
||||
#endif /* ! GRUB_COMPILER_HEADER */
|
||||
diff --git a/include/grub/safemath.h b/include/grub/safemath.h
|
||||
new file mode 100644
|
||||
index 000000000..c17b89bba
|
||||
--- /dev/null
|
||||
+++ b/include/grub/safemath.h
|
||||
@@ -0,0 +1,37 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2020 Free Software Foundation, Inc.
|
||||
+ *
|
||||
+ * GRUB is free software: you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation, either version 3 of the License, or
|
||||
+ * (at your option) any later version.
|
||||
+ *
|
||||
+ * GRUB is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+ * Arithmetic operations that protect against overflow.
|
||||
+ */
|
||||
+
|
||||
+#ifndef GRUB_SAFEMATH_H
|
||||
+#define GRUB_SAFEMATH_H 1
|
||||
+
|
||||
+#include <grub/compiler.h>
|
||||
+
|
||||
+/* These appear in gcc 5.1 and clang 3.8. */
|
||||
+#if GNUC_PREREQ(5, 1) || CLANG_PREREQ(3, 8)
|
||||
+
|
||||
+#define grub_add(a, b, res) __builtin_add_overflow(a, b, res)
|
||||
+#define grub_sub(a, b, res) __builtin_sub_overflow(a, b, res)
|
||||
+#define grub_mul(a, b, res) __builtin_mul_overflow(a, b, res)
|
||||
+
|
||||
+#else
|
||||
+#error gcc 5.1 or newer or clang 3.8 or newer is required
|
||||
+#endif
|
||||
+
|
||||
+#endif /* GRUB_SAFEMATH_H */
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,246 @@
|
||||
From 5775eb40862b67468ced816e6d7560dbe22a3670 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 15 Jun 2020 12:15:29 -0400
|
||||
Subject: [PATCH] calloc: Make sure we always have an overflow-checking
|
||||
calloc() available
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This tries to make sure that everywhere in this source tree, we always have
|
||||
an appropriate version of calloc() (i.e. grub_calloc(), xcalloc(), etc.)
|
||||
available, and that they all safely check for overflow and return NULL when
|
||||
it would occur.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/emu/misc.c | 12 +++++++++
|
||||
grub-core/kern/emu/mm.c | 10 ++++++++
|
||||
grub-core/kern/mm.c | 40 ++++++++++++++++++++++++++++++
|
||||
grub-core/lib/libgcrypt_wrap/mem.c | 11 ++++++--
|
||||
grub-core/lib/posix_wrap/stdlib.h | 8 +++++-
|
||||
include/grub/emu/misc.h | 1 +
|
||||
include/grub/mm.h | 6 +++++
|
||||
7 files changed, 85 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
|
||||
index 65db79baa..dfd8a8ec4 100644
|
||||
--- a/grub-core/kern/emu/misc.c
|
||||
+++ b/grub-core/kern/emu/misc.c
|
||||
@@ -85,6 +85,18 @@ grub_util_error (const char *fmt, ...)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
+void *
|
||||
+xcalloc (grub_size_t nmemb, grub_size_t size)
|
||||
+{
|
||||
+ void *p;
|
||||
+
|
||||
+ p = calloc (nmemb, size);
|
||||
+ if (!p)
|
||||
+ grub_util_error ("%s", _("out of memory"));
|
||||
+
|
||||
+ return p;
|
||||
+}
|
||||
+
|
||||
void *
|
||||
xmalloc (grub_size_t size)
|
||||
{
|
||||
diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c
|
||||
index f262e95e3..145b01d37 100644
|
||||
--- a/grub-core/kern/emu/mm.c
|
||||
+++ b/grub-core/kern/emu/mm.c
|
||||
@@ -25,6 +25,16 @@
|
||||
#include <string.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
+void *
|
||||
+grub_calloc (grub_size_t nmemb, grub_size_t size)
|
||||
+{
|
||||
+ void *ret;
|
||||
+ ret = calloc (nmemb, size);
|
||||
+ if (!ret)
|
||||
+ grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
void *
|
||||
grub_malloc (grub_size_t size)
|
||||
{
|
||||
diff --git a/grub-core/kern/mm.c b/grub-core/kern/mm.c
|
||||
index ee88ff611..f2822a836 100644
|
||||
--- a/grub-core/kern/mm.c
|
||||
+++ b/grub-core/kern/mm.c
|
||||
@@ -67,8 +67,10 @@
|
||||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/mm_private.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
#ifdef MM_DEBUG
|
||||
+# undef grub_calloc
|
||||
# undef grub_malloc
|
||||
# undef grub_zalloc
|
||||
# undef grub_realloc
|
||||
@@ -375,6 +377,30 @@ grub_memalign (grub_size_t align, grub_size_t size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Allocate NMEMB instances of SIZE bytes and return the pointer, or error on
|
||||
+ * integer overflow.
|
||||
+ */
|
||||
+void *
|
||||
+grub_calloc (grub_size_t nmemb, grub_size_t size)
|
||||
+{
|
||||
+ void *ret;
|
||||
+ grub_size_t sz = 0;
|
||||
+
|
||||
+ if (grub_mul (nmemb, size, &sz))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ ret = grub_memalign (0, sz);
|
||||
+ if (!ret)
|
||||
+ return NULL;
|
||||
+
|
||||
+ grub_memset (ret, 0, sz);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
/* Allocate SIZE bytes and return the pointer. */
|
||||
void *
|
||||
grub_malloc (grub_size_t size)
|
||||
@@ -561,6 +587,20 @@ grub_mm_dump (unsigned lineno)
|
||||
grub_printf ("\n");
|
||||
}
|
||||
|
||||
+void *
|
||||
+grub_debug_calloc (const char *file, int line, grub_size_t nmemb, grub_size_t size)
|
||||
+{
|
||||
+ void *ptr;
|
||||
+
|
||||
+ if (grub_mm_debug)
|
||||
+ grub_printf ("%s:%d: calloc (0x%" PRIxGRUB_SIZE ", 0x%" PRIxGRUB_SIZE ") = ",
|
||||
+ file, line, size);
|
||||
+ ptr = grub_calloc (nmemb, size);
|
||||
+ if (grub_mm_debug)
|
||||
+ grub_printf ("%p\n", ptr);
|
||||
+ return ptr;
|
||||
+}
|
||||
+
|
||||
void *
|
||||
grub_debug_malloc (const char *file, int line, grub_size_t size)
|
||||
{
|
||||
diff --git a/grub-core/lib/libgcrypt_wrap/mem.c b/grub-core/lib/libgcrypt_wrap/mem.c
|
||||
index beeb661a3..74c6eafe5 100644
|
||||
--- a/grub-core/lib/libgcrypt_wrap/mem.c
|
||||
+++ b/grub-core/lib/libgcrypt_wrap/mem.c
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/env.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -36,7 +37,10 @@ void *
|
||||
gcry_xcalloc (size_t n, size_t m)
|
||||
{
|
||||
void *ret;
|
||||
- ret = grub_zalloc (n * m);
|
||||
+ size_t sz;
|
||||
+ if (grub_mul (n, m, &sz))
|
||||
+ grub_fatal ("gcry_xcalloc would overflow");
|
||||
+ ret = grub_zalloc (sz);
|
||||
if (!ret)
|
||||
grub_fatal ("gcry_xcalloc failed");
|
||||
return ret;
|
||||
@@ -56,7 +60,10 @@ void *
|
||||
gcry_xcalloc_secure (size_t n, size_t m)
|
||||
{
|
||||
void *ret;
|
||||
- ret = grub_zalloc (n * m);
|
||||
+ size_t sz;
|
||||
+ if (grub_mul (n, m, &sz))
|
||||
+ grub_fatal ("gcry_xcalloc would overflow");
|
||||
+ ret = grub_zalloc (sz);
|
||||
if (!ret)
|
||||
grub_fatal ("gcry_xcalloc failed");
|
||||
return ret;
|
||||
diff --git a/grub-core/lib/posix_wrap/stdlib.h b/grub-core/lib/posix_wrap/stdlib.h
|
||||
index 3b46f47ff..7a8d385e9 100644
|
||||
--- a/grub-core/lib/posix_wrap/stdlib.h
|
||||
+++ b/grub-core/lib/posix_wrap/stdlib.h
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
static inline void
|
||||
free (void *ptr)
|
||||
@@ -37,7 +38,12 @@ malloc (grub_size_t size)
|
||||
static inline void *
|
||||
calloc (grub_size_t size, grub_size_t nelem)
|
||||
{
|
||||
- return grub_zalloc (size * nelem);
|
||||
+ grub_size_t sz;
|
||||
+
|
||||
+ if (grub_mul (size, nelem, &sz))
|
||||
+ return NULL;
|
||||
+
|
||||
+ return grub_zalloc (sz);
|
||||
}
|
||||
|
||||
static inline void *
|
||||
diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
|
||||
index ce464cfd0..ff9c48a64 100644
|
||||
--- a/include/grub/emu/misc.h
|
||||
+++ b/include/grub/emu/misc.h
|
||||
@@ -47,6 +47,7 @@ grub_util_device_is_mapped (const char *dev);
|
||||
#define GRUB_HOST_PRIuLONG_LONG "llu"
|
||||
#define GRUB_HOST_PRIxLONG_LONG "llx"
|
||||
|
||||
+void * EXPORT_FUNC(xcalloc) (grub_size_t nmemb, grub_size_t size) WARN_UNUSED_RESULT;
|
||||
void * EXPORT_FUNC(xmalloc) (grub_size_t size) WARN_UNUSED_RESULT;
|
||||
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size) WARN_UNUSED_RESULT;
|
||||
char * EXPORT_FUNC(xstrdup) (const char *str) WARN_UNUSED_RESULT;
|
||||
diff --git a/include/grub/mm.h b/include/grub/mm.h
|
||||
index 28e2e53eb..9c38dd3ca 100644
|
||||
--- a/include/grub/mm.h
|
||||
+++ b/include/grub/mm.h
|
||||
@@ -29,6 +29,7 @@
|
||||
#endif
|
||||
|
||||
void grub_mm_init_region (void *addr, grub_size_t size);
|
||||
+void *EXPORT_FUNC(grub_calloc) (grub_size_t nmemb, grub_size_t size);
|
||||
void *EXPORT_FUNC(grub_malloc) (grub_size_t size);
|
||||
void *EXPORT_FUNC(grub_zalloc) (grub_size_t size);
|
||||
void EXPORT_FUNC(grub_free) (void *ptr);
|
||||
@@ -48,6 +49,9 @@ extern int EXPORT_VAR(grub_mm_debug);
|
||||
void grub_mm_dump_free (void);
|
||||
void grub_mm_dump (unsigned lineno);
|
||||
|
||||
+#define grub_calloc(nmemb, size) \
|
||||
+ grub_debug_calloc (GRUB_FILE, __LINE__, nmemb, size)
|
||||
+
|
||||
#define grub_malloc(size) \
|
||||
grub_debug_malloc (GRUB_FILE, __LINE__, size)
|
||||
|
||||
@@ -63,6 +67,8 @@ void grub_mm_dump (unsigned lineno);
|
||||
#define grub_free(ptr) \
|
||||
grub_debug_free (GRUB_FILE, __LINE__, ptr)
|
||||
|
||||
+void *EXPORT_FUNC(grub_debug_calloc) (const char *file, int line,
|
||||
+ grub_size_t nmemb, grub_size_t size);
|
||||
void *EXPORT_FUNC(grub_debug_malloc) (const char *file, int line,
|
||||
grub_size_t size);
|
||||
void *EXPORT_FUNC(grub_debug_zalloc) (const char *file, int line,
|
||||
--
|
||||
2.26.2
|
||||
|
1840
buildroot/boot/grub2/0005-calloc-Use-calloc-at-most-places.patch
Normal file
1840
buildroot/boot/grub2/0005-calloc-Use-calloc-at-most-places.patch
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,72 @@
|
||||
From e0dd17a3ce79c6622dc78c96e1f2ef1b20e2bf7b Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Sat, 4 Jul 2020 12:25:09 -0400
|
||||
Subject: [PATCH] iso9660: Don't leak memory on realloc() failures
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/iso9660.c | 24 ++++++++++++++++++++----
|
||||
1 file changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/iso9660.c b/grub-core/fs/iso9660.c
|
||||
index 7ba5b300b..5ec4433b8 100644
|
||||
--- a/grub-core/fs/iso9660.c
|
||||
+++ b/grub-core/fs/iso9660.c
|
||||
@@ -533,14 +533,20 @@ add_part (struct iterate_dir_ctx *ctx,
|
||||
{
|
||||
int size = ctx->symlink ? grub_strlen (ctx->symlink) : 0;
|
||||
grub_size_t sz;
|
||||
+ char *new;
|
||||
|
||||
if (grub_add (size, len2, &sz) ||
|
||||
grub_add (sz, 1, &sz))
|
||||
return;
|
||||
|
||||
- ctx->symlink = grub_realloc (ctx->symlink, sz);
|
||||
- if (! ctx->symlink)
|
||||
- return;
|
||||
+ new = grub_realloc (ctx->symlink, sz);
|
||||
+ if (!new)
|
||||
+ {
|
||||
+ grub_free (ctx->symlink);
|
||||
+ ctx->symlink = NULL;
|
||||
+ return;
|
||||
+ }
|
||||
+ ctx->symlink = new;
|
||||
|
||||
grub_memcpy (ctx->symlink + size, part, len2);
|
||||
ctx->symlink[size + len2] = 0;
|
||||
@@ -634,7 +640,12 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry,
|
||||
is the length. Both are part of the `Component
|
||||
Record'. */
|
||||
if (ctx->symlink && !ctx->was_continue)
|
||||
- add_part (ctx, "/", 1);
|
||||
+ {
|
||||
+ add_part (ctx, "/", 1);
|
||||
+ if (grub_errno)
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+
|
||||
add_part (ctx, (char *) &entry->data[pos + 2],
|
||||
entry->data[pos + 1]);
|
||||
ctx->was_continue = (entry->data[pos] & 1);
|
||||
@@ -653,6 +664,11 @@ susp_iterate_dir (struct grub_iso9660_susp_entry *entry,
|
||||
add_part (ctx, "/", 1);
|
||||
break;
|
||||
}
|
||||
+
|
||||
+ /* Check if grub_realloc() failed in add_part(). */
|
||||
+ if (grub_errno)
|
||||
+ return grub_errno;
|
||||
+
|
||||
/* In pos + 1 the length of the `Component Record' is
|
||||
stored. */
|
||||
pos += entry->data[pos + 1] + 2;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,41 @@
|
||||
From 73bc7a964c9496d5b0f00dbd69959dacf5adcebe Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Date: Tue, 7 Jul 2020 15:36:26 +0200
|
||||
Subject: [PATCH] font: Do not load more than one NAME section
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The GRUB font file can have one NAME section only. Though if somebody
|
||||
crafts a broken font file with many NAME sections and loads it then the
|
||||
GRUB leaks memory. So, prevent against that by loading first NAME
|
||||
section and failing in controlled way on following one.
|
||||
|
||||
Reported-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Reviewed-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/font/font.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/grub-core/font/font.c b/grub-core/font/font.c
|
||||
index 5edb477ac..d09bb38d8 100644
|
||||
--- a/grub-core/font/font.c
|
||||
+++ b/grub-core/font/font.c
|
||||
@@ -532,6 +532,12 @@ grub_font_load (const char *filename)
|
||||
if (grub_memcmp (section.name, FONT_FORMAT_SECTION_NAMES_FONT_NAME,
|
||||
sizeof (FONT_FORMAT_SECTION_NAMES_FONT_NAME) - 1) == 0)
|
||||
{
|
||||
+ if (font->name != NULL)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_BAD_FONT, "invalid font file: too many NAME sections");
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
font->name = read_section_as_string (§ion);
|
||||
if (!font->name)
|
||||
goto fail;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,39 @@
|
||||
From 9ff609f0e7798bc5fb04f791131c98e7693bdd9b Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Wed, 8 Jul 2020 20:41:56 +0000
|
||||
Subject: [PATCH] gfxmenu: Fix double free in load_image()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
self->bitmap should be zeroed after free. Otherwise, there is a chance
|
||||
to double free (USE_AFTER_FREE) it later in rescale_image().
|
||||
|
||||
Fixes: CID 292472
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/gfxmenu/gui_image.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/gfxmenu/gui_image.c b/grub-core/gfxmenu/gui_image.c
|
||||
index 29784ed2d..6b2e976f1 100644
|
||||
--- a/grub-core/gfxmenu/gui_image.c
|
||||
+++ b/grub-core/gfxmenu/gui_image.c
|
||||
@@ -195,7 +195,10 @@ load_image (grub_gui_image_t self, const char *path)
|
||||
return grub_errno;
|
||||
|
||||
if (self->bitmap && (self->bitmap != self->raw_bitmap))
|
||||
- grub_video_bitmap_destroy (self->bitmap);
|
||||
+ {
|
||||
+ grub_video_bitmap_destroy (self->bitmap);
|
||||
+ self->bitmap = 0;
|
||||
+ }
|
||||
if (self->raw_bitmap)
|
||||
grub_video_bitmap_destroy (self->raw_bitmap);
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,58 @@
|
||||
From dc9777dc17697b196c415c53187a55861d41fd2a Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Wed, 8 Jul 2020 21:30:43 +0000
|
||||
Subject: [PATCH] xnu: Fix double free in grub_xnu_devprop_add_property()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
grub_xnu_devprop_add_property() should not free utf8 and utf16 as it get
|
||||
allocated and freed in the caller.
|
||||
|
||||
Minor improvement: do prop fields initialization after memory allocations.
|
||||
|
||||
Fixes: CID 292442, CID 292457, CID 292460, CID 292466
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/i386/xnu.c | 17 ++++++++---------
|
||||
1 file changed, 8 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c
|
||||
index b7d176b5d..e9e119259 100644
|
||||
--- a/grub-core/loader/i386/xnu.c
|
||||
+++ b/grub-core/loader/i386/xnu.c
|
||||
@@ -262,20 +262,19 @@ grub_xnu_devprop_add_property (struct grub_xnu_devprop_device_descriptor *dev,
|
||||
if (!prop)
|
||||
return grub_errno;
|
||||
|
||||
- prop->name = utf8;
|
||||
- prop->name16 = utf16;
|
||||
- prop->name16len = utf16len;
|
||||
-
|
||||
- prop->length = datalen;
|
||||
- prop->data = grub_malloc (prop->length);
|
||||
+ prop->data = grub_malloc (datalen);
|
||||
if (!prop->data)
|
||||
{
|
||||
- grub_free (prop->name);
|
||||
- grub_free (prop->name16);
|
||||
grub_free (prop);
|
||||
return grub_errno;
|
||||
}
|
||||
- grub_memcpy (prop->data, data, prop->length);
|
||||
+ grub_memcpy (prop->data, data, datalen);
|
||||
+
|
||||
+ prop->name = utf8;
|
||||
+ prop->name16 = utf16;
|
||||
+ prop->name16len = utf16len;
|
||||
+ prop->length = datalen;
|
||||
+
|
||||
grub_list_push (GRUB_AS_LIST_P (&dev->properties),
|
||||
GRUB_AS_LIST (prop));
|
||||
return GRUB_ERR_NONE;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,55 @@
|
||||
From 78829f0c230680e386fff9f420bb1631bc20f761 Mon Sep 17 00:00:00 2001
|
||||
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Date: Thu, 9 Jul 2020 03:05:23 +0000
|
||||
Subject: [PATCH] lzma: Make sure we don't dereference past array
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The two dimensional array p->posSlotEncoder[4][64] is being dereferenced
|
||||
using the GetLenToPosState() macro which checks if len is less than 5,
|
||||
and if so subtracts 2 from it. If len = 0, that is 0 - 2 = 4294967294.
|
||||
Obviously we don't want to dereference that far out so we check if the
|
||||
position found is greater or equal kNumLenToPosStates (4) and bail out.
|
||||
|
||||
N.B.: Upstream LZMA 18.05 and later has this function completely rewritten
|
||||
without any history.
|
||||
|
||||
Fixes: CID 51526
|
||||
|
||||
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/LzmaEnc.c | 10 ++++++++--
|
||||
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/lib/LzmaEnc.c b/grub-core/lib/LzmaEnc.c
|
||||
index f2ec04a8c..753e56a95 100644
|
||||
--- a/grub-core/lib/LzmaEnc.c
|
||||
+++ b/grub-core/lib/LzmaEnc.c
|
||||
@@ -1877,13 +1877,19 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, Bool useLimits, UInt32 maxPackSize
|
||||
}
|
||||
else
|
||||
{
|
||||
- UInt32 posSlot;
|
||||
+ UInt32 posSlot, lenToPosState;
|
||||
RangeEnc_EncodeBit(&p->rc, &p->isRep[p->state], 0);
|
||||
p->state = kMatchNextStates[p->state];
|
||||
LenEnc_Encode2(&p->lenEnc, &p->rc, len - LZMA_MATCH_LEN_MIN, posState, !p->fastMode, p->ProbPrices);
|
||||
pos -= LZMA_NUM_REPS;
|
||||
GetPosSlot(pos, posSlot);
|
||||
- RcTree_Encode(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], kNumPosSlotBits, posSlot);
|
||||
+ lenToPosState = GetLenToPosState(len);
|
||||
+ if (lenToPosState >= kNumLenToPosStates)
|
||||
+ {
|
||||
+ p->result = SZ_ERROR_DATA;
|
||||
+ return CheckErrors(p);
|
||||
+ }
|
||||
+ RcTree_Encode(&p->rc, p->posSlotEncoder[lenToPosState], kNumPosSlotBits, posSlot);
|
||||
|
||||
if (posSlot >= kStartPosModelIndex)
|
||||
{
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,69 @@
|
||||
From 8d3b6f9da468f666e3a7976657f2ab5c52762a21 Mon Sep 17 00:00:00 2001
|
||||
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Date: Tue, 7 Jul 2020 15:12:25 -0400
|
||||
Subject: [PATCH] term: Fix overflow on user inputs
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This requires a very weird input from the serial interface but can cause
|
||||
an overflow in input_buf (keys) overwriting the next variable (npending)
|
||||
with the user choice:
|
||||
|
||||
(pahole output)
|
||||
|
||||
struct grub_terminfo_input_state {
|
||||
int input_buf[6]; /* 0 24 */
|
||||
int npending; /* 24 4 */ <- CORRUPT
|
||||
...snip...
|
||||
|
||||
The magic string requires causing this is "ESC,O,],0,1,2,q" and we overflow
|
||||
npending with "q" (aka increase npending to 161). The simplest fix is to
|
||||
just to disallow overwrites input_buf, which exactly what this patch does.
|
||||
|
||||
Fixes: CID 292449
|
||||
|
||||
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/term/terminfo.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/term/terminfo.c b/grub-core/term/terminfo.c
|
||||
index d317efa36..5fa94c0c3 100644
|
||||
--- a/grub-core/term/terminfo.c
|
||||
+++ b/grub-core/term/terminfo.c
|
||||
@@ -398,7 +398,7 @@ grub_terminfo_getwh (struct grub_term_output *term)
|
||||
}
|
||||
|
||||
static void
|
||||
-grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
|
||||
+grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len, int max_len,
|
||||
int (*readkey) (struct grub_term_input *term))
|
||||
{
|
||||
int c;
|
||||
@@ -414,6 +414,9 @@ grub_terminfo_readkey (struct grub_term_input *term, int *keys, int *len,
|
||||
if (c == -1) \
|
||||
return; \
|
||||
\
|
||||
+ if (*len >= max_len) \
|
||||
+ return; \
|
||||
+ \
|
||||
keys[*len] = c; \
|
||||
(*len)++; \
|
||||
}
|
||||
@@ -602,8 +605,8 @@ grub_terminfo_getkey (struct grub_term_input *termi)
|
||||
return ret;
|
||||
}
|
||||
|
||||
- grub_terminfo_readkey (termi, data->input_buf,
|
||||
- &data->npending, data->readkey);
|
||||
+ grub_terminfo_readkey (termi, data->input_buf, &data->npending,
|
||||
+ GRUB_TERMINFO_READKEY_MAX_LEN, data->readkey);
|
||||
|
||||
#if defined(__powerpc__) && defined(GRUB_MACHINE_IEEE1275)
|
||||
if (data->npending == 1 && data->input_buf[0] == GRUB_TERM_ESC
|
||||
--
|
||||
2.26.2
|
||||
|
59
buildroot/boot/grub2/0013-udf-Fix-memory-leak.patch
Normal file
59
buildroot/boot/grub2/0013-udf-Fix-memory-leak.patch
Normal file
@ -0,0 +1,59 @@
|
||||
From 748b691761d31bfff7e9d0d210caa606294c2b52 Mon Sep 17 00:00:00 2001
|
||||
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Date: Tue, 7 Jul 2020 22:02:31 -0400
|
||||
Subject: [PATCH] udf: Fix memory leak
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fixes: CID 73796
|
||||
|
||||
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Reviewed-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/udf.c | 17 +++++++++++++----
|
||||
1 file changed, 13 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/udf.c b/grub-core/fs/udf.c
|
||||
index 21ac7f446..2ac5c1d00 100644
|
||||
--- a/grub-core/fs/udf.c
|
||||
+++ b/grub-core/fs/udf.c
|
||||
@@ -965,8 +965,10 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
||||
return 0;
|
||||
|
||||
if (grub_udf_read_icb (dir->data, &dirent.icb, child))
|
||||
- return 0;
|
||||
-
|
||||
+ {
|
||||
+ grub_free (child);
|
||||
+ return 0;
|
||||
+ }
|
||||
if (dirent.characteristics & GRUB_UDF_FID_CHAR_PARENT)
|
||||
{
|
||||
/* This is the parent directory. */
|
||||
@@ -988,11 +990,18 @@ grub_udf_iterate_dir (grub_fshelp_node_t dir,
|
||||
dirent.file_ident_length,
|
||||
(char *) raw))
|
||||
!= dirent.file_ident_length)
|
||||
- return 0;
|
||||
+ {
|
||||
+ grub_free (child);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
filename = read_string (raw, dirent.file_ident_length, 0);
|
||||
if (!filename)
|
||||
- grub_print_error ();
|
||||
+ {
|
||||
+ /* As the hook won't get called. */
|
||||
+ grub_free (child);
|
||||
+ grub_print_error ();
|
||||
+ }
|
||||
|
||||
if (filename && hook (filename, type, child, hook_data))
|
||||
{
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,38 @@
|
||||
From 49bf3faa106498e151306fc780c63194a14751e3 Mon Sep 17 00:00:00 2001
|
||||
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Date: Fri, 26 Jun 2020 10:51:43 -0400
|
||||
Subject: [PATCH] multiboot2: Fix memory leak if
|
||||
grub_create_loader_cmdline() fails
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Fixes: CID 292468
|
||||
|
||||
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/multiboot_mbi2.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c
|
||||
index 53da78615..0efc66062 100644
|
||||
--- a/grub-core/loader/multiboot_mbi2.c
|
||||
+++ b/grub-core/loader/multiboot_mbi2.c
|
||||
@@ -1070,7 +1070,11 @@ grub_multiboot2_add_module (grub_addr_t start, grub_size_t size,
|
||||
err = grub_create_loader_cmdline (argc, argv, newmod->cmdline,
|
||||
newmod->cmdline_size, GRUB_VERIFY_MODULE_CMDLINE);
|
||||
if (err)
|
||||
- return err;
|
||||
+ {
|
||||
+ grub_free (newmod->cmdline);
|
||||
+ grub_free (newmod);
|
||||
+ return err;
|
||||
+ }
|
||||
|
||||
if (modules_last)
|
||||
modules_last->next = newmod;
|
||||
--
|
||||
2.26.2
|
||||
|
283
buildroot/boot/grub2/0015-tftp-Do-not-use-priority-queue.patch
Normal file
283
buildroot/boot/grub2/0015-tftp-Do-not-use-priority-queue.patch
Normal file
@ -0,0 +1,283 @@
|
||||
From b6c4a1b204740fe52b32e7f530831a59f4038e20 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Thu, 9 Jul 2020 08:10:40 +0000
|
||||
Subject: [PATCH] tftp: Do not use priority queue
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
There is not need to reassemble the order of blocks. Per RFC 1350,
|
||||
server must wait for the ACK, before sending next block. Data packets
|
||||
can be served immediately without putting them to priority queue.
|
||||
|
||||
Logic to handle incoming packet is this:
|
||||
- if packet block id equal to expected block id, then
|
||||
process the packet,
|
||||
- if packet block id is less than expected - this is retransmit
|
||||
of old packet, then ACK it and drop the packet,
|
||||
- if packet block id is more than expected - that shouldn't
|
||||
happen, just drop the packet.
|
||||
|
||||
It makes the tftp receive path code simpler, smaller and faster.
|
||||
As a benefit, this change fixes CID# 73624 and CID# 96690, caused
|
||||
by following while loop:
|
||||
|
||||
while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0)
|
||||
|
||||
where tftph pointer is not moving from one iteration to another, causing
|
||||
to serve same packet again. Luckily, double serving didn't happen due to
|
||||
data->block++ during the first iteration.
|
||||
|
||||
Fixes: CID 73624, CID 96690
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/net/tftp.c | 168 ++++++++++++++-----------------------------
|
||||
1 file changed, 53 insertions(+), 115 deletions(-)
|
||||
|
||||
diff --git a/grub-core/net/tftp.c b/grub-core/net/tftp.c
|
||||
index 7d90bf66e..b4297bc8d 100644
|
||||
--- a/grub-core/net/tftp.c
|
||||
+++ b/grub-core/net/tftp.c
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <grub/mm.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/file.h>
|
||||
-#include <grub/priority_queue.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
@@ -106,31 +105,8 @@ typedef struct tftp_data
|
||||
int have_oack;
|
||||
struct grub_error_saved save_err;
|
||||
grub_net_udp_socket_t sock;
|
||||
- grub_priority_queue_t pq;
|
||||
} *tftp_data_t;
|
||||
|
||||
-static int
|
||||
-cmp_block (grub_uint16_t a, grub_uint16_t b)
|
||||
-{
|
||||
- grub_int16_t i = (grub_int16_t) (a - b);
|
||||
- if (i > 0)
|
||||
- return +1;
|
||||
- if (i < 0)
|
||||
- return -1;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
-cmp (const void *a__, const void *b__)
|
||||
-{
|
||||
- struct grub_net_buff *a_ = *(struct grub_net_buff **) a__;
|
||||
- struct grub_net_buff *b_ = *(struct grub_net_buff **) b__;
|
||||
- struct tftphdr *a = (struct tftphdr *) a_->data;
|
||||
- struct tftphdr *b = (struct tftphdr *) b_->data;
|
||||
- /* We want the first elements to be on top. */
|
||||
- return -cmp_block (grub_be_to_cpu16 (a->u.data.block), grub_be_to_cpu16 (b->u.data.block));
|
||||
-}
|
||||
-
|
||||
static grub_err_t
|
||||
ack (tftp_data_t data, grub_uint64_t block)
|
||||
{
|
||||
@@ -207,73 +183,60 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
- err = grub_priority_queue_push (data->pq, &nb);
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- {
|
||||
- struct grub_net_buff **nb_top_p, *nb_top;
|
||||
- while (1)
|
||||
- {
|
||||
- nb_top_p = grub_priority_queue_top (data->pq);
|
||||
- if (!nb_top_p)
|
||||
- return GRUB_ERR_NONE;
|
||||
- nb_top = *nb_top_p;
|
||||
- tftph = (struct tftphdr *) nb_top->data;
|
||||
- if (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) >= 0)
|
||||
- break;
|
||||
- ack (data, grub_be_to_cpu16 (tftph->u.data.block));
|
||||
- grub_netbuff_free (nb_top);
|
||||
- grub_priority_queue_pop (data->pq);
|
||||
- }
|
||||
- while (cmp_block (grub_be_to_cpu16 (tftph->u.data.block), data->block + 1) == 0)
|
||||
- {
|
||||
- unsigned size;
|
||||
-
|
||||
- grub_priority_queue_pop (data->pq);
|
||||
-
|
||||
- if (file->device->net->packs.count < 50)
|
||||
+ /* Ack old/retransmitted block. */
|
||||
+ if (grub_be_to_cpu16 (tftph->u.data.block) < data->block + 1)
|
||||
+ ack (data, grub_be_to_cpu16 (tftph->u.data.block));
|
||||
+ /* Ignore unexpected block. */
|
||||
+ else if (grub_be_to_cpu16 (tftph->u.data.block) > data->block + 1)
|
||||
+ grub_dprintf ("tftp", "TFTP unexpected block # %d\n", tftph->u.data.block);
|
||||
+ else
|
||||
+ {
|
||||
+ unsigned size;
|
||||
+
|
||||
+ if (file->device->net->packs.count < 50)
|
||||
+ {
|
||||
err = ack (data, data->block + 1);
|
||||
- else
|
||||
- {
|
||||
- file->device->net->stall = 1;
|
||||
- err = 0;
|
||||
- }
|
||||
- if (err)
|
||||
- return err;
|
||||
-
|
||||
- err = grub_netbuff_pull (nb_top, sizeof (tftph->opcode) +
|
||||
- sizeof (tftph->u.data.block));
|
||||
- if (err)
|
||||
- return err;
|
||||
- size = nb_top->tail - nb_top->data;
|
||||
-
|
||||
- data->block++;
|
||||
- if (size < data->block_size)
|
||||
- {
|
||||
- if (data->ack_sent < data->block)
|
||||
- ack (data, data->block);
|
||||
- file->device->net->eof = 1;
|
||||
- file->device->net->stall = 1;
|
||||
- grub_net_udp_close (data->sock);
|
||||
- data->sock = NULL;
|
||||
- }
|
||||
- /* Prevent garbage in broken cards. Is it still necessary
|
||||
- given that IP implementation has been fixed?
|
||||
- */
|
||||
- if (size > data->block_size)
|
||||
- {
|
||||
- err = grub_netbuff_unput (nb_top, size - data->block_size);
|
||||
- if (err)
|
||||
- return err;
|
||||
- }
|
||||
- /* If there is data, puts packet in socket list. */
|
||||
- if ((nb_top->tail - nb_top->data) > 0)
|
||||
- grub_net_put_packet (&file->device->net->packs, nb_top);
|
||||
- else
|
||||
- grub_netbuff_free (nb_top);
|
||||
- }
|
||||
- }
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ }
|
||||
+ else
|
||||
+ file->device->net->stall = 1;
|
||||
+
|
||||
+ err = grub_netbuff_pull (nb, sizeof (tftph->opcode) +
|
||||
+ sizeof (tftph->u.data.block));
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ size = nb->tail - nb->data;
|
||||
+
|
||||
+ data->block++;
|
||||
+ if (size < data->block_size)
|
||||
+ {
|
||||
+ if (data->ack_sent < data->block)
|
||||
+ ack (data, data->block);
|
||||
+ file->device->net->eof = 1;
|
||||
+ file->device->net->stall = 1;
|
||||
+ grub_net_udp_close (data->sock);
|
||||
+ data->sock = NULL;
|
||||
+ }
|
||||
+ /*
|
||||
+ * Prevent garbage in broken cards. Is it still necessary
|
||||
+ * given that IP implementation has been fixed?
|
||||
+ */
|
||||
+ if (size > data->block_size)
|
||||
+ {
|
||||
+ err = grub_netbuff_unput (nb, size - data->block_size);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+ }
|
||||
+ /* If there is data, puts packet in socket list. */
|
||||
+ if ((nb->tail - nb->data) > 0)
|
||||
+ {
|
||||
+ grub_net_put_packet (&file->device->net->packs, nb);
|
||||
+ /* Do not free nb. */
|
||||
+ return GRUB_ERR_NONE;
|
||||
+ }
|
||||
+ }
|
||||
+ grub_netbuff_free (nb);
|
||||
return GRUB_ERR_NONE;
|
||||
case TFTP_ERROR:
|
||||
data->have_oack = 1;
|
||||
@@ -287,19 +250,6 @@ tftp_receive (grub_net_udp_socket_t sock __attribute__ ((unused)),
|
||||
}
|
||||
}
|
||||
|
||||
-static void
|
||||
-destroy_pq (tftp_data_t data)
|
||||
-{
|
||||
- struct grub_net_buff **nb_p;
|
||||
- while ((nb_p = grub_priority_queue_top (data->pq)))
|
||||
- {
|
||||
- grub_netbuff_free (*nb_p);
|
||||
- grub_priority_queue_pop (data->pq);
|
||||
- }
|
||||
-
|
||||
- grub_priority_queue_destroy (data->pq);
|
||||
-}
|
||||
-
|
||||
static grub_err_t
|
||||
tftp_open (struct grub_file *file, const char *filename)
|
||||
{
|
||||
@@ -372,17 +322,9 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
file->not_easily_seekable = 1;
|
||||
file->data = data;
|
||||
|
||||
- data->pq = grub_priority_queue_new (sizeof (struct grub_net_buff *), cmp);
|
||||
- if (!data->pq)
|
||||
- {
|
||||
- grub_free (data);
|
||||
- return grub_errno;
|
||||
- }
|
||||
-
|
||||
err = grub_net_resolve_address (file->device->net->server, &addr);
|
||||
if (err)
|
||||
{
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return err;
|
||||
}
|
||||
@@ -392,7 +334,6 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
file);
|
||||
if (!data->sock)
|
||||
{
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return grub_errno;
|
||||
}
|
||||
@@ -406,7 +347,6 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
if (err)
|
||||
{
|
||||
grub_net_udp_close (data->sock);
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return err;
|
||||
}
|
||||
@@ -423,7 +363,6 @@ tftp_open (struct grub_file *file, const char *filename)
|
||||
if (grub_errno)
|
||||
{
|
||||
grub_net_udp_close (data->sock);
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return grub_errno;
|
||||
}
|
||||
@@ -466,7 +405,6 @@ tftp_close (struct grub_file *file)
|
||||
grub_print_error ();
|
||||
grub_net_udp_close (data->sock);
|
||||
}
|
||||
- destroy_pq (data);
|
||||
grub_free (data);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,153 @@
|
||||
From 1c7b619c84f229c1602c1958bcd054b6d9937562 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Wed, 15 Jul 2020 06:42:37 +0000
|
||||
Subject: [PATCH] relocator: Protect grub_relocator_alloc_chunk_addr()
|
||||
input args against integer underflow/overflow
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Use arithmetic macros from safemath.h to accomplish it. In this commit,
|
||||
I didn't want to be too paranoid to check every possible math equation
|
||||
for overflow/underflow. Only obvious places (with non zero chance of
|
||||
overflow/underflow) were refactored.
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/i386/linux.c | 9 +++++++--
|
||||
grub-core/loader/i386/pc/linux.c | 9 +++++++--
|
||||
grub-core/loader/i386/xen.c | 12 ++++++++++--
|
||||
grub-core/loader/xnu.c | 11 +++++++----
|
||||
4 files changed, 31 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
|
||||
index d0501e229..02a73463a 100644
|
||||
--- a/grub-core/loader/i386/linux.c
|
||||
+++ b/grub-core/loader/i386/linux.c
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <grub/lib/cmdline.h>
|
||||
#include <grub/linux.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -547,9 +548,13 @@ grub_linux_boot (void)
|
||||
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
+ grub_size_t sz;
|
||||
+
|
||||
+ if (grub_add (ctx.real_size, efi_mmap_size, &sz))
|
||||
+ return GRUB_ERR_OUT_OF_RANGE;
|
||||
+
|
||||
err = grub_relocator_alloc_chunk_addr (relocator, &ch,
|
||||
- ctx.real_mode_target,
|
||||
- (ctx.real_size + efi_mmap_size));
|
||||
+ ctx.real_mode_target, sz);
|
||||
if (err)
|
||||
return err;
|
||||
real_mode_mem = get_virtual_current_address (ch);
|
||||
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
|
||||
index 47ea2945e..31f09922b 100644
|
||||
--- a/grub-core/loader/i386/pc/linux.c
|
||||
+++ b/grub-core/loader/i386/pc/linux.c
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <grub/i386/floppy.h>
|
||||
#include <grub/lib/cmdline.h>
|
||||
#include <grub/linux.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -218,8 +219,12 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
setup_sects = GRUB_LINUX_DEFAULT_SETUP_SECTS;
|
||||
|
||||
real_size = setup_sects << GRUB_DISK_SECTOR_BITS;
|
||||
- grub_linux16_prot_size = grub_file_size (file)
|
||||
- - real_size - GRUB_DISK_SECTOR_SIZE;
|
||||
+ if (grub_sub (grub_file_size (file), real_size, &grub_linux16_prot_size) ||
|
||||
+ grub_sub (grub_linux16_prot_size, GRUB_DISK_SECTOR_SIZE, &grub_linux16_prot_size))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
+ goto fail;
|
||||
+ }
|
||||
|
||||
if (! grub_linux_is_bzimage
|
||||
&& GRUB_LINUX_ZIMAGE_ADDR + grub_linux16_prot_size
|
||||
diff --git a/grub-core/loader/i386/xen.c b/grub-core/loader/i386/xen.c
|
||||
index 8f662c8ac..cd24874ca 100644
|
||||
--- a/grub-core/loader/i386/xen.c
|
||||
+++ b/grub-core/loader/i386/xen.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <grub/linux.h>
|
||||
#include <grub/i386/memory.h>
|
||||
#include <grub/verify.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -636,6 +637,7 @@ grub_cmd_xen (grub_command_t cmd __attribute__ ((unused)),
|
||||
grub_relocator_chunk_t ch;
|
||||
grub_addr_t kern_start;
|
||||
grub_addr_t kern_end;
|
||||
+ grub_size_t sz;
|
||||
|
||||
if (argc == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
@@ -703,8 +705,14 @@ grub_cmd_xen (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
xen_state.max_addr = ALIGN_UP (kern_end, PAGE_SIZE);
|
||||
|
||||
- err = grub_relocator_alloc_chunk_addr (xen_state.relocator, &ch, kern_start,
|
||||
- kern_end - kern_start);
|
||||
+
|
||||
+ if (grub_sub (kern_end, kern_start, &sz))
|
||||
+ {
|
||||
+ err = GRUB_ERR_OUT_OF_RANGE;
|
||||
+ goto fail;
|
||||
+ }
|
||||
+
|
||||
+ err = grub_relocator_alloc_chunk_addr (xen_state.relocator, &ch, kern_start, sz);
|
||||
if (err)
|
||||
goto fail;
|
||||
kern_chunk_src = get_virtual_current_address (ch);
|
||||
diff --git a/grub-core/loader/xnu.c b/grub-core/loader/xnu.c
|
||||
index 77d7060e1..9ae4ceb35 100644
|
||||
--- a/grub-core/loader/xnu.c
|
||||
+++ b/grub-core/loader/xnu.c
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <grub/env.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/verify.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -59,15 +60,17 @@ grub_xnu_heap_malloc (int size, void **src, grub_addr_t *target)
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_relocator_chunk_t ch;
|
||||
+ grub_addr_t tgt;
|
||||
+
|
||||
+ if (grub_add (grub_xnu_heap_target_start, grub_xnu_heap_size, &tgt))
|
||||
+ return GRUB_ERR_OUT_OF_RANGE;
|
||||
|
||||
- err = grub_relocator_alloc_chunk_addr (grub_xnu_relocator, &ch,
|
||||
- grub_xnu_heap_target_start
|
||||
- + grub_xnu_heap_size, size);
|
||||
+ err = grub_relocator_alloc_chunk_addr (grub_xnu_relocator, &ch, tgt, size);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
*src = get_virtual_current_address (ch);
|
||||
- *target = grub_xnu_heap_target_start + grub_xnu_heap_size;
|
||||
+ *target = tgt;
|
||||
grub_xnu_heap_size += size;
|
||||
grub_dprintf ("xnu", "val=%p\n", *src);
|
||||
return GRUB_ERR_NONE;
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,341 @@
|
||||
From 0cfbbca3ccd84d36ffb1bcd6644ada7c73b19fc0 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Wed, 8 Jul 2020 01:44:38 +0000
|
||||
Subject: [PATCH] relocator: Protect grub_relocator_alloc_chunk_align()
|
||||
max_addr against integer underflow
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This commit introduces integer underflow mitigation in max_addr calculation
|
||||
in grub_relocator_alloc_chunk_align() invocation.
|
||||
|
||||
It consists of 2 fixes:
|
||||
1. Introduced grub_relocator_alloc_chunk_align_safe() wrapper function to perform
|
||||
sanity check for min/max and size values, and to make safe invocation of
|
||||
grub_relocator_alloc_chunk_align() with validated max_addr value. Replace all
|
||||
invocations such as grub_relocator_alloc_chunk_align(..., min_addr, max_addr - size, size, ...)
|
||||
by grub_relocator_alloc_chunk_align_safe(..., min_addr, max_addr, size, ...).
|
||||
2. Introduced UP_TO_TOP32(s) macro for the cases where max_addr is 32-bit top
|
||||
address (0xffffffff - size + 1) or similar.
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/i386/relocator.c | 28 ++++++++++----------------
|
||||
grub-core/lib/mips/relocator.c | 6 ++----
|
||||
grub-core/lib/powerpc/relocator.c | 6 ++----
|
||||
grub-core/lib/x86_64/efi/relocator.c | 7 +++----
|
||||
grub-core/loader/i386/linux.c | 5 ++---
|
||||
grub-core/loader/i386/multiboot_mbi.c | 7 +++----
|
||||
grub-core/loader/i386/pc/linux.c | 6 ++----
|
||||
grub-core/loader/mips/linux.c | 9 +++------
|
||||
grub-core/loader/multiboot.c | 2 +-
|
||||
grub-core/loader/multiboot_elfxx.c | 10 ++++-----
|
||||
grub-core/loader/multiboot_mbi2.c | 10 ++++-----
|
||||
grub-core/loader/xnu_resume.c | 2 +-
|
||||
include/grub/relocator.h | 29 +++++++++++++++++++++++++++
|
||||
13 files changed, 69 insertions(+), 58 deletions(-)
|
||||
|
||||
diff --git a/grub-core/lib/i386/relocator.c b/grub-core/lib/i386/relocator.c
|
||||
index 71dd4f0ab..34cbe834f 100644
|
||||
--- a/grub-core/lib/i386/relocator.c
|
||||
+++ b/grub-core/lib/i386/relocator.c
|
||||
@@ -83,11 +83,10 @@ grub_relocator32_boot (struct grub_relocator *rel,
|
||||
/* Specific memory range due to Global Descriptor Table for use by payload
|
||||
that we will store in returned chunk. The address range and preference
|
||||
are based on "THE LINUX/x86 BOOT PROTOCOL" specification. */
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, 0x1000,
|
||||
- 0x9a000 - RELOCATOR_SIZEOF (32),
|
||||
- RELOCATOR_SIZEOF (32), 16,
|
||||
- GRUB_RELOCATOR_PREFERENCE_LOW,
|
||||
- avoid_efi_bootservices);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0x1000, 0x9a000,
|
||||
+ RELOCATOR_SIZEOF (32), 16,
|
||||
+ GRUB_RELOCATOR_PREFERENCE_LOW,
|
||||
+ avoid_efi_bootservices);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -125,13 +124,10 @@ grub_relocator16_boot (struct grub_relocator *rel,
|
||||
grub_relocator_chunk_t ch;
|
||||
|
||||
/* Put it higher than the byte it checks for A20 check. */
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, 0x8010,
|
||||
- 0xa0000 - RELOCATOR_SIZEOF (16)
|
||||
- - GRUB_RELOCATOR16_STACK_SIZE,
|
||||
- RELOCATOR_SIZEOF (16)
|
||||
- + GRUB_RELOCATOR16_STACK_SIZE, 16,
|
||||
- GRUB_RELOCATOR_PREFERENCE_NONE,
|
||||
- 0);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0x8010, 0xa0000,
|
||||
+ RELOCATOR_SIZEOF (16) +
|
||||
+ GRUB_RELOCATOR16_STACK_SIZE, 16,
|
||||
+ GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -183,11 +179,9 @@ grub_relocator64_boot (struct grub_relocator *rel,
|
||||
void *relst;
|
||||
grub_relocator_chunk_t ch;
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, min_addr,
|
||||
- max_addr - RELOCATOR_SIZEOF (64),
|
||||
- RELOCATOR_SIZEOF (64), 16,
|
||||
- GRUB_RELOCATOR_PREFERENCE_NONE,
|
||||
- 0);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, min_addr, max_addr,
|
||||
+ RELOCATOR_SIZEOF (64), 16,
|
||||
+ GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
diff --git a/grub-core/lib/mips/relocator.c b/grub-core/lib/mips/relocator.c
|
||||
index 9d5f49cb9..743b213e6 100644
|
||||
--- a/grub-core/lib/mips/relocator.c
|
||||
+++ b/grub-core/lib/mips/relocator.c
|
||||
@@ -120,10 +120,8 @@ grub_relocator32_boot (struct grub_relocator *rel,
|
||||
unsigned i;
|
||||
grub_addr_t vtarget;
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, 0,
|
||||
- (0xffffffff - stateset_size)
|
||||
- + 1, stateset_size,
|
||||
- sizeof (grub_uint32_t),
|
||||
+ err = grub_relocator_alloc_chunk_align (rel, &ch, 0, UP_TO_TOP32 (stateset_size),
|
||||
+ stateset_size, sizeof (grub_uint32_t),
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
if (err)
|
||||
return err;
|
||||
diff --git a/grub-core/lib/powerpc/relocator.c b/grub-core/lib/powerpc/relocator.c
|
||||
index bdf2b111b..8ffb8b686 100644
|
||||
--- a/grub-core/lib/powerpc/relocator.c
|
||||
+++ b/grub-core/lib/powerpc/relocator.c
|
||||
@@ -115,10 +115,8 @@ grub_relocator32_boot (struct grub_relocator *rel,
|
||||
unsigned i;
|
||||
grub_relocator_chunk_t ch;
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, 0,
|
||||
- (0xffffffff - stateset_size)
|
||||
- + 1, stateset_size,
|
||||
- sizeof (grub_uint32_t),
|
||||
+ err = grub_relocator_alloc_chunk_align (rel, &ch, 0, UP_TO_TOP32 (stateset_size),
|
||||
+ stateset_size, sizeof (grub_uint32_t),
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
if (err)
|
||||
return err;
|
||||
diff --git a/grub-core/lib/x86_64/efi/relocator.c b/grub-core/lib/x86_64/efi/relocator.c
|
||||
index 3caef7a40..7d200a125 100644
|
||||
--- a/grub-core/lib/x86_64/efi/relocator.c
|
||||
+++ b/grub-core/lib/x86_64/efi/relocator.c
|
||||
@@ -50,10 +50,9 @@ grub_relocator64_efi_boot (struct grub_relocator *rel,
|
||||
* 64-bit relocator code may live above 4 GiB quite well.
|
||||
* However, I do not want ask for problems. Just in case.
|
||||
*/
|
||||
- err = grub_relocator_alloc_chunk_align (rel, &ch, 0,
|
||||
- 0x100000000 - RELOCATOR_SIZEOF (64_efi),
|
||||
- RELOCATOR_SIZEOF (64_efi), 16,
|
||||
- GRUB_RELOCATOR_PREFERENCE_NONE, 1);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (rel, &ch, 0, 0x100000000,
|
||||
+ RELOCATOR_SIZEOF (64_efi), 16,
|
||||
+ GRUB_RELOCATOR_PREFERENCE_NONE, 1);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
|
||||
index 02a73463a..efbb99307 100644
|
||||
--- a/grub-core/loader/i386/linux.c
|
||||
+++ b/grub-core/loader/i386/linux.c
|
||||
@@ -181,9 +181,8 @@ allocate_pages (grub_size_t prot_size, grub_size_t *align,
|
||||
for (; err && *align + 1 > min_align; (*align)--)
|
||||
{
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
- err = grub_relocator_alloc_chunk_align (relocator, &ch,
|
||||
- 0x1000000,
|
||||
- 0xffffffff & ~prot_size,
|
||||
+ err = grub_relocator_alloc_chunk_align (relocator, &ch, 0x1000000,
|
||||
+ UP_TO_TOP32 (prot_size),
|
||||
prot_size, 1 << *align,
|
||||
GRUB_RELOCATOR_PREFERENCE_LOW,
|
||||
1);
|
||||
diff --git a/grub-core/loader/i386/multiboot_mbi.c b/grub-core/loader/i386/multiboot_mbi.c
|
||||
index ad3cc292f..a67d9d0a8 100644
|
||||
--- a/grub-core/loader/i386/multiboot_mbi.c
|
||||
+++ b/grub-core/loader/i386/multiboot_mbi.c
|
||||
@@ -466,10 +466,9 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
|
||||
|
||||
bufsize = grub_multiboot_get_mbi_size ();
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (grub_multiboot_relocator, &ch,
|
||||
- 0x10000, 0xa0000 - bufsize,
|
||||
- bufsize, 4,
|
||||
- GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (grub_multiboot_relocator, &ch,
|
||||
+ 0x10000, 0xa0000, bufsize, 4,
|
||||
+ GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
if (err)
|
||||
return err;
|
||||
ptrorig = get_virtual_current_address (ch);
|
||||
diff --git a/grub-core/loader/i386/pc/linux.c b/grub-core/loader/i386/pc/linux.c
|
||||
index 31f09922b..5fed5ffdf 100644
|
||||
--- a/grub-core/loader/i386/pc/linux.c
|
||||
+++ b/grub-core/loader/i386/pc/linux.c
|
||||
@@ -453,10 +453,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
- err = grub_relocator_alloc_chunk_align (relocator, &ch,
|
||||
- addr_min, addr_max - size,
|
||||
- size, 0x1000,
|
||||
- GRUB_RELOCATOR_PREFERENCE_HIGH, 0);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (relocator, &ch, addr_min, addr_max, size,
|
||||
+ 0x1000, GRUB_RELOCATOR_PREFERENCE_HIGH, 0);
|
||||
if (err)
|
||||
return err;
|
||||
initrd_chunk = get_virtual_current_address (ch);
|
||||
diff --git a/grub-core/loader/mips/linux.c b/grub-core/loader/mips/linux.c
|
||||
index 7b723bf18..e4ed95921 100644
|
||||
--- a/grub-core/loader/mips/linux.c
|
||||
+++ b/grub-core/loader/mips/linux.c
|
||||
@@ -442,12 +442,9 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (relocator, &ch,
|
||||
- (target_addr & 0x1fffffff)
|
||||
- + linux_size + 0x10000,
|
||||
- (0x10000000 - size),
|
||||
- size, 0x10000,
|
||||
- GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (relocator, &ch, (target_addr & 0x1fffffff) +
|
||||
+ linux_size + 0x10000, 0x10000000, size,
|
||||
+ 0x10000, GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
|
||||
if (err)
|
||||
goto fail;
|
||||
diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c
|
||||
index 4a98d7082..facb13f3d 100644
|
||||
--- a/grub-core/loader/multiboot.c
|
||||
+++ b/grub-core/loader/multiboot.c
|
||||
@@ -403,7 +403,7 @@ grub_cmd_module (grub_command_t cmd __attribute__ ((unused)),
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch,
|
||||
- lowest_addr, (0xffffffff - size) + 1,
|
||||
+ lowest_addr, UP_TO_TOP32 (size),
|
||||
size, MULTIBOOT_MOD_ALIGN,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE, 1);
|
||||
if (err)
|
||||
diff --git a/grub-core/loader/multiboot_elfxx.c b/grub-core/loader/multiboot_elfxx.c
|
||||
index cc6853692..f2318e0d1 100644
|
||||
--- a/grub-core/loader/multiboot_elfxx.c
|
||||
+++ b/grub-core/loader/multiboot_elfxx.c
|
||||
@@ -109,10 +109,10 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld)
|
||||
if (load_size > mld->max_addr || mld->min_addr > mld->max_addr - load_size)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid min/max address and/or load size");
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch,
|
||||
- mld->min_addr, mld->max_addr - load_size,
|
||||
- load_size, mld->align ? mld->align : 1,
|
||||
- mld->preference, mld->avoid_efi_boot_services);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (GRUB_MULTIBOOT (relocator), &ch,
|
||||
+ mld->min_addr, mld->max_addr,
|
||||
+ load_size, mld->align ? mld->align : 1,
|
||||
+ mld->preference, mld->avoid_efi_boot_services);
|
||||
|
||||
if (err)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ CONCAT(grub_multiboot_load_elf, XX) (mbi_load_data_t *mld)
|
||||
continue;
|
||||
|
||||
err = grub_relocator_alloc_chunk_align (GRUB_MULTIBOOT (relocator), &ch, 0,
|
||||
- (0xffffffff - sh->sh_size) + 1,
|
||||
+ UP_TO_TOP32 (sh->sh_size),
|
||||
sh->sh_size, sh->sh_addralign,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE,
|
||||
mld->avoid_efi_boot_services);
|
||||
diff --git a/grub-core/loader/multiboot_mbi2.c b/grub-core/loader/multiboot_mbi2.c
|
||||
index 0efc66062..03967839c 100644
|
||||
--- a/grub-core/loader/multiboot_mbi2.c
|
||||
+++ b/grub-core/loader/multiboot_mbi2.c
|
||||
@@ -295,10 +295,10 @@ grub_multiboot2_load (grub_file_t file, const char *filename)
|
||||
return grub_error (GRUB_ERR_BAD_OS, "invalid min/max address and/or load size");
|
||||
}
|
||||
|
||||
- err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch,
|
||||
- mld.min_addr, mld.max_addr - code_size,
|
||||
- code_size, mld.align ? mld.align : 1,
|
||||
- mld.preference, keep_bs);
|
||||
+ err = grub_relocator_alloc_chunk_align_safe (grub_multiboot2_relocator, &ch,
|
||||
+ mld.min_addr, mld.max_addr,
|
||||
+ code_size, mld.align ? mld.align : 1,
|
||||
+ mld.preference, keep_bs);
|
||||
}
|
||||
else
|
||||
err = grub_relocator_alloc_chunk_addr (grub_multiboot2_relocator,
|
||||
@@ -708,7 +708,7 @@ grub_multiboot2_make_mbi (grub_uint32_t *target)
|
||||
COMPILE_TIME_ASSERT (MULTIBOOT_TAG_ALIGN % sizeof (grub_properly_aligned_t) == 0);
|
||||
|
||||
err = grub_relocator_alloc_chunk_align (grub_multiboot2_relocator, &ch,
|
||||
- 0, 0xffffffff - bufsize,
|
||||
+ 0, UP_TO_TOP32 (bufsize),
|
||||
bufsize, MULTIBOOT_TAG_ALIGN,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE, 1);
|
||||
if (err)
|
||||
diff --git a/grub-core/loader/xnu_resume.c b/grub-core/loader/xnu_resume.c
|
||||
index 8089804d4..d648ef0cd 100644
|
||||
--- a/grub-core/loader/xnu_resume.c
|
||||
+++ b/grub-core/loader/xnu_resume.c
|
||||
@@ -129,7 +129,7 @@ grub_xnu_resume (char *imagename)
|
||||
{
|
||||
grub_relocator_chunk_t ch;
|
||||
err = grub_relocator_alloc_chunk_align (grub_xnu_relocator, &ch, 0,
|
||||
- (0xffffffff - hibhead.image_size) + 1,
|
||||
+ UP_TO_TOP32 (hibhead.image_size),
|
||||
hibhead.image_size,
|
||||
GRUB_XNU_PAGESIZE,
|
||||
GRUB_RELOCATOR_PREFERENCE_NONE, 0);
|
||||
diff --git a/include/grub/relocator.h b/include/grub/relocator.h
|
||||
index 24d8672d2..1b3bdd92a 100644
|
||||
--- a/include/grub/relocator.h
|
||||
+++ b/include/grub/relocator.h
|
||||
@@ -49,6 +49,35 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel,
|
||||
int preference,
|
||||
int avoid_efi_boot_services);
|
||||
|
||||
+/*
|
||||
+ * Wrapper for grub_relocator_alloc_chunk_align() with purpose of
|
||||
+ * protecting against integer underflow.
|
||||
+ *
|
||||
+ * Compare to its callee, max_addr has different meaning here.
|
||||
+ * It covers entire chunk and not just start address of the chunk.
|
||||
+ */
|
||||
+static inline grub_err_t
|
||||
+grub_relocator_alloc_chunk_align_safe (struct grub_relocator *rel,
|
||||
+ grub_relocator_chunk_t *out,
|
||||
+ grub_phys_addr_t min_addr,
|
||||
+ grub_phys_addr_t max_addr,
|
||||
+ grub_size_t size, grub_size_t align,
|
||||
+ int preference,
|
||||
+ int avoid_efi_boot_services)
|
||||
+{
|
||||
+ /* Sanity check and ensure following equation (max_addr - size) is safe. */
|
||||
+ if (max_addr < size || (max_addr - size) < min_addr)
|
||||
+ return GRUB_ERR_OUT_OF_RANGE;
|
||||
+
|
||||
+ return grub_relocator_alloc_chunk_align (rel, out, min_addr,
|
||||
+ max_addr - size,
|
||||
+ size, align, preference,
|
||||
+ avoid_efi_boot_services);
|
||||
+}
|
||||
+
|
||||
+/* Top 32-bit address minus s bytes and plus 1 byte. */
|
||||
+#define UP_TO_TOP32(s) ((~(s) & 0xffffffff) + 1)
|
||||
+
|
||||
#define GRUB_RELOCATOR_PREFERENCE_NONE 0
|
||||
#define GRUB_RELOCATOR_PREFERENCE_LOW 1
|
||||
#define GRUB_RELOCATOR_PREFERENCE_HIGH 2
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,37 @@
|
||||
From 73aa0776457066ee6ebc93486c3cf0e6b755d1b8 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Coulson <chris.coulson@canonical.com>
|
||||
Date: Fri, 10 Jul 2020 11:21:14 +0100
|
||||
Subject: [PATCH] script: Remove unused fields from grub_script_function
|
||||
struct
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
include/grub/script_sh.h | 5 -----
|
||||
1 file changed, 5 deletions(-)
|
||||
|
||||
diff --git a/include/grub/script_sh.h b/include/grub/script_sh.h
|
||||
index 360c2be1f..b382bcf09 100644
|
||||
--- a/include/grub/script_sh.h
|
||||
+++ b/include/grub/script_sh.h
|
||||
@@ -359,13 +359,8 @@ struct grub_script_function
|
||||
/* The script function. */
|
||||
struct grub_script *func;
|
||||
|
||||
- /* The flags. */
|
||||
- unsigned flags;
|
||||
-
|
||||
/* The next element. */
|
||||
struct grub_script_function *next;
|
||||
-
|
||||
- int references;
|
||||
};
|
||||
typedef struct grub_script_function *grub_script_function_t;
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,113 @@
|
||||
From 26349fcf80982b4d0120b73b2836e88bcf16853c Mon Sep 17 00:00:00 2001
|
||||
From: Chris Coulson <chris.coulson@canonical.com>
|
||||
Date: Fri, 10 Jul 2020 14:41:45 +0100
|
||||
Subject: [PATCH] script: Avoid a use-after-free when redefining a
|
||||
function during execution
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Defining a new function with the same name as a previously defined
|
||||
function causes the grub_script and associated resources for the
|
||||
previous function to be freed. If the previous function is currently
|
||||
executing when a function with the same name is defined, this results
|
||||
in use-after-frees when processing subsequent commands in the original
|
||||
function.
|
||||
|
||||
Instead, reject a new function definition if it has the same name as
|
||||
a previously defined function, and that function is currently being
|
||||
executed. Although a behavioural change, this should be backwards
|
||||
compatible with existing configurations because they can't be
|
||||
dependent on the current behaviour without being broken.
|
||||
|
||||
Fixes: CVE-2020-15706
|
||||
|
||||
Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/script/execute.c | 2 ++
|
||||
grub-core/script/function.c | 16 +++++++++++++---
|
||||
grub-core/script/parser.y | 3 ++-
|
||||
include/grub/script_sh.h | 2 ++
|
||||
4 files changed, 19 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/script/execute.c b/grub-core/script/execute.c
|
||||
index c8d6806fe..7e028e135 100644
|
||||
--- a/grub-core/script/execute.c
|
||||
+++ b/grub-core/script/execute.c
|
||||
@@ -838,7 +838,9 @@ grub_script_function_call (grub_script_function_t func, int argc, char **args)
|
||||
old_scope = scope;
|
||||
scope = &new_scope;
|
||||
|
||||
+ func->executing++;
|
||||
ret = grub_script_execute (func->func);
|
||||
+ func->executing--;
|
||||
|
||||
function_return = 0;
|
||||
active_loops = loops;
|
||||
diff --git a/grub-core/script/function.c b/grub-core/script/function.c
|
||||
index d36655e51..3aad04bf9 100644
|
||||
--- a/grub-core/script/function.c
|
||||
+++ b/grub-core/script/function.c
|
||||
@@ -34,6 +34,7 @@ grub_script_function_create (struct grub_script_arg *functionname_arg,
|
||||
func = (grub_script_function_t) grub_malloc (sizeof (*func));
|
||||
if (! func)
|
||||
return 0;
|
||||
+ func->executing = 0;
|
||||
|
||||
func->name = grub_strdup (functionname_arg->str);
|
||||
if (! func->name)
|
||||
@@ -60,10 +61,19 @@ grub_script_function_create (struct grub_script_arg *functionname_arg,
|
||||
grub_script_function_t q;
|
||||
|
||||
q = *p;
|
||||
- grub_script_free (q->func);
|
||||
- q->func = cmd;
|
||||
grub_free (func);
|
||||
- func = q;
|
||||
+ if (q->executing > 0)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
+ N_("attempt to redefine a function being executed"));
|
||||
+ func = NULL;
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ grub_script_free (q->func);
|
||||
+ q->func = cmd;
|
||||
+ func = q;
|
||||
+ }
|
||||
}
|
||||
else
|
||||
{
|
||||
diff --git a/grub-core/script/parser.y b/grub-core/script/parser.y
|
||||
index 4f0ab8319..f80b86b6f 100644
|
||||
--- a/grub-core/script/parser.y
|
||||
+++ b/grub-core/script/parser.y
|
||||
@@ -289,7 +289,8 @@ function: "function" "name"
|
||||
grub_script_mem_free (state->func_mem);
|
||||
else {
|
||||
script->children = state->scripts;
|
||||
- grub_script_function_create ($2, script);
|
||||
+ if (!grub_script_function_create ($2, script))
|
||||
+ grub_script_free (script);
|
||||
}
|
||||
|
||||
state->scripts = $<scripts>3;
|
||||
diff --git a/include/grub/script_sh.h b/include/grub/script_sh.h
|
||||
index b382bcf09..6c48e0751 100644
|
||||
--- a/include/grub/script_sh.h
|
||||
+++ b/include/grub/script_sh.h
|
||||
@@ -361,6 +361,8 @@ struct grub_script_function
|
||||
|
||||
/* The next element. */
|
||||
struct grub_script_function *next;
|
||||
+
|
||||
+ unsigned executing;
|
||||
};
|
||||
typedef struct grub_script_function *grub_script_function_t;
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,49 @@
|
||||
From 06aa91f79f902752cb7e5d22ac0ea8e13bffd056 Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Fri, 17 Jul 2020 05:17:26 +0000
|
||||
Subject: [PATCH] relocator: Fix grub_relocator_alloc_chunk_align() top
|
||||
memory allocation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Current implementation of grub_relocator_alloc_chunk_align()
|
||||
does not allow allocation of the top byte.
|
||||
|
||||
Assuming input args are:
|
||||
max_addr = 0xfffff000;
|
||||
size = 0x1000;
|
||||
|
||||
And this is valid. But following overflow protection will
|
||||
unnecessarily move max_addr one byte down (to 0xffffefff):
|
||||
if (max_addr > ~size)
|
||||
max_addr = ~size;
|
||||
|
||||
~size + 1 will fix the situation. In addition, check size
|
||||
for non zero to do not zero max_addr.
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/lib/relocator.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/lib/relocator.c b/grub-core/lib/relocator.c
|
||||
index 5847aac36..f2c1944c2 100644
|
||||
--- a/grub-core/lib/relocator.c
|
||||
+++ b/grub-core/lib/relocator.c
|
||||
@@ -1386,8 +1386,8 @@ grub_relocator_alloc_chunk_align (struct grub_relocator *rel,
|
||||
};
|
||||
grub_addr_t min_addr2 = 0, max_addr2;
|
||||
|
||||
- if (max_addr > ~size)
|
||||
- max_addr = ~size;
|
||||
+ if (size && (max_addr > ~size))
|
||||
+ max_addr = ~size + 1;
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
if (min_addr < 0x1000)
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,61 @@
|
||||
From feec993673d8e13fcf22fe2389ac29222b6daebd Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Sun, 19 Jul 2020 14:43:31 -0400
|
||||
Subject: [PATCH] hfsplus: Fix two more overflows
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Both node->size and node->namelen come from the supplied filesystem,
|
||||
which may be user-supplied. We can't trust them for the math unless we
|
||||
know they don't overflow. Making sure they go through grub_add() or
|
||||
grub_calloc() first will give us that.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/fs/hfsplus.c | 11 ++++++++---
|
||||
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/fs/hfsplus.c b/grub-core/fs/hfsplus.c
|
||||
index dae43becc..9c4e4c88c 100644
|
||||
--- a/grub-core/fs/hfsplus.c
|
||||
+++ b/grub-core/fs/hfsplus.c
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <grub/hfs.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/hfsplus.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
@@ -475,8 +476,12 @@ grub_hfsplus_read_symlink (grub_fshelp_node_t node)
|
||||
{
|
||||
char *symlink;
|
||||
grub_ssize_t numread;
|
||||
+ grub_size_t sz = node->size;
|
||||
|
||||
- symlink = grub_malloc (node->size + 1);
|
||||
+ if (grub_add (sz, 1, &sz))
|
||||
+ return NULL;
|
||||
+
|
||||
+ symlink = grub_malloc (sz);
|
||||
if (!symlink)
|
||||
return 0;
|
||||
|
||||
@@ -715,8 +720,8 @@ list_nodes (void *record, void *hook_arg)
|
||||
if (type == GRUB_FSHELP_UNKNOWN)
|
||||
return 0;
|
||||
|
||||
- filename = grub_malloc (grub_be_to_cpu16 (catkey->namelen)
|
||||
- * GRUB_MAX_UTF8_PER_UTF16 + 1);
|
||||
+ filename = grub_calloc (grub_be_to_cpu16 (catkey->namelen),
|
||||
+ GRUB_MAX_UTF8_PER_UTF16 + 1);
|
||||
if (! filename)
|
||||
return 0;
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,116 @@
|
||||
From a1845e90fc19fb5e904091bad8a378f458798e4a Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Sun, 19 Jul 2020 15:48:20 -0400
|
||||
Subject: [PATCH] lvm: Fix two more potential data-dependent alloc
|
||||
overflows
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
It appears to be possible to make a (possibly invalid) lvm PV with
|
||||
a metadata size field that overflows our type when adding it to the
|
||||
address we've allocated. Even if it doesn't, it may be possible to do so
|
||||
with the math using the outcome of that as an operand. Check them both.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/disk/lvm.c | 48 ++++++++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 40 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/grub-core/disk/lvm.c b/grub-core/disk/lvm.c
|
||||
index d1df640b3..139fafd47 100644
|
||||
--- a/grub-core/disk/lvm.c
|
||||
+++ b/grub-core/disk/lvm.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <grub/lvm.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/i18n.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/emu/misc.h>
|
||||
@@ -102,10 +103,11 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_uint64_t mda_offset, mda_size;
|
||||
+ grub_size_t ptr;
|
||||
char buf[GRUB_LVM_LABEL_SIZE];
|
||||
char vg_id[GRUB_LVM_ID_STRLEN+1];
|
||||
char pv_id[GRUB_LVM_ID_STRLEN+1];
|
||||
- char *metadatabuf, *p, *q, *vgname;
|
||||
+ char *metadatabuf, *p, *q, *mda_end, *vgname;
|
||||
struct grub_lvm_label_header *lh = (struct grub_lvm_label_header *) buf;
|
||||
struct grub_lvm_pv_header *pvh;
|
||||
struct grub_lvm_disk_locn *dlocn;
|
||||
@@ -205,19 +207,31 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
grub_le_to_cpu64 (rlocn->size) -
|
||||
grub_le_to_cpu64 (mdah->size));
|
||||
}
|
||||
- p = q = metadatabuf + grub_le_to_cpu64 (rlocn->offset);
|
||||
|
||||
- while (*q != ' ' && q < metadatabuf + mda_size)
|
||||
- q++;
|
||||
-
|
||||
- if (q == metadatabuf + mda_size)
|
||||
+ if (grub_add ((grub_size_t)metadatabuf,
|
||||
+ (grub_size_t)grub_le_to_cpu64 (rlocn->offset),
|
||||
+ &ptr))
|
||||
{
|
||||
+ error_parsing_metadata:
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("error parsing metadata");
|
||||
#endif
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
+ p = q = (char *)ptr;
|
||||
+
|
||||
+ if (grub_add ((grub_size_t)metadatabuf, (grub_size_t)mda_size, &ptr))
|
||||
+ goto error_parsing_metadata;
|
||||
+
|
||||
+ mda_end = (char *)ptr;
|
||||
+
|
||||
+ while (*q != ' ' && q < mda_end)
|
||||
+ q++;
|
||||
+
|
||||
+ if (q == mda_end)
|
||||
+ goto error_parsing_metadata;
|
||||
+
|
||||
vgname_len = q - p;
|
||||
vgname = grub_malloc (vgname_len + 1);
|
||||
if (!vgname)
|
||||
@@ -367,8 +381,26 @@ grub_lvm_detect (grub_disk_t disk,
|
||||
{
|
||||
const char *iptr;
|
||||
char *optr;
|
||||
- lv->fullname = grub_malloc (sizeof ("lvm/") - 1 + 2 * vgname_len
|
||||
- + 1 + 2 * s + 1);
|
||||
+
|
||||
+ /*
|
||||
+ * This is kind of hard to read with our safe (but rather
|
||||
+ * baroque) math primatives, but it boils down to:
|
||||
+ *
|
||||
+ * sz0 = vgname_len * 2 + 1 +
|
||||
+ * s * 2 + 1 +
|
||||
+ * sizeof ("lvm/") - 1;
|
||||
+ */
|
||||
+ grub_size_t sz0 = vgname_len, sz1 = s;
|
||||
+
|
||||
+ if (grub_mul (sz0, 2, &sz0) ||
|
||||
+ grub_add (sz0, 1, &sz0) ||
|
||||
+ grub_mul (sz1, 2, &sz1) ||
|
||||
+ grub_add (sz1, 1, &sz1) ||
|
||||
+ grub_add (sz0, sz1, &sz0) ||
|
||||
+ grub_add (sz0, sizeof ("lvm/") - 1, &sz0))
|
||||
+ goto lvs_fail;
|
||||
+
|
||||
+ lv->fullname = grub_malloc (sz0);
|
||||
if (!lv->fullname)
|
||||
goto lvs_fail;
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
38
buildroot/boot/grub2/0023-emu-Make-grub_free-NULL-safe.patch
Normal file
38
buildroot/boot/grub2/0023-emu-Make-grub_free-NULL-safe.patch
Normal file
@ -0,0 +1,38 @@
|
||||
From 320e86747a32e4d46d24ee4b64493741c161da50 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Sun, 19 Jul 2020 16:08:08 -0400
|
||||
Subject: [PATCH] emu: Make grub_free(NULL) safe
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The grub_free() implementation in grub-core/kern/mm.c safely handles
|
||||
NULL pointers, and code at many places depends on this. We don't know
|
||||
that the same is true on all host OSes, so we need to handle the same
|
||||
behavior in grub-emu's implementation.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/emu/mm.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/kern/emu/mm.c b/grub-core/kern/emu/mm.c
|
||||
index 145b01d37..4d1046a21 100644
|
||||
--- a/grub-core/kern/emu/mm.c
|
||||
+++ b/grub-core/kern/emu/mm.c
|
||||
@@ -60,7 +60,8 @@ grub_zalloc (grub_size_t size)
|
||||
void
|
||||
grub_free (void *ptr)
|
||||
{
|
||||
- free (ptr);
|
||||
+ if (ptr)
|
||||
+ free (ptr);
|
||||
}
|
||||
|
||||
void *
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,239 @@
|
||||
From c330aa099a38bc5c4d3066954fe35767cc06adb1 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Sun, 19 Jul 2020 16:53:27 -0400
|
||||
Subject: [PATCH] efi: Fix some malformed device path arithmetic errors
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Several places we take the length of a device path and subtract 4 from
|
||||
it, without ever checking that it's >= 4. There are also cases where
|
||||
this kind of malformation will result in unpredictable iteration,
|
||||
including treating the length from one dp node as the type in the next
|
||||
node. These are all errors, no matter where the data comes from.
|
||||
|
||||
This patch adds a checking macro, GRUB_EFI_DEVICE_PATH_VALID(), which
|
||||
can be used in several places, and makes GRUB_EFI_NEXT_DEVICE_PATH()
|
||||
return NULL and GRUB_EFI_END_ENTIRE_DEVICE_PATH() evaluate as true when
|
||||
the length is too small. Additionally, it makes several places in the
|
||||
code check for and return errors in these cases.
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/efi/efi.c | 64 +++++++++++++++++++++++++-----
|
||||
grub-core/loader/efi/chainloader.c | 13 +++++-
|
||||
grub-core/loader/i386/xnu.c | 9 +++--
|
||||
include/grub/efi/api.h | 14 ++++---
|
||||
4 files changed, 79 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index dc31caa21..c97969a65 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -332,7 +332,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
|
||||
dp = dp0;
|
||||
|
||||
- while (1)
|
||||
+ while (dp)
|
||||
{
|
||||
grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp);
|
||||
grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp);
|
||||
@@ -342,9 +342,15 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
if (type == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE
|
||||
&& subtype == GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE)
|
||||
{
|
||||
- grub_efi_uint16_t len;
|
||||
- len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
|
||||
- / sizeof (grub_efi_char16_t));
|
||||
+ grub_efi_uint16_t len = GRUB_EFI_DEVICE_PATH_LENGTH (dp);
|
||||
+
|
||||
+ if (len < 4)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ "malformed EFI Device Path node has length=%d", len);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ len = (len - 4) / sizeof (grub_efi_char16_t);
|
||||
filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 2;
|
||||
}
|
||||
|
||||
@@ -360,7 +366,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
if (!name)
|
||||
return NULL;
|
||||
|
||||
- while (1)
|
||||
+ while (dp)
|
||||
{
|
||||
grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp);
|
||||
grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp);
|
||||
@@ -376,8 +382,15 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0)
|
||||
|
||||
*p++ = '/';
|
||||
|
||||
- len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4)
|
||||
- / sizeof (grub_efi_char16_t));
|
||||
+ len = GRUB_EFI_DEVICE_PATH_LENGTH (dp);
|
||||
+ if (len < 4)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ "malformed EFI Device Path node has length=%d", len);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ len = (len - 4) / sizeof (grub_efi_char16_t);
|
||||
fp = (grub_efi_file_path_device_path_t *) dp;
|
||||
/* According to EFI spec Path Name is NULL terminated */
|
||||
while (len > 0 && fp->path_name[len - 1] == 0)
|
||||
@@ -452,7 +465,26 @@ grub_efi_duplicate_device_path (const grub_efi_device_path_t *dp)
|
||||
;
|
||||
p = GRUB_EFI_NEXT_DEVICE_PATH (p))
|
||||
{
|
||||
- total_size += GRUB_EFI_DEVICE_PATH_LENGTH (p);
|
||||
+ grub_size_t len = GRUB_EFI_DEVICE_PATH_LENGTH (p);
|
||||
+
|
||||
+ /*
|
||||
+ * In the event that we find a node that's completely garbage, for
|
||||
+ * example if we get to 0x7f 0x01 0x02 0x00 ... (EndInstance with a size
|
||||
+ * of 2), GRUB_EFI_END_ENTIRE_DEVICE_PATH() will be true and
|
||||
+ * GRUB_EFI_NEXT_DEVICE_PATH() will return NULL, so we won't continue,
|
||||
+ * and neither should our consumers, but there won't be any error raised
|
||||
+ * even though the device path is junk.
|
||||
+ *
|
||||
+ * This keeps us from passing junk down back to our caller.
|
||||
+ */
|
||||
+ if (len < 4)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ "malformed EFI Device Path node has length=%d", len);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ total_size += len;
|
||||
if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (p))
|
||||
break;
|
||||
}
|
||||
@@ -497,7 +529,7 @@ dump_vendor_path (const char *type, grub_efi_vendor_device_path_t *vendor)
|
||||
void
|
||||
grub_efi_print_device_path (grub_efi_device_path_t *dp)
|
||||
{
|
||||
- while (1)
|
||||
+ while (GRUB_EFI_DEVICE_PATH_VALID (dp))
|
||||
{
|
||||
grub_efi_uint8_t type = GRUB_EFI_DEVICE_PATH_TYPE (dp);
|
||||
grub_efi_uint8_t subtype = GRUB_EFI_DEVICE_PATH_SUBTYPE (dp);
|
||||
@@ -909,7 +941,10 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1,
|
||||
/* Return non-zero. */
|
||||
return 1;
|
||||
|
||||
- while (1)
|
||||
+ if (dp1 == dp2)
|
||||
+ return 0;
|
||||
+
|
||||
+ while (GRUB_EFI_DEVICE_PATH_VALID (dp1) && GRUB_EFI_DEVICE_PATH_VALID (dp2))
|
||||
{
|
||||
grub_efi_uint8_t type1, type2;
|
||||
grub_efi_uint8_t subtype1, subtype2;
|
||||
@@ -945,5 +980,14 @@ grub_efi_compare_device_paths (const grub_efi_device_path_t *dp1,
|
||||
dp2 = (grub_efi_device_path_t *) ((char *) dp2 + len2);
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * There's no "right" answer here, but we probably don't want to call a valid
|
||||
+ * dp and an invalid dp equal, so pick one way or the other.
|
||||
+ */
|
||||
+ if (GRUB_EFI_DEVICE_PATH_VALID (dp1) && !GRUB_EFI_DEVICE_PATH_VALID (dp2))
|
||||
+ return 1;
|
||||
+ else if (!GRUB_EFI_DEVICE_PATH_VALID (dp1) && GRUB_EFI_DEVICE_PATH_VALID (dp2))
|
||||
+ return -1;
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index daf8c6b54..a8d7b9155 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -156,9 +156,18 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
|
||||
|
||||
size = 0;
|
||||
d = dp;
|
||||
- while (1)
|
||||
+ while (d)
|
||||
{
|
||||
- size += GRUB_EFI_DEVICE_PATH_LENGTH (d);
|
||||
+ grub_size_t len = GRUB_EFI_DEVICE_PATH_LENGTH (d);
|
||||
+
|
||||
+ if (len < 4)
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
+ "malformed EFI Device Path node has length=%d", len);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ size += len;
|
||||
if ((GRUB_EFI_END_ENTIRE_DEVICE_PATH (d)))
|
||||
break;
|
||||
d = GRUB_EFI_NEXT_DEVICE_PATH (d);
|
||||
diff --git a/grub-core/loader/i386/xnu.c b/grub-core/loader/i386/xnu.c
|
||||
index e9e119259..a70093607 100644
|
||||
--- a/grub-core/loader/i386/xnu.c
|
||||
+++ b/grub-core/loader/i386/xnu.c
|
||||
@@ -515,14 +515,15 @@ grub_cmd_devprop_load (grub_command_t cmd __attribute__ ((unused)),
|
||||
|
||||
devhead = buf;
|
||||
buf = devhead + 1;
|
||||
- dpstart = buf;
|
||||
+ dp = dpstart = buf;
|
||||
|
||||
- do
|
||||
+ while (GRUB_EFI_DEVICE_PATH_VALID (dp) && buf < bufend)
|
||||
{
|
||||
- dp = buf;
|
||||
buf = (char *) buf + GRUB_EFI_DEVICE_PATH_LENGTH (dp);
|
||||
+ if (GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp))
|
||||
+ break;
|
||||
+ dp = buf;
|
||||
}
|
||||
- while (!GRUB_EFI_END_ENTIRE_DEVICE_PATH (dp) && buf < bufend);
|
||||
|
||||
dev = grub_xnu_devprop_add_device (dpstart, (char *) buf
|
||||
- (char *) dpstart);
|
||||
diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h
|
||||
index addcbfa8f..cf1355a8c 100644
|
||||
--- a/include/grub/efi/api.h
|
||||
+++ b/include/grub/efi/api.h
|
||||
@@ -625,6 +625,7 @@ typedef struct grub_efi_device_path grub_efi_device_path_protocol_t;
|
||||
#define GRUB_EFI_DEVICE_PATH_TYPE(dp) ((dp)->type & 0x7f)
|
||||
#define GRUB_EFI_DEVICE_PATH_SUBTYPE(dp) ((dp)->subtype)
|
||||
#define GRUB_EFI_DEVICE_PATH_LENGTH(dp) ((dp)->length)
|
||||
+#define GRUB_EFI_DEVICE_PATH_VALID(dp) ((dp) != NULL && GRUB_EFI_DEVICE_PATH_LENGTH (dp) >= 4)
|
||||
|
||||
/* The End of Device Path nodes. */
|
||||
#define GRUB_EFI_END_DEVICE_PATH_TYPE (0xff & 0x7f)
|
||||
@@ -633,13 +634,16 @@ typedef struct grub_efi_device_path grub_efi_device_path_protocol_t;
|
||||
#define GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE 0x01
|
||||
|
||||
#define GRUB_EFI_END_ENTIRE_DEVICE_PATH(dp) \
|
||||
- (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \
|
||||
- && (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \
|
||||
- == GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE))
|
||||
+ (!GRUB_EFI_DEVICE_PATH_VALID (dp) || \
|
||||
+ (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_END_DEVICE_PATH_TYPE \
|
||||
+ && (GRUB_EFI_DEVICE_PATH_SUBTYPE (dp) \
|
||||
+ == GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE)))
|
||||
|
||||
#define GRUB_EFI_NEXT_DEVICE_PATH(dp) \
|
||||
- ((grub_efi_device_path_t *) ((char *) (dp) \
|
||||
- + GRUB_EFI_DEVICE_PATH_LENGTH (dp)))
|
||||
+ (GRUB_EFI_DEVICE_PATH_VALID (dp) \
|
||||
+ ? ((grub_efi_device_path_t *) \
|
||||
+ ((char *) (dp) + GRUB_EFI_DEVICE_PATH_LENGTH (dp))) \
|
||||
+ : NULL)
|
||||
|
||||
/* Hardware Device Path. */
|
||||
#define GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE 1
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,78 @@
|
||||
From fb55bc37dd510911df4eaf649da939f5fafdc7ce Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Date: Wed, 29 Jul 2020 13:38:31 +0200
|
||||
Subject: [PATCH] efi/chainloader: Propagate errors from copy_file_path()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Without any error propagated to the caller, make_file_path()
|
||||
would then try to advance the invalid device path node with
|
||||
GRUB_EFI_NEXT_DEVICE_PATH(), which would fail, returning a NULL
|
||||
pointer that would subsequently be dereferenced. Hence, propagate
|
||||
errors from copy_file_path().
|
||||
|
||||
Signed-off-by: Chris Coulson <chris.coulson@canonical.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/efi/chainloader.c | 19 +++++++++++++------
|
||||
1 file changed, 13 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||||
index a8d7b9155..7b31c3fb9 100644
|
||||
--- a/grub-core/loader/efi/chainloader.c
|
||||
+++ b/grub-core/loader/efi/chainloader.c
|
||||
@@ -106,7 +106,7 @@ grub_chainloader_boot (void)
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
-static void
|
||||
+static grub_err_t
|
||||
copy_file_path (grub_efi_file_path_device_path_t *fp,
|
||||
const char *str, grub_efi_uint16_t len)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ copy_file_path (grub_efi_file_path_device_path_t *fp,
|
||||
|
||||
path_name = grub_calloc (len, GRUB_MAX_UTF16_PER_UTF8 * sizeof (*path_name));
|
||||
if (!path_name)
|
||||
- return;
|
||||
+ return grub_error (GRUB_ERR_OUT_OF_MEMORY, "failed to allocate path buffer");
|
||||
|
||||
size = grub_utf8_to_utf16 (path_name, len * GRUB_MAX_UTF16_PER_UTF8,
|
||||
(const grub_uint8_t *) str, len, 0);
|
||||
@@ -131,6 +131,7 @@ copy_file_path (grub_efi_file_path_device_path_t *fp,
|
||||
fp->path_name[size++] = '\0';
|
||||
fp->header.length = size * sizeof (grub_efi_char16_t) + sizeof (*fp);
|
||||
grub_free (path_name);
|
||||
+ return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_efi_device_path_t *
|
||||
@@ -189,13 +190,19 @@ make_file_path (grub_efi_device_path_t *dp, const char *filename)
|
||||
d = (grub_efi_device_path_t *) ((char *) file_path
|
||||
+ ((char *) d - (char *) dp));
|
||||
grub_efi_print_device_path (d);
|
||||
- copy_file_path ((grub_efi_file_path_device_path_t *) d,
|
||||
- dir_start, dir_end - dir_start);
|
||||
+ if (copy_file_path ((grub_efi_file_path_device_path_t *) d,
|
||||
+ dir_start, dir_end - dir_start) != GRUB_ERR_NONE)
|
||||
+ {
|
||||
+ fail:
|
||||
+ grub_free (file_path);
|
||||
+ return 0;
|
||||
+ }
|
||||
|
||||
/* Fill the file path for the file. */
|
||||
d = GRUB_EFI_NEXT_DEVICE_PATH (d);
|
||||
- copy_file_path ((grub_efi_file_path_device_path_t *) d,
|
||||
- dir_end + 1, grub_strlen (dir_end + 1));
|
||||
+ if (copy_file_path ((grub_efi_file_path_device_path_t *) d,
|
||||
+ dir_end + 1, grub_strlen (dir_end + 1)) != GRUB_ERR_NONE)
|
||||
+ goto fail;
|
||||
|
||||
/* Fill the end of device path nodes. */
|
||||
d = GRUB_EFI_NEXT_DEVICE_PATH (d);
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,183 @@
|
||||
From 8a6d6299efcffd14c1130942195e6c0d9b50cacd Mon Sep 17 00:00:00 2001
|
||||
From: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Date: Mon, 20 Jul 2020 23:03:05 +0000
|
||||
Subject: [PATCH] efi: Fix use-after-free in halt/reboot path
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
commit 92bfc33db984 ("efi: Free malloc regions on exit")
|
||||
introduced memory freeing in grub_efi_fini(), which is
|
||||
used not only by exit path but by halt/reboot one as well.
|
||||
As result of memory freeing, code and data regions used by
|
||||
modules, such as halt, reboot, acpi (used by halt) also got
|
||||
freed. After return to module code, CPU executes, filled
|
||||
by UEFI firmware (tested with edk2), 0xAFAFAFAF pattern as
|
||||
a code. Which leads to #UD exception later.
|
||||
|
||||
grub> halt
|
||||
!!!! X64 Exception Type - 06(#UD - Invalid Opcode) CPU Apic ID - 00000000 !!!!
|
||||
RIP - 0000000003F4EC28, CS - 0000000000000038, RFLAGS - 0000000000200246
|
||||
RAX - 0000000000000000, RCX - 00000000061DA188, RDX - 0A74C0854DC35D41
|
||||
RBX - 0000000003E10E08, RSP - 0000000007F0F860, RBP - 0000000000000000
|
||||
RSI - 00000000064DB768, RDI - 000000000832C5C3
|
||||
R8 - 0000000000000002, R9 - 0000000000000000, R10 - 00000000061E2E52
|
||||
R11 - 0000000000000020, R12 - 0000000003EE5C1F, R13 - 00000000061E0FF4
|
||||
R14 - 0000000003E10D80, R15 - 00000000061E2F60
|
||||
DS - 0000000000000030, ES - 0000000000000030, FS - 0000000000000030
|
||||
GS - 0000000000000030, SS - 0000000000000030
|
||||
CR0 - 0000000080010033, CR2 - 0000000000000000, CR3 - 0000000007C01000
|
||||
CR4 - 0000000000000668, CR8 - 0000000000000000
|
||||
DR0 - 0000000000000000, DR1 - 0000000000000000, DR2 - 0000000000000000
|
||||
DR3 - 0000000000000000, DR6 - 00000000FFFF0FF0, DR7 - 0000000000000400
|
||||
GDTR - 00000000079EEA98 0000000000000047, LDTR - 0000000000000000
|
||||
IDTR - 0000000007598018 0000000000000FFF, TR - 0000000000000000
|
||||
FXSAVE_STATE - 0000000007F0F4C0
|
||||
|
||||
Proposal here is to continue to free allocated memory for
|
||||
exit boot services path but keep it for halt/reboot path
|
||||
as it won't be much security concern here.
|
||||
Introduced GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY
|
||||
loader flag to be used by efi halt/reboot path.
|
||||
|
||||
Signed-off-by: Alexey Makhalov <amakhalov@vmware.com>
|
||||
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/kern/arm/efi/init.c | 3 +++
|
||||
grub-core/kern/arm64/efi/init.c | 3 +++
|
||||
grub-core/kern/efi/efi.c | 3 ++-
|
||||
grub-core/kern/efi/init.c | 1 -
|
||||
grub-core/kern/i386/efi/init.c | 9 +++++++--
|
||||
grub-core/kern/ia64/efi/init.c | 9 +++++++--
|
||||
grub-core/kern/riscv/efi/init.c | 3 +++
|
||||
grub-core/lib/efi/halt.c | 3 ++-
|
||||
include/grub/loader.h | 1 +
|
||||
9 files changed, 28 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/grub-core/kern/arm/efi/init.c b/grub-core/kern/arm/efi/init.c
|
||||
index 06df60e2f..40c3b467f 100644
|
||||
--- a/grub-core/kern/arm/efi/init.c
|
||||
+++ b/grub-core/kern/arm/efi/init.c
|
||||
@@ -71,4 +71,7 @@ grub_machine_fini (int flags)
|
||||
efi_call_1 (b->close_event, tmr_evt);
|
||||
|
||||
grub_efi_fini ();
|
||||
+
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
|
||||
+ grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/kern/arm64/efi/init.c b/grub-core/kern/arm64/efi/init.c
|
||||
index 6224999ec..5010caefd 100644
|
||||
--- a/grub-core/kern/arm64/efi/init.c
|
||||
+++ b/grub-core/kern/arm64/efi/init.c
|
||||
@@ -57,4 +57,7 @@ grub_machine_fini (int flags)
|
||||
return;
|
||||
|
||||
grub_efi_fini ();
|
||||
+
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
|
||||
+ grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c
|
||||
index c97969a65..9cfd88d77 100644
|
||||
--- a/grub-core/kern/efi/efi.c
|
||||
+++ b/grub-core/kern/efi/efi.c
|
||||
@@ -157,7 +157,8 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle)
|
||||
void
|
||||
grub_reboot (void)
|
||||
{
|
||||
- grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
|
||||
+ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN |
|
||||
+ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY);
|
||||
efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
|
||||
GRUB_EFI_RESET_COLD, GRUB_EFI_SUCCESS, 0, NULL);
|
||||
for (;;) ;
|
||||
diff --git a/grub-core/kern/efi/init.c b/grub-core/kern/efi/init.c
|
||||
index 3dfdf2d22..2c31847bf 100644
|
||||
--- a/grub-core/kern/efi/init.c
|
||||
+++ b/grub-core/kern/efi/init.c
|
||||
@@ -80,5 +80,4 @@ grub_efi_fini (void)
|
||||
{
|
||||
grub_efidisk_fini ();
|
||||
grub_console_fini ();
|
||||
- grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/kern/i386/efi/init.c b/grub-core/kern/i386/efi/init.c
|
||||
index da499aba0..deb2eacd8 100644
|
||||
--- a/grub-core/kern/i386/efi/init.c
|
||||
+++ b/grub-core/kern/i386/efi/init.c
|
||||
@@ -39,6 +39,11 @@ grub_machine_init (void)
|
||||
void
|
||||
grub_machine_fini (int flags)
|
||||
{
|
||||
- if (flags & GRUB_LOADER_FLAG_NORETURN)
|
||||
- grub_efi_fini ();
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_NORETURN))
|
||||
+ return;
|
||||
+
|
||||
+ grub_efi_fini ();
|
||||
+
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
|
||||
+ grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/kern/ia64/efi/init.c b/grub-core/kern/ia64/efi/init.c
|
||||
index b5ecbd091..f1965571b 100644
|
||||
--- a/grub-core/kern/ia64/efi/init.c
|
||||
+++ b/grub-core/kern/ia64/efi/init.c
|
||||
@@ -70,6 +70,11 @@ grub_machine_init (void)
|
||||
void
|
||||
grub_machine_fini (int flags)
|
||||
{
|
||||
- if (flags & GRUB_LOADER_FLAG_NORETURN)
|
||||
- grub_efi_fini ();
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_NORETURN))
|
||||
+ return;
|
||||
+
|
||||
+ grub_efi_fini ();
|
||||
+
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
|
||||
+ grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/kern/riscv/efi/init.c b/grub-core/kern/riscv/efi/init.c
|
||||
index 7eb1969d0..38795fe67 100644
|
||||
--- a/grub-core/kern/riscv/efi/init.c
|
||||
+++ b/grub-core/kern/riscv/efi/init.c
|
||||
@@ -73,4 +73,7 @@ grub_machine_fini (int flags)
|
||||
return;
|
||||
|
||||
grub_efi_fini ();
|
||||
+
|
||||
+ if (!(flags & GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY))
|
||||
+ grub_efi_memory_fini ();
|
||||
}
|
||||
diff --git a/grub-core/lib/efi/halt.c b/grub-core/lib/efi/halt.c
|
||||
index 5859f0498..29d413641 100644
|
||||
--- a/grub-core/lib/efi/halt.c
|
||||
+++ b/grub-core/lib/efi/halt.c
|
||||
@@ -28,7 +28,8 @@
|
||||
void
|
||||
grub_halt (void)
|
||||
{
|
||||
- grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
|
||||
+ grub_machine_fini (GRUB_LOADER_FLAG_NORETURN |
|
||||
+ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY);
|
||||
#if !defined(__ia64__) && !defined(__arm__) && !defined(__aarch64__) && \
|
||||
!defined(__riscv)
|
||||
grub_acpi_halt ();
|
||||
diff --git a/include/grub/loader.h b/include/grub/loader.h
|
||||
index 7f82a499f..b20864282 100644
|
||||
--- a/include/grub/loader.h
|
||||
+++ b/include/grub/loader.h
|
||||
@@ -33,6 +33,7 @@ enum
|
||||
{
|
||||
GRUB_LOADER_FLAG_NORETURN = 1,
|
||||
GRUB_LOADER_FLAG_PXE_NOT_UNLOAD = 2,
|
||||
+ GRUB_LOADER_FLAG_EFI_KEEP_ALLOCATED_MEMORY = 4,
|
||||
};
|
||||
|
||||
void EXPORT_FUNC (grub_loader_set) (grub_err_t (*boot) (void),
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,32 @@
|
||||
From a2a7464e9f10a677d6f91e1c4fa527d084c22e7c Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Fri, 24 Jul 2020 13:57:27 -0400
|
||||
Subject: [PATCH] loader/linux: Avoid overflow on initrd size calculation
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/linux.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
|
||||
index 471b214d6..4cd8c20c7 100644
|
||||
--- a/grub-core/loader/linux.c
|
||||
+++ b/grub-core/loader/linux.c
|
||||
@@ -151,8 +151,7 @@ grub_initrd_init (int argc, char *argv[],
|
||||
initrd_ctx->nfiles = 0;
|
||||
initrd_ctx->components = 0;
|
||||
|
||||
- initrd_ctx->components = grub_zalloc (argc
|
||||
- * sizeof (initrd_ctx->components[0]));
|
||||
+ initrd_ctx->components = grub_calloc (argc, sizeof (initrd_ctx->components[0]));
|
||||
if (!initrd_ctx->components)
|
||||
return grub_errno;
|
||||
|
||||
--
|
||||
2.26.2
|
||||
|
@ -0,0 +1,173 @@
|
||||
From 0367e7d1b9bac3a78608a672bf6e4ace6a28b964 Mon Sep 17 00:00:00 2001
|
||||
From: Colin Watson <cjwatson@debian.org>
|
||||
Date: Sat, 25 Jul 2020 12:15:37 +0100
|
||||
Subject: [PATCH] linux: Fix integer overflows in initrd size handling
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
These could be triggered by a crafted filesystem with very large files.
|
||||
|
||||
Fixes: CVE-2020-15707
|
||||
|
||||
Signed-off-by: Colin Watson <cjwatson@debian.org>
|
||||
Reviewed-by: Jan Setje-Eilers <jan.setjeeilers@oracle.com>
|
||||
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
|
||||
Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
|
||||
---
|
||||
grub-core/loader/linux.c | 74 +++++++++++++++++++++++++++++-----------
|
||||
1 file changed, 54 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
|
||||
index 4cd8c20c7..3fe390f17 100644
|
||||
--- a/grub-core/loader/linux.c
|
||||
+++ b/grub-core/loader/linux.c
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <grub/misc.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/mm.h>
|
||||
+#include <grub/safemath.h>
|
||||
|
||||
struct newc_head
|
||||
{
|
||||
@@ -98,13 +99,13 @@ free_dir (struct dir *root)
|
||||
grub_free (root);
|
||||
}
|
||||
|
||||
-static grub_size_t
|
||||
+static grub_err_t
|
||||
insert_dir (const char *name, struct dir **root,
|
||||
- grub_uint8_t *ptr)
|
||||
+ grub_uint8_t *ptr, grub_size_t *size)
|
||||
{
|
||||
struct dir *cur, **head = root;
|
||||
const char *cb, *ce = name;
|
||||
- grub_size_t size = 0;
|
||||
+ *size = 0;
|
||||
while (1)
|
||||
{
|
||||
for (cb = ce; *cb == '/'; cb++);
|
||||
@@ -130,14 +131,22 @@ insert_dir (const char *name, struct dir **root,
|
||||
ptr = make_header (ptr, name, ce - name,
|
||||
040777, 0);
|
||||
}
|
||||
- size += ALIGN_UP ((ce - (char *) name)
|
||||
- + sizeof (struct newc_head), 4);
|
||||
+ if (grub_add (*size,
|
||||
+ ALIGN_UP ((ce - (char *) name)
|
||||
+ + sizeof (struct newc_head), 4),
|
||||
+ size))
|
||||
+ {
|
||||
+ grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
+ grub_free (n->name);
|
||||
+ grub_free (n);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
*head = n;
|
||||
cur = n;
|
||||
}
|
||||
root = &cur->next;
|
||||
}
|
||||
- return size;
|
||||
+ return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
@@ -172,26 +181,33 @@ grub_initrd_init (int argc, char *argv[],
|
||||
eptr = grub_strchr (ptr, ':');
|
||||
if (eptr)
|
||||
{
|
||||
+ grub_size_t dir_size, name_len;
|
||||
+
|
||||
initrd_ctx->components[i].newc_name = grub_strndup (ptr, eptr - ptr);
|
||||
- if (!initrd_ctx->components[i].newc_name)
|
||||
+ if (!initrd_ctx->components[i].newc_name ||
|
||||
+ insert_dir (initrd_ctx->components[i].newc_name, &root, 0,
|
||||
+ &dir_size))
|
||||
{
|
||||
grub_initrd_close (initrd_ctx);
|
||||
return grub_errno;
|
||||
}
|
||||
- initrd_ctx->size
|
||||
- += ALIGN_UP (sizeof (struct newc_head)
|
||||
- + grub_strlen (initrd_ctx->components[i].newc_name),
|
||||
- 4);
|
||||
- initrd_ctx->size += insert_dir (initrd_ctx->components[i].newc_name,
|
||||
- &root, 0);
|
||||
+ name_len = grub_strlen (initrd_ctx->components[i].newc_name);
|
||||
+ if (grub_add (initrd_ctx->size,
|
||||
+ ALIGN_UP (sizeof (struct newc_head) + name_len, 4),
|
||||
+ &initrd_ctx->size) ||
|
||||
+ grub_add (initrd_ctx->size, dir_size, &initrd_ctx->size))
|
||||
+ goto overflow;
|
||||
newc = 1;
|
||||
fname = eptr + 1;
|
||||
}
|
||||
}
|
||||
else if (newc)
|
||||
{
|
||||
- initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
||||
- + sizeof ("TRAILER!!!") - 1, 4);
|
||||
+ if (grub_add (initrd_ctx->size,
|
||||
+ ALIGN_UP (sizeof (struct newc_head)
|
||||
+ + sizeof ("TRAILER!!!") - 1, 4),
|
||||
+ &initrd_ctx->size))
|
||||
+ goto overflow;
|
||||
free_dir (root);
|
||||
root = 0;
|
||||
newc = 0;
|
||||
@@ -207,19 +223,29 @@ grub_initrd_init (int argc, char *argv[],
|
||||
initrd_ctx->nfiles++;
|
||||
initrd_ctx->components[i].size
|
||||
= grub_file_size (initrd_ctx->components[i].file);
|
||||
- initrd_ctx->size += initrd_ctx->components[i].size;
|
||||
+ if (grub_add (initrd_ctx->size, initrd_ctx->components[i].size,
|
||||
+ &initrd_ctx->size))
|
||||
+ goto overflow;
|
||||
}
|
||||
|
||||
if (newc)
|
||||
{
|
||||
initrd_ctx->size = ALIGN_UP (initrd_ctx->size, 4);
|
||||
- initrd_ctx->size += ALIGN_UP (sizeof (struct newc_head)
|
||||
- + sizeof ("TRAILER!!!") - 1, 4);
|
||||
+ if (grub_add (initrd_ctx->size,
|
||||
+ ALIGN_UP (sizeof (struct newc_head)
|
||||
+ + sizeof ("TRAILER!!!") - 1, 4),
|
||||
+ &initrd_ctx->size))
|
||||
+ goto overflow;
|
||||
free_dir (root);
|
||||
root = 0;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
+
|
||||
+ overflow:
|
||||
+ free_dir (root);
|
||||
+ grub_initrd_close (initrd_ctx);
|
||||
+ return grub_error (GRUB_ERR_OUT_OF_RANGE, N_("overflow is detected"));
|
||||
}
|
||||
|
||||
grub_size_t
|
||||
@@ -260,8 +286,16 @@ grub_initrd_load (struct grub_linux_initrd_context *initrd_ctx,
|
||||
|
||||
if (initrd_ctx->components[i].newc_name)
|
||||
{
|
||||
- ptr += insert_dir (initrd_ctx->components[i].newc_name,
|
||||
- &root, ptr);
|
||||
+ grub_size_t dir_size;
|
||||
+
|
||||
+ if (insert_dir (initrd_ctx->components[i].newc_name, &root, ptr,
|
||||
+ &dir_size))
|
||||
+ {
|
||||
+ free_dir (root);
|
||||
+ grub_initrd_close (initrd_ctx);
|
||||
+ return grub_errno;
|
||||
+ }
|
||||
+ ptr += dir_size;
|
||||
ptr = make_header (ptr, initrd_ctx->components[i].newc_name,
|
||||
grub_strlen (initrd_ctx->components[i].newc_name),
|
||||
0100777,
|
||||
--
|
||||
2.26.2
|
||||
|
@ -21,6 +21,17 @@ endef
|
||||
GRUB2_POST_PATCH_HOOKS += GRUB2_AVOID_AUTORECONF
|
||||
HOST_GRUB2_POST_PATCH_HOOKS += GRUB2_AVOID_AUTORECONF
|
||||
|
||||
# 0002-yylex-Make-lexer-fatal-errors-actually-be-fatal.patch
|
||||
GRUB2_IGNORE_CVES += CVE-2020-10713
|
||||
# 0005-calloc-Use-calloc-at-most-places.patch
|
||||
GRUB2_IGNORE_CVES += CVE-2020-14308
|
||||
# 0006-malloc-Use-overflow-checking-primitives-where-we-do-.patch
|
||||
GRUB2_IGNORE_CVES += CVE-2020-14309 CVE-2020-14310 CVE-2020-14311
|
||||
# 0019-script-Avoid-a-use-after-free-when-redefining-a-func.patch
|
||||
GRUB2_IGNORE_CVES += CVE-2020-15706
|
||||
# 0028-linux-Fix-integer-overflows-in-initrd-size-handling.patch
|
||||
GRUB2_IGNORE_CVES += CVE-2020-15707
|
||||
|
||||
ifeq ($(BR2_TARGET_GRUB2_INSTALL_TOOLS),y)
|
||||
GRUB2_INSTALL_TARGET = YES
|
||||
else
|
||||
|
@ -16,6 +16,7 @@ UBOOT_INSTALL_IMAGES = YES
|
||||
|
||||
# u-boot 2020.01+ needs make 4.0+
|
||||
UBOOT_DEPENDENCIES = $(BR2_MAKE_HOST_DEPENDENCY)
|
||||
UBOOT_MAKE = $(BR2_MAKE)
|
||||
|
||||
ifeq ($(UBOOT_VERSION),custom)
|
||||
# Handle custom U-Boot tarballs as specified by the configuration
|
||||
@ -247,7 +248,7 @@ UBOOT_POST_PATCH_HOOKS += UBOOT_FIXUP_LIBFDT_INCLUDE
|
||||
ifeq ($(BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY),y)
|
||||
define UBOOT_CONFIGURE_CMDS
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
$(BR2_MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \
|
||||
$(UBOOT_MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \
|
||||
$(UBOOT_BOARD_NAME)_config
|
||||
endef
|
||||
else ifeq ($(BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG),y)
|
||||
@ -284,7 +285,7 @@ define UBOOT_BUILD_CMDS
|
||||
cp -f $(UBOOT_CUSTOM_DTS_PATH) $(@D)/arch/$(UBOOT_ARCH)/dts/
|
||||
)
|
||||
$(TARGET_CONFIGURE_OPTS) \
|
||||
$(BR2_MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \
|
||||
$(UBOOT_MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \
|
||||
$(UBOOT_MAKE_TARGET)
|
||||
$(if $(BR2_TARGET_UBOOT_FORMAT_SD),
|
||||
$(@D)/tools/mxsboot sd $(@D)/u-boot.sb $(@D)/u-boot.sd)
|
||||
|
@ -10,9 +10,9 @@ that is known to work. You are welcome to add support for other boards
|
||||
to Buildroot too.
|
||||
|
||||
To do so, you need to create a normal Buildroot configuration that
|
||||
builds a basic system for the hardware: toolchain, kernel, bootloader,
|
||||
filesystem and a simple BusyBox-only userspace. No specific package
|
||||
should be selected: the configuration should be as minimal as
|
||||
builds a basic system for the hardware: (internal) toolchain, kernel,
|
||||
bootloader, filesystem and a simple BusyBox-only userspace. No specific
|
||||
package should be selected: the configuration should be as minimal as
|
||||
possible, and should only build a working basic BusyBox system for the
|
||||
target platform. You can of course use more complicated configurations
|
||||
for your internal projects, but the Buildroot project will only
|
||||
@ -22,7 +22,17 @@ selections are highly application-specific.
|
||||
Once you have a known working configuration, run +make
|
||||
savedefconfig+. This will generate a minimal +defconfig+ file at the
|
||||
root of the Buildroot source tree. Move this file into the +configs/+
|
||||
directory, and rename it +<boardname>_defconfig+.
|
||||
directory, and rename it +<boardname>_defconfig+. If the configuration
|
||||
is a bit more complicated, it is nice to manually reformat it and
|
||||
separate it into sections, with a comment before each section. Typical
|
||||
sections are _Architecture_, _Toolchain options_ (typically just linux
|
||||
headers version), _Firmware_, _Bootloader_, _Kernel_, and _Filesystem_.
|
||||
|
||||
Always use fixed versions or commit hashes for the different
|
||||
components, not the "latest" version. For example, set
|
||||
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y+ and
|
||||
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE+ to the kernel version you tested
|
||||
with.
|
||||
|
||||
It is recommended to use as much as possible upstream versions of the
|
||||
Linux kernel and bootloaders, and to use as much as possible default
|
||||
|
@ -47,32 +47,31 @@ package. Let's start with an example:
|
||||
13: FOO_DEPENDENCIES = host-cargo
|
||||
14:
|
||||
15: FOO_CARGO_ENV = CARGO_HOME=$(HOST_DIR)/share/cargo
|
||||
16: FOO_CARGO_MODE = $(if $(BR2_ENABLE_DEBUG),debug,release)
|
||||
17:
|
||||
18: FOO_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(FOO_CARGO_MODE)
|
||||
19:
|
||||
20: FOO_CARGO_OPTS = \
|
||||
21: --$(FOO_CARGO_MODE) \
|
||||
22: --target=$(RUSTC_TARGET_NAME) \
|
||||
23: --manifest-path=$(@D)/Cargo.toml
|
||||
24:
|
||||
25: define FOO_BUILD_CMDS
|
||||
26: $(TARGET_MAKE_ENV) $(FOO_CARGO_ENV) \
|
||||
27: cargo build $(FOO_CARGO_OPTS)
|
||||
28: endef
|
||||
29:
|
||||
30: define FOO_INSTALL_TARGET_CMDS
|
||||
31: $(INSTALL) -D -m 0755 $(@D)/$(FOO_BIN_DIR)/foo \
|
||||
32: $(TARGET_DIR)/usr/bin/foo
|
||||
33: endef
|
||||
34:
|
||||
35: $(eval $(generic-package))
|
||||
16:
|
||||
17: FOO_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(FOO_CARGO_MODE)
|
||||
18:
|
||||
19: FOO_CARGO_OPTS = \
|
||||
20: $(if $(BR2_ENABLE_DEBUG),,--release) \
|
||||
21: --target=$(RUSTC_TARGET_NAME) \
|
||||
22: --manifest-path=$(@D)/Cargo.toml
|
||||
23:
|
||||
24: define FOO_BUILD_CMDS
|
||||
25: $(TARGET_MAKE_ENV) $(FOO_CARGO_ENV) \
|
||||
26: cargo build $(FOO_CARGO_OPTS)
|
||||
27: endef
|
||||
28:
|
||||
29: define FOO_INSTALL_TARGET_CMDS
|
||||
30: $(INSTALL) -D -m 0755 $(@D)/$(FOO_BIN_DIR)/foo \
|
||||
31: $(TARGET_DIR)/usr/bin/foo
|
||||
32: endef
|
||||
33:
|
||||
34: $(eval $(generic-package))
|
||||
--------------------------------
|
||||
|
||||
The Makefile starts with the definition of the standard variables for package
|
||||
declaration (lines 7 to 11).
|
||||
|
||||
As seen in line 35, it is based on the
|
||||
As seen in line 34, it is based on the
|
||||
xref:generic-package-tutorial[+generic-package+ infrastructure]. So, it defines
|
||||
the variables required by this particular infrastructure, where Cargo is
|
||||
invoked:
|
||||
|
@ -34,7 +34,7 @@ will automatically download the tarball from this location.
|
||||
|
||||
On line 10, we tell Buildroot what options to enable for libfoo.
|
||||
|
||||
On line 11, we tell Buildroot the depednencies of libfoo.
|
||||
On line 11, we tell Buildroot the dependencies of libfoo.
|
||||
|
||||
Finally, on line line 13, we invoke the +waf-package+
|
||||
macro that generates all the Makefile rules that actually allows the
|
||||
|
@ -371,6 +371,37 @@ in the following cases:
|
||||
* whenever you feel it will help presenting your work, your choices,
|
||||
the review process, etc.
|
||||
|
||||
==== Patches for maintenance branches
|
||||
|
||||
When fixing bugs on a maintenance branch, bugs should be fixed on the
|
||||
master branch first. The commit log for such a patch may then contain a
|
||||
post-commit note specifying what branches are affected:
|
||||
|
||||
----
|
||||
package/foo: fix stuff
|
||||
|
||||
Signed-off-by: Your Real Name <your@email.address>
|
||||
---
|
||||
Backport to: 2020.02.x, 2020.05.x
|
||||
(2020.08.x not affected as the version was bumped)
|
||||
----
|
||||
|
||||
Those changes will then be backported by a maintainer to the affected
|
||||
branches.
|
||||
|
||||
However, some bugs may apply only to a specific release, for example
|
||||
because it is using an older version of a package. In that case, patches
|
||||
should be based off the maintenance branch, and the patch subject prefix
|
||||
must include the maintenance branch name (for example "[PATCH 2020.02.x]").
|
||||
This can be done with the +git format-patch+ flag +--subject-prefix+:
|
||||
|
||||
---------------------
|
||||
$ git format-patch --subject-prefix "PATCH 2020.02.x" \
|
||||
-M -s -o outgoing origin/2020.02.x
|
||||
---------------------
|
||||
|
||||
Then send the patches with +git send-email+, as described above.
|
||||
|
||||
==== Patch revision changelog
|
||||
|
||||
When improvements are requested, the new revision of each commit
|
||||
|
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -167,13 +167,13 @@ List of Examples
|
||||
|
||||
---------------------------------------------------------------------
|
||||
|
||||
Buildroot 2020.02.4 manual generated on 2020-07-26 08:11:34 UTC from
|
||||
git revision dee53013da
|
||||
Buildroot 2020.02.7 manual generated on 2020-10-12 21:37:33 UTC from
|
||||
git revision d8082db677
|
||||
|
||||
The Buildroot manual is written by the Buildroot developers. It is
|
||||
licensed under the GNU General Public License, version 2. Refer to
|
||||
the COPYING [http://git.buildroot.org/buildroot/tree/COPYING?id=
|
||||
dee53013da87dfa4bcb3433bdef79ec43b5a5c24] file in the Buildroot
|
||||
d8082db677046e004a6537828b3e4f4b9a818a4f] file in the Buildroot
|
||||
sources for the full text of this license.
|
||||
|
||||
Copyright © 2004-2020 The Buildroot developers
|
||||
@ -3670,7 +3670,7 @@ build a system that is known to work. You are welcome to add support
|
||||
for other boards to Buildroot too.
|
||||
|
||||
To do so, you need to create a normal Buildroot configuration that
|
||||
builds a basic system for the hardware: toolchain, kernel,
|
||||
builds a basic system for the hardware: (internal) toolchain, kernel,
|
||||
bootloader, filesystem and a simple BusyBox-only userspace. No
|
||||
specific package should be selected: the configuration should be as
|
||||
minimal as possible, and should only build a working basic BusyBox
|
||||
@ -3682,7 +3682,17 @@ This is because package selections are highly application-specific.
|
||||
Once you have a known working configuration, run make savedefconfig.
|
||||
This will generate a minimal defconfig file at the root of the
|
||||
Buildroot source tree. Move this file into the configs/ directory,
|
||||
and rename it <boardname>_defconfig.
|
||||
and rename it <boardname>_defconfig. If the configuration is a bit
|
||||
more complicated, it is nice to manually reformat it and separate it
|
||||
into sections, with a comment before each section. Typical sections
|
||||
are Architecture, Toolchain options (typically just linux headers
|
||||
version), Firmware, Bootloader, Kernel, and Filesystem.
|
||||
|
||||
Always use fixed versions or commit hashes for the different
|
||||
components, not the "latest" version. For example, set
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION=y and
|
||||
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE to the kernel version you
|
||||
tested with.
|
||||
|
||||
It is recommended to use as much as possible upstream versions of the
|
||||
Linux kernel and bootloaders, and to use as much as possible default
|
||||
@ -5877,7 +5887,7 @@ will automatically download the tarball from this location.
|
||||
|
||||
On line 10, we tell Buildroot what options to enable for libfoo.
|
||||
|
||||
On line 11, we tell Buildroot the depednencies of libfoo.
|
||||
On line 11, we tell Buildroot the dependencies of libfoo.
|
||||
|
||||
Finally, on line line 13, we invoke the waf-package macro that
|
||||
generates all the Makefile rules that actually allows the package to
|
||||
@ -6080,31 +6090,30 @@ for such a package. Let’s start with an example:
|
||||
13: FOO_DEPENDENCIES = host-cargo
|
||||
14:
|
||||
15: FOO_CARGO_ENV = CARGO_HOME=$(HOST_DIR)/share/cargo
|
||||
16: FOO_CARGO_MODE = $(if $(BR2_ENABLE_DEBUG),debug,release)
|
||||
17:
|
||||
18: FOO_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(FOO_CARGO_MODE)
|
||||
19:
|
||||
20: FOO_CARGO_OPTS = \
|
||||
21: --$(FOO_CARGO_MODE) \
|
||||
22: --target=$(RUSTC_TARGET_NAME) \
|
||||
23: --manifest-path=$(@D)/Cargo.toml
|
||||
24:
|
||||
25: define FOO_BUILD_CMDS
|
||||
26: $(TARGET_MAKE_ENV) $(FOO_CARGO_ENV) \
|
||||
27: cargo build $(FOO_CARGO_OPTS)
|
||||
28: endef
|
||||
29:
|
||||
30: define FOO_INSTALL_TARGET_CMDS
|
||||
31: $(INSTALL) -D -m 0755 $(@D)/$(FOO_BIN_DIR)/foo \
|
||||
32: $(TARGET_DIR)/usr/bin/foo
|
||||
33: endef
|
||||
34:
|
||||
35: $(eval $(generic-package))
|
||||
16:
|
||||
17: FOO_BIN_DIR = target/$(RUSTC_TARGET_NAME)/$(FOO_CARGO_MODE)
|
||||
18:
|
||||
19: FOO_CARGO_OPTS = \
|
||||
20: $(if $(BR2_ENABLE_DEBUG),,--release) \
|
||||
21: --target=$(RUSTC_TARGET_NAME) \
|
||||
22: --manifest-path=$(@D)/Cargo.toml
|
||||
23:
|
||||
24: define FOO_BUILD_CMDS
|
||||
25: $(TARGET_MAKE_ENV) $(FOO_CARGO_ENV) \
|
||||
26: cargo build $(FOO_CARGO_OPTS)
|
||||
27: endef
|
||||
28:
|
||||
29: define FOO_INSTALL_TARGET_CMDS
|
||||
30: $(INSTALL) -D -m 0755 $(@D)/$(FOO_BIN_DIR)/foo \
|
||||
31: $(TARGET_DIR)/usr/bin/foo
|
||||
32: endef
|
||||
33:
|
||||
34: $(eval $(generic-package))
|
||||
|
||||
The Makefile starts with the definition of the standard variables for
|
||||
package declaration (lines 7 to 11).
|
||||
|
||||
As seen in line 35, it is based on the generic-package infrastructure
|
||||
As seen in line 34, it is based on the generic-package infrastructure
|
||||
. So, it defines the variables required by this particular
|
||||
infrastructure, where Cargo is invoked:
|
||||
|
||||
@ -7499,7 +7508,35 @@ the following cases:
|
||||
* whenever you feel it will help presenting your work, your
|
||||
choices, the review process, etc.
|
||||
|
||||
21.5.4. Patch revision changelog
|
||||
21.5.4. Patches for maintenance branches
|
||||
|
||||
When fixing bugs on a maintenance branch, bugs should be fixed on the
|
||||
master branch first. The commit log for such a patch may then contain
|
||||
a post-commit note specifying what branches are affected:
|
||||
|
||||
package/foo: fix stuff
|
||||
|
||||
Signed-off-by: Your Real Name <your@email.address>
|
||||
---
|
||||
Backport to: 2020.02.x, 2020.05.x
|
||||
(2020.08.x not affected as the version was bumped)
|
||||
|
||||
Those changes will then be backported by a maintainer to the affected
|
||||
branches.
|
||||
|
||||
However, some bugs may apply only to a specific release, for example
|
||||
because it is using an older version of a package. In that case,
|
||||
patches should be based off the maintenance branch, and the patch
|
||||
subject prefix must include the maintenance branch name (for example
|
||||
"[PATCH 2020.02.x]"). This can be done with the git format-patch flag
|
||||
--subject-prefix:
|
||||
|
||||
$ git format-patch --subject-prefix "PATCH 2020.02.x" \
|
||||
-M -s -o outgoing origin/2020.02.x
|
||||
|
||||
Then send the patches with git send-email, as described above.
|
||||
|
||||
21.5.5. Patch revision changelog
|
||||
|
||||
When improvements are requested, the new revision of each commit
|
||||
should include a changelog of the modifications between each
|
||||
|
@ -1,4 +1,15 @@
|
||||
#!/bin/sh
|
||||
# devtmpfs does not get automounted for initramfs
|
||||
/bin/mount -t devtmpfs devtmpfs /dev
|
||||
|
||||
# use the /dev/console device node from devtmpfs if possible to not
|
||||
# confuse glibc's ttyname_r().
|
||||
# This may fail (E.G. booted with console=), and errors from exec will
|
||||
# terminate the shell, so use a subshell for the test
|
||||
if (exec 0</dev/console) 2>/dev/null; then
|
||||
exec 0</dev/console
|
||||
exec 1>/dev/console
|
||||
exec 2>/dev/console
|
||||
fi
|
||||
|
||||
exec /sbin/init "$@"
|
||||
|
@ -30,7 +30,7 @@ config BR2_LINUX_KERNEL_LATEST_VERSION
|
||||
bool "Latest version (5.4)"
|
||||
|
||||
config BR2_LINUX_KERNEL_LATEST_CIP_VERSION
|
||||
bool "Latest CIP SLTS version (4.19.118-cip25)"
|
||||
bool "Latest CIP SLTS version (4.19.132-cip30)"
|
||||
help
|
||||
CIP launched in the spring of 2016 to address the needs of
|
||||
organizations in industries such as power generation and
|
||||
@ -49,7 +49,7 @@ config BR2_LINUX_KERNEL_LATEST_CIP_VERSION
|
||||
https://www.cip-project.org
|
||||
|
||||
config BR2_LINUX_KERNEL_LATEST_CIP_RT_VERSION
|
||||
bool "Latest CIP RT SLTS version (4.19.115-cip24-rt9)"
|
||||
bool "Latest CIP RT SLTS version (4.19.132-cip30-rt12)"
|
||||
help
|
||||
Same as the CIP version, but this is the PREEMPT_RT realtime
|
||||
variant.
|
||||
@ -128,9 +128,9 @@ endif
|
||||
|
||||
config BR2_LINUX_KERNEL_VERSION
|
||||
string
|
||||
default "5.4.45" if BR2_LINUX_KERNEL_LATEST_VERSION
|
||||
default "4.19.118-cip25" if BR2_LINUX_KERNEL_LATEST_CIP_VERSION
|
||||
default "4.19.115-cip24-rt9" if BR2_LINUX_KERNEL_LATEST_CIP_RT_VERSION
|
||||
default "5.4.70" if BR2_LINUX_KERNEL_LATEST_VERSION
|
||||
default "4.19.132-cip30" if BR2_LINUX_KERNEL_LATEST_CIP_VERSION
|
||||
default "4.19.132-cip30-rt12" if BR2_LINUX_KERNEL_LATEST_CIP_RT_VERSION
|
||||
default BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE \
|
||||
if BR2_LINUX_KERNEL_CUSTOM_VERSION
|
||||
default "custom" if BR2_LINUX_KERNEL_CUSTOM_TARBALL
|
||||
|
@ -1,13 +1,13 @@
|
||||
# From https://www.kernel.org/pub/linux/kernel/v5.x/sha256sums.asc
|
||||
sha256 103f039f34a9009c42ea643b4f473bda6bb9607d5ad7f63b56b3e2351615fe2e linux-5.4.45.tar.xz
|
||||
sha256 c0b3d8085c5ba235df38b00b740e053659709e8a5ca21957a239f6bc22c45007 linux-5.4.70.tar.xz
|
||||
# From https://www.kernel.org/pub/linux/kernel/v4.x/sha256sums.asc
|
||||
sha256 418299385195f09b27e371a35f305f3aff148e7557a341b53460091303aa9bb7 linux-4.4.226.tar.xz
|
||||
sha256 460a8c168fe5c60ce5b30015a4e4bf348d93a89f8b949de1f90779567ef345ca linux-4.9.226.tar.xz
|
||||
sha256 4265afef56819b04656107a5abecde205c5bc5fb04b2e81447955e7e45db8085 linux-4.14.183.tar.xz
|
||||
sha256 82af886bc588b5c8d7474beb2bac13810ee3ed07da356a2553c81ae8e52e586f linux-4.19.127.tar.xz
|
||||
sha256 067814035c17e77dee84076dcc06a95eb675344cd926b7b79a16b80fee593364 linux-4.4.238.tar.xz
|
||||
sha256 b1eaf60b771ec4df0546d2b7539e164355008ea2f680a0642ae430e9cb134a3f linux-4.9.238.tar.xz
|
||||
sha256 5d404a0224a34b5379f1871cc46825487d557c2660459d2b5c3cd4871d699a38 linux-4.14.200.tar.xz
|
||||
sha256 f2f709ef086a4d8cb3c15a857daa44dfecf1b88d7d7c53c980fb180f6dccbace linux-4.19.150.tar.xz
|
||||
# Locally computed
|
||||
sha256 ea53913813cb5a9069608532b327de7a7ed0fdc8fed8c6f10cd55d1ac6a58ffb linux-cip-4.19.118-cip25.tar.gz
|
||||
sha256 7f0a0db0e1cfb14053523f4432f1ad1468b5bd42305b44905c4b103466c8d655 linux-cip-4.19.115-cip24-rt9.tar.gz
|
||||
sha256 c20f9014b89ea3e27f55f1d407aa5a4724ed38ac520c197291e9d644f164c43a linux-cip-4.19.132-cip30.tar.gz
|
||||
sha256 81dd791d9ad6c3fddaeaffc6d7d8df0e13831283a5fe494c437ac7820d79ca39 linux-cip-4.19.132-cip30-rt12.tar.gz
|
||||
|
||||
# Licenses hashes
|
||||
sha256 ee5808b032a67f587d3541099d46de34f5bec8cd5976114ba07f1299ee6001ff COPYING
|
||||
|
@ -160,7 +160,8 @@ endif
|
||||
|
||||
# Get the real Linux version, which tells us where kernel modules are
|
||||
# going to be installed in the target filesystem.
|
||||
LINUX_VERSION_PROBED = `$(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null`
|
||||
# Filter out 'w' from MAKEFLAGS, to workaround a bug in make 4.1 (#13141)
|
||||
LINUX_VERSION_PROBED = `MAKEFLAGS='$(filter-out w,$(MAKEFLAGS))' $(MAKE) $(LINUX_MAKE_FLAGS) -C $(LINUX_DIR) --no-print-directory -s kernelrelease 2>/dev/null`
|
||||
|
||||
LINUX_DTS_NAME += $(call qstrip,$(BR2_LINUX_KERNEL_INTREE_DTS_NAME))
|
||||
|
||||
@ -535,7 +536,8 @@ endef
|
||||
# Run depmod in a target-finalize hook, to encompass modules installed by
|
||||
# packages.
|
||||
define LINUX_RUN_DEPMOD
|
||||
if grep -q "CONFIG_MODULES=y" $(LINUX_DIR)/.config; then \
|
||||
if test -d $(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED) \
|
||||
&& grep -q "CONFIG_MODULES=y" $(LINUX_DIR)/.config; then \
|
||||
$(HOST_DIR)/sbin/depmod -a -b $(TARGET_DIR) $(LINUX_VERSION_PROBED); \
|
||||
fi
|
||||
endef
|
||||
|
@ -90,10 +90,10 @@ define ALSA_UTILS_INSTALL_INIT_SYSTEMD
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/alsa-restore.service
|
||||
$(INSTALL) -D -m 0644 $(@D)/alsactl/alsa-state.service \
|
||||
$(TARGET_DIR)/usr/lib/systemd/system/alsa-state.service
|
||||
mkdir $(TARGET_DIR)/usr/lib/systemd/system/alsa-restore.service.d
|
||||
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/lib/systemd/system/alsa-restore.service.d
|
||||
printf '[Install]\nWantedBy=multi-user.target\n' \
|
||||
>$(TARGET_DIR)/usr/lib/systemd/system/alsa-restore.service.d/buildroot-enable.conf
|
||||
mkdir $(TARGET_DIR)/usr/lib/systemd/system/alsa-state.service.d
|
||||
$(INSTALL) -d -m 0755 $(TARGET_DIR)/usr/lib/systemd/system/alsa-state.service.d
|
||||
printf '[Install]\nWantedBy=multi-user.target\n' \
|
||||
>$(TARGET_DIR)/usr/lib/systemd/system/alsa-state.service.d/buildroot-enable.conf;
|
||||
endef
|
||||
|
@ -1,4 +1,5 @@
|
||||
# From http://archive.apache.org/dist/httpd/httpd-2.4.43.tar.bz2.sha256
|
||||
sha256 a497652ab3fc81318cdc2a203090a999150d86461acff97c1065dc910fe10f43 httpd-2.4.43.tar.bz2
|
||||
# From http://archive.apache.org/dist/httpd/httpd-2.4.46.tar.bz2.{sha256,sha512}
|
||||
sha256 740eddf6e1c641992b22359cabc66e6325868c3c5e2e3f98faf349b61ecf41ea httpd-2.4.46.tar.bz2
|
||||
sha512 5936784bb662e9d8a4f7fe38b70c043b468114d931cd10ea831bfe74461ea5856b64f88f42c567ab791fc8907640a99884ba4b6a600f86d661781812735b6f13 httpd-2.4.46.tar.bz2
|
||||
# Locally computed
|
||||
sha256 47b8c2b6c3309282a99d4a3001575c790fead690cc14734628c4667d2bbffc43 LICENSE
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
APACHE_VERSION = 2.4.43
|
||||
APACHE_VERSION = 2.4.46
|
||||
APACHE_SOURCE = httpd-$(APACHE_VERSION).tar.bz2
|
||||
APACHE_SITE = http://archive.apache.org/dist/httpd
|
||||
APACHE_LICENSE = Apache-2.0
|
||||
|
@ -81,6 +81,7 @@ AVAHI_CONF_OPTS = \
|
||||
--disable-mono \
|
||||
--disable-monodoc \
|
||||
--disable-stack-protector \
|
||||
--disable-introspection \
|
||||
--with-distro=none \
|
||||
--disable-manpages \
|
||||
$(if $(BR2_PACKAGE_AVAHI_AUTOIPD),--enable,--disable)-autoipd \
|
||||
|
@ -5,7 +5,7 @@ After=network.target
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/usr/bin/bandwidthd
|
||||
PIDFile=/var/run/bandwidthd.pid
|
||||
PIDFile=/run/bandwidthd.pid
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
293
buildroot/package/bash/0017-bash50-017.patch
Normal file
293
buildroot/package/bash/0017-bash50-017.patch
Normal file
@ -0,0 +1,293 @@
|
||||
From https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash55-017
|
||||
|
||||
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
|
||||
|
||||
BASH PATCH REPORT
|
||||
=================
|
||||
|
||||
Bash-Release: 5.0
|
||||
Patch-ID: bash50-017
|
||||
|
||||
Bug-Reported-by: Valentin Lab <valentin.lab@kalysto.org>
|
||||
Bug-Reference-ID: <ab981b9c-60a5-46d0-b7e6-a6d88b80df50@kalysto.org>
|
||||
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2020-03/msg00062.html
|
||||
|
||||
Bug-Description:
|
||||
|
||||
There were cases where patch 16 reaped process substitution file descriptors
|
||||
(or FIFOs) and processes to early. This is a better fix for the problem that
|
||||
bash50-016 attempted to solve.
|
||||
|
||||
Patch (apply with `patch -p0'):
|
||||
|
||||
*** bash-5.0-patched/subst.c 2019-08-29 11:16:49.000000000 -0400
|
||||
--- b/subst.c 2020-04-02 16:24:19.000000000 -0400
|
||||
***************
|
||||
*** 5337,5341 ****
|
||||
}
|
||||
|
||||
! char *
|
||||
copy_fifo_list (sizep)
|
||||
int *sizep;
|
||||
--- b/5337,5341 ----
|
||||
}
|
||||
|
||||
! void *
|
||||
copy_fifo_list (sizep)
|
||||
int *sizep;
|
||||
***************
|
||||
*** 5343,5347 ****
|
||||
if (sizep)
|
||||
*sizep = 0;
|
||||
! return (char *)NULL;
|
||||
}
|
||||
|
||||
--- b/5343,5347 ----
|
||||
if (sizep)
|
||||
*sizep = 0;
|
||||
! return (void *)NULL;
|
||||
}
|
||||
|
||||
***************
|
||||
*** 5409,5414 ****
|
||||
if (fifo_list[i].file)
|
||||
{
|
||||
! fifo_list[j].file = fifo_list[i].file;
|
||||
! fifo_list[j].proc = fifo_list[i].proc;
|
||||
j++;
|
||||
}
|
||||
--- b/5409,5419 ----
|
||||
if (fifo_list[i].file)
|
||||
{
|
||||
! if (i != j)
|
||||
! {
|
||||
! fifo_list[j].file = fifo_list[i].file;
|
||||
! fifo_list[j].proc = fifo_list[i].proc;
|
||||
! fifo_list[i].file = (char *)NULL;
|
||||
! fifo_list[i].proc = 0;
|
||||
! }
|
||||
j++;
|
||||
}
|
||||
***************
|
||||
*** 5426,5433 ****
|
||||
void
|
||||
close_new_fifos (list, lsize)
|
||||
! char *list;
|
||||
int lsize;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (list == 0)
|
||||
--- b/5431,5439 ----
|
||||
void
|
||||
close_new_fifos (list, lsize)
|
||||
! void *list;
|
||||
int lsize;
|
||||
{
|
||||
int i;
|
||||
+ char *plist;
|
||||
|
||||
if (list == 0)
|
||||
***************
|
||||
*** 5437,5442 ****
|
||||
}
|
||||
|
||||
! for (i = 0; i < lsize; i++)
|
||||
! if (list[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1)
|
||||
unlink_fifo (i);
|
||||
|
||||
--- b/5443,5448 ----
|
||||
}
|
||||
|
||||
! for (plist = (char *)list, i = 0; i < lsize; i++)
|
||||
! if (plist[i] == 0 && i < fifo_list_size && fifo_list[i].proc != -1)
|
||||
unlink_fifo (i);
|
||||
|
||||
***************
|
||||
*** 5560,5568 ****
|
||||
}
|
||||
|
||||
! char *
|
||||
copy_fifo_list (sizep)
|
||||
int *sizep;
|
||||
{
|
||||
! char *ret;
|
||||
|
||||
if (nfds == 0 || totfds == 0)
|
||||
--- b/5566,5574 ----
|
||||
}
|
||||
|
||||
! void *
|
||||
copy_fifo_list (sizep)
|
||||
int *sizep;
|
||||
{
|
||||
! void *ret;
|
||||
|
||||
if (nfds == 0 || totfds == 0)
|
||||
***************
|
||||
*** 5570,5579 ****
|
||||
if (sizep)
|
||||
*sizep = 0;
|
||||
! return (char *)NULL;
|
||||
}
|
||||
|
||||
if (sizep)
|
||||
*sizep = totfds;
|
||||
! ret = (char *)xmalloc (totfds * sizeof (pid_t));
|
||||
return (memcpy (ret, dev_fd_list, totfds * sizeof (pid_t)));
|
||||
}
|
||||
--- b/5576,5585 ----
|
||||
if (sizep)
|
||||
*sizep = 0;
|
||||
! return (void *)NULL;
|
||||
}
|
||||
|
||||
if (sizep)
|
||||
*sizep = totfds;
|
||||
! ret = xmalloc (totfds * sizeof (pid_t));
|
||||
return (memcpy (ret, dev_fd_list, totfds * sizeof (pid_t)));
|
||||
}
|
||||
***************
|
||||
*** 5648,5655 ****
|
||||
void
|
||||
close_new_fifos (list, lsize)
|
||||
! char *list;
|
||||
int lsize;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (list == 0)
|
||||
--- b/5654,5662 ----
|
||||
void
|
||||
close_new_fifos (list, lsize)
|
||||
! void *list;
|
||||
int lsize;
|
||||
{
|
||||
int i;
|
||||
+ pid_t *plist;
|
||||
|
||||
if (list == 0)
|
||||
***************
|
||||
*** 5659,5664 ****
|
||||
}
|
||||
|
||||
! for (i = 0; i < lsize; i++)
|
||||
! if (list[i] == 0 && i < totfds && dev_fd_list[i])
|
||||
unlink_fifo (i);
|
||||
|
||||
--- b/5666,5671 ----
|
||||
}
|
||||
|
||||
! for (plist = (pid_t *)list, i = 0; i < lsize; i++)
|
||||
! if (plist[i] == 0 && i < totfds && dev_fd_list[i])
|
||||
unlink_fifo (i);
|
||||
|
||||
*** bash-5.0-patched/subst.h 2018-10-21 18:46:09.000000000 -0400
|
||||
--- b/subst.h 2020-04-02 16:29:28.000000000 -0400
|
||||
***************
|
||||
*** 274,280 ****
|
||||
extern void unlink_fifo __P((int));
|
||||
|
||||
! extern char *copy_fifo_list __P((int *));
|
||||
! extern void unlink_new_fifos __P((char *, int));
|
||||
! extern void close_new_fifos __P((char *, int));
|
||||
|
||||
extern void clear_fifo_list __P((void));
|
||||
--- b/274,279 ----
|
||||
extern void unlink_fifo __P((int));
|
||||
|
||||
! extern void *copy_fifo_list __P((int *));
|
||||
! extern void close_new_fifos __P((void *, int));
|
||||
|
||||
extern void clear_fifo_list __P((void));
|
||||
*** bash-5.0-patched/execute_cmd.c 2020-02-06 20:16:48.000000000 -0500
|
||||
--- b/execute_cmd.c 2020-04-02 17:00:10.000000000 -0400
|
||||
***************
|
||||
*** 565,569 ****
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
volatile int ofifo, nfifo, osize, saved_fifo;
|
||||
! volatile char *ofifo_list;
|
||||
#endif
|
||||
|
||||
--- b/565,569 ----
|
||||
#if defined (PROCESS_SUBSTITUTION)
|
||||
volatile int ofifo, nfifo, osize, saved_fifo;
|
||||
! volatile void *ofifo_list;
|
||||
#endif
|
||||
|
||||
***************
|
||||
*** 751,760 ****
|
||||
# endif
|
||||
|
||||
! if (variable_context != 0) /* XXX - also if sourcelevel != 0? */
|
||||
{
|
||||
ofifo = num_fifos ();
|
||||
ofifo_list = copy_fifo_list ((int *)&osize);
|
||||
begin_unwind_frame ("internal_fifos");
|
||||
! add_unwind_protect (xfree, ofifo_list);
|
||||
saved_fifo = 1;
|
||||
}
|
||||
--- b/751,762 ----
|
||||
# endif
|
||||
|
||||
! /* XXX - also if sourcelevel != 0? */
|
||||
! if (variable_context != 0)
|
||||
{
|
||||
ofifo = num_fifos ();
|
||||
ofifo_list = copy_fifo_list ((int *)&osize);
|
||||
begin_unwind_frame ("internal_fifos");
|
||||
! if (ofifo_list)
|
||||
! add_unwind_protect (xfree, ofifo_list);
|
||||
saved_fifo = 1;
|
||||
}
|
||||
***************
|
||||
*** 1100,1123 ****
|
||||
nfifo = num_fifos ();
|
||||
if (nfifo > ofifo)
|
||||
! close_new_fifos ((char *)ofifo_list, osize);
|
||||
free ((void *)ofifo_list);
|
||||
discard_unwind_frame ("internal_fifos");
|
||||
}
|
||||
- # if defined (HAVE_DEV_FD)
|
||||
- /* Reap process substitutions at the end of loops */
|
||||
- switch (command->type)
|
||||
- {
|
||||
- case cm_while:
|
||||
- case cm_until:
|
||||
- case cm_for:
|
||||
- case cm_group:
|
||||
- # if defined (ARITH_FOR_COMMAND)
|
||||
- case cm_arith_for:
|
||||
- # endif
|
||||
- reap_procsubs ();
|
||||
- default:
|
||||
- break;
|
||||
- }
|
||||
- # endif /* HAVE_DEV_FD */
|
||||
#endif
|
||||
|
||||
--- b/1102,1109 ----
|
||||
nfifo = num_fifos ();
|
||||
if (nfifo > ofifo)
|
||||
! close_new_fifos ((void *)ofifo_list, osize);
|
||||
free ((void *)ofifo_list);
|
||||
discard_unwind_frame ("internal_fifos");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
*** bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
|
||||
--- b/patchlevel.h 2016-10-01 11:01:28.000000000 -0400
|
||||
***************
|
||||
*** 26,30 ****
|
||||
looks for to find the patch level (for the sccs version string). */
|
||||
|
||||
! #define PATCHLEVEL 16
|
||||
|
||||
#endif /* _PATCHLEVEL_H_ */
|
||||
--- b/26,30 ----
|
||||
looks for to find the patch level (for the sccs version string). */
|
||||
|
||||
! #define PATCHLEVEL 17
|
||||
|
||||
#endif /* _PATCHLEVEL_H_ */
|
49
buildroot/package/bash/0018-bash50-018.patch
Normal file
49
buildroot/package/bash/0018-bash50-018.patch
Normal file
@ -0,0 +1,49 @@
|
||||
From https://ftp.gnu.org/gnu/bash/bash-5.0-patches/bash55-018
|
||||
|
||||
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
|
||||
|
||||
BASH PATCH REPORT
|
||||
=================
|
||||
|
||||
Bash-Release: 5.0
|
||||
Patch-ID: bash50-018
|
||||
|
||||
Bug-Reported-by: oguzismailuysal@gmail.com
|
||||
Bug-Reference-ID:
|
||||
Bug-Reference-URL: https://lists.gnu.org/archive/html/bug-bash/2019-10/msg00098.html
|
||||
|
||||
Bug-Description:
|
||||
|
||||
In certain cases, bash does not perform quoted null removal on patterns
|
||||
that are used as part of word expansions such as ${parameter##pattern}, so
|
||||
empty patterns are treated as non-empty.
|
||||
|
||||
Patch (apply with `patch -p0'):
|
||||
|
||||
*** bash-5.0.17/subst.c 2020-04-02 17:14:58.000000000 -0400
|
||||
--- b/subst.c 2020-07-09 15:28:19.000000000 -0400
|
||||
***************
|
||||
*** 5113,5116 ****
|
||||
--- b/5113,5118 ----
|
||||
(int *)NULL, (int *)NULL)
|
||||
: (WORD_LIST *)0;
|
||||
+ if (l)
|
||||
+ word_list_remove_quoted_nulls (l);
|
||||
pat = string_list (l);
|
||||
dispose_words (l);
|
||||
|
||||
*** bash-5.0/patchlevel.h 2016-06-22 14:51:03.000000000 -0400
|
||||
--- b/patchlevel.h 2016-10-01 11:01:28.000000000 -0400
|
||||
***************
|
||||
*** 26,30 ****
|
||||
looks for to find the patch level (for the sccs version string). */
|
||||
|
||||
! #define PATCHLEVEL 17
|
||||
|
||||
#endif /* _PATCHLEVEL_H_ */
|
||||
--- b/26,30 ----
|
||||
looks for to find the patch level (for the sccs version string). */
|
||||
|
||||
! #define PATCHLEVEL 18
|
||||
|
||||
#endif /* _PATCHLEVEL_H_ */
|
@ -1,4 +1,4 @@
|
||||
# Verified from https://ftp.isc.org/isc/bind9/9.11.20/bind-9.11.20.tar.gz.asc
|
||||
# Verified from https://ftp.isc.org/isc/bind9/9.11.22/bind-9.11.22.tar.gz.asc
|
||||
# with key AE3FAC796711EC59FC007AA474BB6B9A4CBB3D38
|
||||
sha256 306831a738a275693bbe1d6839a09b34a2c8b5c26f8a42ea57ef000a6a99c2b6 bind-9.11.20.tar.gz
|
||||
sha256 afc6d8015006f1cabf699ff19f517bb8fd9c1811e5231f26baf51c3550262ac9 bind-9.11.22.tar.gz
|
||||
sha256 da2aec2b7f6f0feb16bcb080e2c587375fd3195145f047e4d92d112f5b9db501 COPYRIGHT
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
BIND_VERSION = 9.11.20
|
||||
BIND_VERSION = 9.11.22
|
||||
BIND_SITE = https://ftp.isc.org/isc/bind9/$(BIND_VERSION)
|
||||
# bind does not support parallel builds.
|
||||
BIND_MAKE = $(MAKE1)
|
||||
|
@ -13,5 +13,6 @@ BISON_LICENSE_FILES = COPYING
|
||||
BISON_MAKE = $(MAKE1)
|
||||
HOST_BISON_DEPENDENCIES = host-m4
|
||||
HOST_BISON_CONF_OPTS = --enable-relocatable
|
||||
HOST_BISON_CONF_ENV = ac_cv_libtextstyle=no
|
||||
|
||||
$(eval $(host-autotools-package))
|
||||
|
@ -134,6 +134,7 @@ define BOOST_CONFIGURE_CMDS
|
||||
(cd $(@D) && ./bootstrap.sh $(BOOST_FLAGS))
|
||||
echo "using gcc : `$(TARGET_CC) -dumpversion` : $(TARGET_CXX) : <cxxflags>\"$(BOOST_TARGET_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > $(@D)/user-config.jam
|
||||
echo "" >> $(@D)/user-config.jam
|
||||
sed -i "s/: -O.* ;/: $(TARGET_OPTIMIZATION) ;/" $(@D)/tools/build/src/tools/gcc.jam
|
||||
endef
|
||||
|
||||
define BOOST_BUILD_CMDS
|
||||
|
@ -1,6 +1,6 @@
|
||||
From 7289e5a378ba13801996a84d89d8fe95c3fc4c11 Mon Sep 17 00:00:00 2001
|
||||
From 6cb16322decd643fed9de332d9cda77f7738b7af Mon Sep 17 00:00:00 2001
|
||||
From: Adrian Perez de Castro <aperez@igalia.com>
|
||||
Date: Mon, 26 Mar 2018 19:08:31 +0100
|
||||
Date: Mon, 7 Sep 2020 12:14:22 +0300
|
||||
Subject: [PATCH] CMake: Allow using BUILD_SHARED_LIBS to choose static/shared
|
||||
libs
|
||||
|
||||
@ -18,16 +18,16 @@ This way, the following will both work as expected:
|
||||
|
||||
This is helpful for distributions which need (or want) to build only
|
||||
static libraries.
|
||||
---
|
||||
CMakeLists.txt | 42 ++++++++++++++----------------------------
|
||||
c/fuzz/test_fuzzer.sh | 6 +++---
|
||||
2 files changed, 17 insertions(+), 31 deletions(-)
|
||||
|
||||
Signed-off-by: Adrian Perez de Castro <aperez@igalia.com>
|
||||
Upstream-Status: Submitted [https://github.com/google/brotli/pull/655]
|
||||
[Upstream status: https://github.com/google/brotli/pull/655]
|
||||
---
|
||||
CMakeLists.txt | 46 ++++++++++++++-----------------------------
|
||||
c/fuzz/test_fuzzer.sh | 6 +++---
|
||||
2 files changed, 18 insertions(+), 34 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index fc45f80..3f87f13 100644
|
||||
index 4ff3401..f889311 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -6,6 +6,8 @@ cmake_minimum_required(VERSION 2.8.6)
|
||||
@ -36,10 +36,10 @@ index fc45f80..3f87f13 100644
|
||||
|
||||
+option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
+
|
||||
# If Brotli is being bundled in another project, we don't want to
|
||||
# install anything. However, we want to let people override this, so
|
||||
# we'll use the BROTLI_BUNDLED_MODE variable to let them do that; just
|
||||
@@ -114,10 +116,6 @@ set(BROTLI_LIBRARIES_CORE brotlienc brotlidec brotlicommon)
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message(STATUS "Setting build type to Release as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build." FORCE)
|
||||
@@ -137,10 +139,6 @@ set(BROTLI_LIBRARIES_CORE brotlienc brotlidec brotlicommon)
|
||||
set(BROTLI_LIBRARIES ${BROTLI_LIBRARIES_CORE} ${LIBM_LIBRARY})
|
||||
mark_as_advanced(BROTLI_LIBRARIES)
|
||||
|
||||
@ -50,14 +50,20 @@ index fc45f80..3f87f13 100644
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
add_definitions(-DOS_LINUX)
|
||||
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
@@ -137,24 +135,22 @@ endfunction()
|
||||
transform_sources_list("scripts/sources.lst" "${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake")
|
||||
@@ -161,29 +159,25 @@ transform_sources_list("scripts/sources.lst" "${CMAKE_CURRENT_BINARY_DIR}/source
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake")
|
||||
|
||||
-add_library(brotlicommon SHARED ${BROTLI_COMMON_C})
|
||||
-add_library(brotlidec SHARED ${BROTLI_DEC_C})
|
||||
-add_library(brotlienc SHARED ${BROTLI_ENC_C})
|
||||
-
|
||||
if(BROTLI_EMSCRIPTEN)
|
||||
- set(BROTLI_SHARED_LIBS "")
|
||||
-else()
|
||||
- set(BROTLI_SHARED_LIBS brotlicommon brotlidec brotlienc)
|
||||
- add_library(brotlicommon SHARED ${BROTLI_COMMON_C})
|
||||
- add_library(brotlidec SHARED ${BROTLI_DEC_C})
|
||||
- add_library(brotlienc SHARED ${BROTLI_ENC_C})
|
||||
+ set(BUILD_SHARED_LIBS OFF)
|
||||
endif()
|
||||
|
||||
-set(BROTLI_STATIC_LIBS brotlicommon-static brotlidec-static brotlienc-static)
|
||||
-add_library(brotlicommon-static STATIC ${BROTLI_COMMON_C})
|
||||
-add_library(brotlidec-static STATIC ${BROTLI_DEC_C})
|
||||
-add_library(brotlienc-static STATIC ${BROTLI_ENC_C})
|
||||
@ -68,27 +74,27 @@ index fc45f80..3f87f13 100644
|
||||
# Older CMake versions does not understand INCLUDE_DIRECTORIES property.
|
||||
include_directories(${BROTLI_INCLUDE_DIRS})
|
||||
|
||||
-foreach(lib IN LISTS BROTLI_SHARED_LIBS)
|
||||
- target_compile_definitions(${lib} PUBLIC "BROTLI_SHARED_COMPILATION" )
|
||||
- string(TOUPPER "${lib}" LIB)
|
||||
- set_target_properties (${lib} PROPERTIES DEFINE_SYMBOL "${LIB}_SHARED_COMPILATION")
|
||||
-endforeach()
|
||||
+if(BUILD_SHARED_LIBS)
|
||||
+ foreach(lib brotlicommon brotlidec brotlienc)
|
||||
+ target_compile_definitions(${lib} PUBLIC "BROTLI_SHARED_COMPILATION" )
|
||||
+ string(TOUPPER "${lib}" LIB)
|
||||
+ set_target_properties (${lib} PROPERTIES DEFINE_SYMBOL "${LIB}_SHARED_COMPILATION" )
|
||||
+ set_target_properties (${lib} PROPERTIES DEFINE_SYMBOL "${LIB}_SHARED_COMPILATION")
|
||||
+ endforeach()
|
||||
+endif()
|
||||
+
|
||||
foreach(lib brotlicommon brotlidec brotlienc)
|
||||
- target_compile_definitions(${lib} PUBLIC "BROTLI_SHARED_COMPILATION" )
|
||||
- string(TOUPPER "${lib}" LIB)
|
||||
- set_target_properties (${lib} PROPERTIES DEFINE_SYMBOL "${LIB}_SHARED_COMPILATION" )
|
||||
-endforeach()
|
||||
-
|
||||
-foreach(lib brotlicommon brotlidec brotlienc brotlicommon-static brotlidec-static brotlienc-static)
|
||||
|
||||
-foreach(lib IN LISTS BROTLI_SHARED_LIBS BROTLI_STATIC_LIBS)
|
||||
+foreach(lib brotlicommon brotlidec brotlienc)
|
||||
target_link_libraries(${lib} ${LIBM_LIBRARY})
|
||||
set_property(TARGET ${lib} APPEND PROPERTY INCLUDE_DIRECTORIES ${BROTLI_INCLUDE_DIRS})
|
||||
set_target_properties(${lib} PROPERTIES
|
||||
@@ -167,9 +163,6 @@ endforeach()
|
||||
target_link_libraries(brotlidec brotlicommon)
|
||||
@@ -200,9 +194,6 @@ target_link_libraries(brotlidec brotlicommon)
|
||||
target_link_libraries(brotlienc brotlicommon)
|
||||
endif()
|
||||
|
||||
-target_link_libraries(brotlidec-static brotlicommon-static)
|
||||
-target_link_libraries(brotlienc-static brotlicommon-static)
|
||||
@ -96,7 +102,7 @@ index fc45f80..3f87f13 100644
|
||||
# For projects stuck on older versions of CMake, this will set the
|
||||
# BROTLI_INCLUDE_DIRS and BROTLI_LIBRARIES variables so they still
|
||||
# have a relatively easy way to use Brotli:
|
||||
@@ -183,7 +176,7 @@ endif()
|
||||
@@ -216,7 +207,7 @@ endif()
|
||||
|
||||
# Build the brotli executable
|
||||
add_executable(brotli ${BROTLI_CLI_C})
|
||||
@ -104,8 +110,8 @@ index fc45f80..3f87f13 100644
|
||||
+target_link_libraries(brotli ${BROTLI_LIBRARIES})
|
||||
|
||||
# Installation
|
||||
if(NOT BROTLI_BUNDLED_MODE)
|
||||
@@ -199,13 +192,6 @@ if(NOT BROTLI_BUNDLED_MODE)
|
||||
if(NOT BROTLI_EMSCRIPTEN)
|
||||
@@ -233,13 +224,6 @@ if(NOT BROTLI_BUNDLED_MODE)
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
)
|
||||
|
||||
@ -119,26 +125,6 @@ index fc45f80..3f87f13 100644
|
||||
install(
|
||||
DIRECTORY ${BROTLI_INCLUDE_DIRS}/brotli
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
diff --git a/c/fuzz/test_fuzzer.sh b/c/fuzz/test_fuzzer.sh
|
||||
index 9985194..4b99947 100755
|
||||
--- a/c/fuzz/test_fuzzer.sh
|
||||
+++ b/c/fuzz/test_fuzzer.sh
|
||||
@@ -13,12 +13,12 @@ mkdir bin
|
||||
cd bin
|
||||
|
||||
cmake $BROTLI -DCMAKE_C_COMPILER="$CC" \
|
||||
- -DBUILD_TESTING=OFF -DENABLE_SANITIZER=address
|
||||
-make -j$(nproc) brotlidec-static
|
||||
+ -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_SANITIZER=address
|
||||
+make -j$(nproc) brotlidec
|
||||
|
||||
${CC} -o run_decode_fuzzer -std=c99 -fsanitize=address -I$SRC/include \
|
||||
$SRC/fuzz/decode_fuzzer.c $SRC/fuzz/run_decode_fuzzer.c \
|
||||
- ./libbrotlidec-static.a ./libbrotlicommon-static.a
|
||||
+ ./libbrotlidec.a ./libbrotlicommon.a
|
||||
|
||||
mkdir decode_corpora
|
||||
unzip $BROTLI/java/org/brotli/integration/fuzz_data.zip -d decode_corpora
|
||||
--
|
||||
2.19.1
|
||||
2.28.0
|
||||
|
||||
|
@ -0,0 +1,51 @@
|
||||
From 09b0992b6acb7faa6fd3b23f9bc036ea117230fc Mon Sep 17 00:00:00 2001
|
||||
From: Eugene Kliuchnikov <eustas.ru@gmail.com>
|
||||
Date: Wed, 2 Sep 2020 11:38:26 +0200
|
||||
Subject: [PATCH] Revert "Add runtime linker path to pkg-config files (#740)"
|
||||
(#838)
|
||||
|
||||
This reverts commit 31754d4ffce14153b5c2addf7a11019ec23f51c1.
|
||||
[Retrieved from:
|
||||
https://github.com/google/brotli/commit/09b0992b6acb7faa6fd3b23f9bc036ea117230fc]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
scripts/libbrotlicommon.pc.in | 2 +-
|
||||
scripts/libbrotlidec.pc.in | 2 +-
|
||||
scripts/libbrotlienc.pc.in | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/scripts/libbrotlicommon.pc.in b/scripts/libbrotlicommon.pc.in
|
||||
index 10ca969e..2a8cf7a3 100644
|
||||
--- a/scripts/libbrotlicommon.pc.in
|
||||
+++ b/scripts/libbrotlicommon.pc.in
|
||||
@@ -7,5 +7,5 @@ Name: libbrotlicommon
|
||||
URL: https://github.com/google/brotli
|
||||
Description: Brotli common dictionary library
|
||||
Version: @PACKAGE_VERSION@
|
||||
-Libs: -L${libdir} -R${libdir} -lbrotlicommon
|
||||
+Libs: -L${libdir} -lbrotlicommon
|
||||
Cflags: -I${includedir}
|
||||
diff --git a/scripts/libbrotlidec.pc.in b/scripts/libbrotlidec.pc.in
|
||||
index e7c3124f..6f8ef2e4 100644
|
||||
--- a/scripts/libbrotlidec.pc.in
|
||||
+++ b/scripts/libbrotlidec.pc.in
|
||||
@@ -7,6 +7,6 @@ Name: libbrotlidec
|
||||
URL: https://github.com/google/brotli
|
||||
Description: Brotli decoder library
|
||||
Version: @PACKAGE_VERSION@
|
||||
-Libs: -L${libdir} -R${libdir} -lbrotlidec
|
||||
+Libs: -L${libdir} -lbrotlidec
|
||||
Requires.private: libbrotlicommon >= 1.0.2
|
||||
Cflags: -I${includedir}
|
||||
diff --git a/scripts/libbrotlienc.pc.in b/scripts/libbrotlienc.pc.in
|
||||
index 4dd0811b..2098afe2 100644
|
||||
--- a/scripts/libbrotlienc.pc.in
|
||||
+++ b/scripts/libbrotlienc.pc.in
|
||||
@@ -7,6 +7,6 @@ Name: libbrotlienc
|
||||
URL: https://github.com/google/brotli
|
||||
Description: Brotli encoder library
|
||||
Version: @PACKAGE_VERSION@
|
||||
-Libs: -L${libdir} -R${libdir} -lbrotlienc
|
||||
+Libs: -L${libdir} -lbrotlienc
|
||||
Requires.private: libbrotlicommon >= 1.0.2
|
||||
Cflags: -I${includedir}
|
@ -1,5 +1,5 @@
|
||||
# Locally generated:
|
||||
sha512 a82362aa36d2f2094bca0b2808d9de0d57291fb3a4c29d7c0ca0a37e73087ec5ac4df299c8c363e61106fccf2fe7f58b5cf76eb97729e2696058ef43b1d3930a v1.0.7.tar.gz
|
||||
sha512 b8e2df955e8796ac1f022eb4ebad29532cb7e3aa6a4b6aee91dbd2c7d637eee84d9a144d3e878895bb5e62800875c2c01c8f737a1261020c54feacf9f676b5f5 v1.0.9.tar.gz
|
||||
|
||||
# Hash for license files:
|
||||
sha512 bae78184c2f50f86d8c727826d3982c469454c42b9af81f4ef007e39036434fa894cf5be3bf5fc65b7de2301f0a72d067a8186e303327db8a96bd14867e0a3a8 LICENSE
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
BROTLI_VERSION = 1.0.7
|
||||
BROTLI_VERSION = 1.0.9
|
||||
BROTLI_SOURCE = v$(BROTLI_VERSION).tar.gz
|
||||
BROTLI_SITE = https://github.com/google/brotli/archive
|
||||
BROTLI_LICENSE = MIT
|
||||
|
@ -237,6 +237,18 @@ define BUSYBOX_SET_SELINUX
|
||||
endef
|
||||
endif
|
||||
|
||||
# enable relevant options to allow the Busybox less applet to be used
|
||||
# as a systemd pager
|
||||
ifeq ($(BR2_PACKAGE_SYSTEMD):$(BR2_PACKAGE_LESS),y:)
|
||||
define BUSYBOX_SET_LESS_FLAGS
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_LESS_DASHCMD)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_LESS_RAW)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_LESS_TRUNCATE)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_LESS_FLAGS)
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_LESS_ENV)
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_PACKAGE_BUSYBOX_INDIVIDUAL_BINARIES),y)
|
||||
define BUSYBOX_SET_INDIVIDUAL_BINARIES
|
||||
$(call KCONFIG_ENABLE_OPT,CONFIG_BUILD_LIBBUSYBOX,$(BUSYBOX_BUILD_CONFIG))
|
||||
@ -338,6 +350,7 @@ define BUSYBOX_KCONFIG_FIXUP_CMDS
|
||||
$(BUSYBOX_SET_INIT)
|
||||
$(BUSYBOX_SET_WATCHDOG)
|
||||
$(BUSYBOX_SET_SELINUX)
|
||||
$(BUSYBOX_SET_LESS_FLAGS)
|
||||
$(BUSYBOX_SET_INDIVIDUAL_BINARIES)
|
||||
endef
|
||||
|
||||
|
@ -42,19 +42,19 @@ case "$1" in
|
||||
rm -f $TMPFILE
|
||||
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -k $interface
|
||||
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
|
||||
fi
|
||||
;;
|
||||
|
||||
leasefail|nak)
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -wD $interface --no-chroot
|
||||
/usr/sbin/avahi-autoipd -c $interface || /usr/sbin/avahi-autoipd -wD $interface --no-chroot
|
||||
fi
|
||||
;;
|
||||
|
||||
renew|bound)
|
||||
if [ -x /usr/sbin/avahi-autoipd ]; then
|
||||
/usr/sbin/avahi-autoipd -k $interface
|
||||
/usr/sbin/avahi-autoipd -c $interface && /usr/sbin/avahi-autoipd -k $interface
|
||||
fi
|
||||
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
|
||||
if [ -n "$ipv6" ] ; then
|
||||
|
@ -21,5 +21,12 @@ endif
|
||||
# The actual source to be compiled is within a 'c++' subdirectory
|
||||
CAPNPROTO_SUBDIR = c++
|
||||
|
||||
ifeq ($(BR2_PACKAGE_OPENSSL),y)
|
||||
CAPNPROTO_CONF_OPTS += --with-openssl
|
||||
CAPNPROTO_DEPENDENCIES += openssl
|
||||
else
|
||||
CAPNPROTO_CONF_OPTS += --without-openssl
|
||||
endif
|
||||
|
||||
$(eval $(autotools-package))
|
||||
$(eval $(host-autotools-package))
|
||||
|
@ -1,5 +1,4 @@
|
||||
# From https://listengine.tuxfamily.org/chrony.tuxfamily.org/chrony-announce/2019/05/msg00001.html
|
||||
md5 5f66338bc940a9b51eede8f391e7bed3 chrony-3.5.tar.gz
|
||||
sha1 79e9aeace143550300387a99f17bff04b45673f7 chrony-3.5.tar.gz
|
||||
# From https://listengine.tuxfamily.org/chrony.tuxfamily.org/chrony-announce/2020/08/msg00000.html
|
||||
sha256 1ba82f70db85d414cd7420c39858e3ceca4b9eb8b028cbe869512c3a14a2dca7 chrony-3.5.1.tar.gz
|
||||
# Locally calculated
|
||||
sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 COPYING
|
||||
sha256 ab15fd526bd8dd18a9e77ebc139656bf4d33e97fc7238cd11bf60e2b9b8666c6 COPYING
|
||||
|
@ -4,7 +4,7 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
CHRONY_VERSION = 3.5
|
||||
CHRONY_VERSION = 3.5.1
|
||||
CHRONY_SITE = http://download.tuxfamily.org/chrony
|
||||
CHRONY_LICENSE = GPL-2.0
|
||||
CHRONY_LICENSE_FILES = COPYING
|
||||
|
@ -0,0 +1,41 @@
|
||||
From dbb4452787cb966cc74b2015689961875fd5d668 Mon Sep 17 00:00:00 2001
|
||||
From: Ryan Barnett <ryanbarnett3@gmail.com>
|
||||
Date: Mon, 27 Apr 2020 22:03:25 -0500
|
||||
Subject: [PATCH] Use DESTDIR when installing mount.smb3 and optionally install
|
||||
man page
|
||||
|
||||
Properly create mount.smb3 symlink by using DESTDIR. Also use
|
||||
CONFIG_MAN to optionally install manpage for mount.smb3.
|
||||
|
||||
Signed-off-by: Ryan Barnett <ryanbarnett3@gmail.com>
|
||||
---
|
||||
Upstream: https://marc.info/?l=linux-cifs&m=158804444725745&w=2
|
||||
---
|
||||
Makefile.am | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/Makefile.am b/Makefile.am
|
||||
index fe9cd34..e0587f1 100644
|
||||
--- a/Makefile.am
|
||||
+++ b/Makefile.am
|
||||
@@ -119,11 +119,13 @@ endif
|
||||
SUBDIRS = contrib
|
||||
|
||||
install-exec-hook:
|
||||
- (cd $(ROOTSBINDIR) && ln -sf mount.cifs mount.smb3)
|
||||
+ (cd $(DESTDIR)$(ROOTSBINDIR) && ln -sf mount.cifs mount.smb3)
|
||||
|
||||
+if CONFIG_MAN
|
||||
install-data-hook:
|
||||
- (cd $(man8dir) && ln -sf mount.cifs.8 mount.smb3.8)
|
||||
+ (cd $(DESTDIR)$(man8dir) && ln -sf mount.cifs.8 mount.smb3.8)
|
||||
+endif
|
||||
|
||||
uninstall-hook:
|
||||
- (cd $(ROOTSBINDIR) && rm -f $(ROOTSBINDIR)/mount.smb3)
|
||||
- (cd $(man8dir) && rm -f $(man8dir)/mount.smb3.8)
|
||||
+ rm -f $(DESTDIR)$(ROOTSBINDIR)/mount.smb3
|
||||
+ rm -f $(DESTDIR)$(man8dir)/mount.smb3.8
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Locally calculated after checking pgp signature
|
||||
sha256 18d8f1bf92c13c4d611502dbd6759e3a766ddc8467ec8a2eda3f589e40b9ac9c cifs-utils-6.9.tar.bz2
|
||||
sha256 b859239a3f204f8220d3e54ed43bf8109e1ef202042dd87ba87492f8878728d9 cifs-utils-6.11.tar.bz2
|
||||
|
||||
# Hash for license file:
|
||||
sha256 8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903 COPYING
|
||||
sha256 8ceb4b9ee5adedde47b31e975c1d90c73ad27b6b165a1dcd80c7c545eb65b903 COPYING
|
||||
|
@ -4,12 +4,12 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
CIFS_UTILS_VERSION = 6.9
|
||||
CIFS_UTILS_VERSION = 6.11
|
||||
CIFS_UTILS_SOURCE = cifs-utils-$(CIFS_UTILS_VERSION).tar.bz2
|
||||
CIFS_UTILS_SITE = http://ftp.samba.org/pub/linux-cifs/cifs-utils
|
||||
CIFS_UTILS_LICENSE = GPL-3.0+
|
||||
CIFS_UTILS_LICENSE_FILES = COPYING
|
||||
# Missing install-sh in release tarball
|
||||
# Missing install-sh in release tarball and patching Makefile.am
|
||||
CIFS_UTILS_AUTORECONF = YES
|
||||
CIFS_UTILS_DEPENDENCIES = host-pkgconf
|
||||
|
||||
@ -17,6 +17,9 @@ CIFS_UTILS_DEPENDENCIES = host-pkgconf
|
||||
# the global BR2_RELRO_FULL option.
|
||||
CIFS_UTILS_CONF_OPTS = --disable-pie --disable-man
|
||||
|
||||
# uses C11 code in smbinfo.c and mtab.c
|
||||
CIFS_UTILS_CONF_ENV += CFLAGS="$(TARGET_CFLAGS) -std=gnu11"
|
||||
|
||||
ifeq ($(BR2_PACKAGE_KEYUTILS),y)
|
||||
CIFS_UTILS_DEPENDENCIES += keyutils
|
||||
endif
|
||||
|
@ -593,7 +593,6 @@ comment "grpc needs a toolchain w/ C++, gcc >= 4.8"
|
||||
|
||||
config BR2_PACKAGE_COLLECTD_MQTT
|
||||
bool "mqtt"
|
||||
depends on BR2_TOOLCHAIN_HAS_SYNC_4 # mosquitto
|
||||
select BR2_PACKAGE_MOSQUITTO
|
||||
help
|
||||
Sends metrics to and/or receives metrics from an MQTT broker.
|
||||
|
30
buildroot/package/cpio/0001-Minor-fix.patch
Normal file
30
buildroot/package/cpio/0001-Minor-fix.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From 641d3f489cf6238bb916368d4ba0d9325a235afb Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Poznyakoff <gray@gnu.org>
|
||||
Date: Mon, 20 Jan 2020 07:45:39 +0200
|
||||
Subject: Minor fix * src/global.c: Remove superfluous declaration of
|
||||
program_name
|
||||
|
||||
[Retrieved from:
|
||||
https://git.savannah.gnu.org/cgit/cpio.git/commit/?id=641d3f489cf6238bb916368d4ba0d9325a235afb]
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
---
|
||||
src/global.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/global.c b/src/global.c
|
||||
index fb3abe9..acf92bc 100644
|
||||
--- a/src/global.c
|
||||
+++ b/src/global.c
|
||||
@@ -184,9 +184,6 @@ unsigned int warn_option = 0;
|
||||
/* Extract to standard output? */
|
||||
bool to_stdout_option = false;
|
||||
|
||||
-/* The name this program was run with. */
|
||||
-char *program_name;
|
||||
-
|
||||
/* A pointer to either lstat or stat, depending on whether
|
||||
dereferencing of symlinks is done for input files. */
|
||||
int (*xstat) ();
|
||||
--
|
||||
cgit v1.2.1
|
||||
|
@ -0,0 +1,179 @@
|
||||
From 604abec333a0efb44fd8bc610aa0b1151dd0f612 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <besser82@fedoraproject.org>
|
||||
Date: Mon, 13 Apr 2020 11:48:17 +0200
|
||||
Subject: [PATCH] Add support for upcoming json-c 0.14.0.
|
||||
|
||||
* TRUE/FALSE are not defined anymore. 1 and 0 are used instead.
|
||||
* json_object_get_uint64() and json_object_new_uint64() are part
|
||||
of the upstream API now.
|
||||
|
||||
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
|
||||
---
|
||||
lib/luks2/luks2_internal.h | 4 +++-
|
||||
lib/luks2/luks2_json_metadata.c | 38 +++++++++++++++++----------------
|
||||
2 files changed, 23 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/lib/luks2/luks2_internal.h b/lib/luks2/luks2_internal.h
|
||||
index b9fec6b5..939101d6 100644
|
||||
--- a/lib/luks2/luks2_internal.h
|
||||
+++ b/lib/luks2/luks2_internal.h
|
||||
@@ -58,9 +58,11 @@ json_object *LUKS2_get_segments_jobj(struct luks2_hdr *hdr);
|
||||
void hexprint_base64(struct crypt_device *cd, json_object *jobj,
|
||||
const char *sep, const char *line_sep);
|
||||
|
||||
+#if !(defined JSON_C_VERSION_NUM && JSON_C_VERSION_NUM >= ((13 << 8) | 99))
|
||||
uint64_t json_object_get_uint64(json_object *jobj);
|
||||
-uint32_t json_object_get_uint32(json_object *jobj);
|
||||
json_object *json_object_new_uint64(uint64_t value);
|
||||
+#endif
|
||||
+uint32_t json_object_get_uint32(json_object *jobj);
|
||||
|
||||
int json_object_object_add_by_uint(json_object *jobj, unsigned key, json_object *jobj_val);
|
||||
void json_object_object_del_by_uint(json_object *jobj, unsigned key);
|
||||
diff --git a/lib/luks2/luks2_json_metadata.c b/lib/luks2/luks2_json_metadata.c
|
||||
index 781280c2..712c2bbd 100644
|
||||
--- a/lib/luks2/luks2_json_metadata.c
|
||||
+++ b/lib/luks2/luks2_json_metadata.c
|
||||
@@ -234,13 +234,14 @@ static json_bool json_str_to_uint64(json_object *jobj, uint64_t *value)
|
||||
tmp = strtoull(json_object_get_string(jobj), &endptr, 10);
|
||||
if (*endptr || errno) {
|
||||
*value = 0;
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
*value = tmp;
|
||||
- return TRUE;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
+#if !(defined JSON_C_VERSION_NUM && JSON_C_VERSION_NUM >= ((13 << 8) | 99))
|
||||
uint64_t json_object_get_uint64(json_object *jobj)
|
||||
{
|
||||
uint64_t r;
|
||||
@@ -262,6 +263,7 @@ json_object *json_object_new_uint64(uint64_t value)
|
||||
jobj = json_object_new_string(num);
|
||||
return jobj;
|
||||
}
|
||||
+#endif
|
||||
|
||||
/*
|
||||
* Validate helpers
|
||||
@@ -273,9 +275,9 @@ static json_bool numbered(struct crypt_device *cd, const char *name, const char
|
||||
for (i = 0; key[i]; i++)
|
||||
if (!isdigit(key[i])) {
|
||||
log_dbg(cd, "%s \"%s\" is not in numbered form.", name, key);
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
- return TRUE;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
json_object *json_contains(struct crypt_device *cd, json_object *jobj, const char *name,
|
||||
@@ -300,7 +302,7 @@ json_bool validate_json_uint32(json_object *jobj)
|
||||
errno = 0;
|
||||
tmp = json_object_get_int64(jobj);
|
||||
|
||||
- return (errno || tmp < 0 || tmp > UINT32_MAX) ? FALSE : TRUE;
|
||||
+ return (errno || tmp < 0 || tmp > UINT32_MAX) ? 0 : 1;
|
||||
}
|
||||
|
||||
static json_bool validate_keyslots_array(struct crypt_device *cd,
|
||||
@@ -313,17 +315,17 @@ static json_bool validate_keyslots_array(struct crypt_device *cd,
|
||||
jobj = json_object_array_get_idx(jarr, i);
|
||||
if (!json_object_is_type(jobj, json_type_string)) {
|
||||
log_dbg(cd, "Illegal value type in keyslots array at index %d.", i);
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
if (!json_contains(cd, jobj_keys, "", "Keyslots section",
|
||||
json_object_get_string(jobj), json_type_object))
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
- return TRUE;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
static json_bool validate_segments_array(struct crypt_device *cd,
|
||||
@@ -336,17 +338,17 @@ static json_bool validate_segments_array(struct crypt_device *cd,
|
||||
jobj = json_object_array_get_idx(jarr, i);
|
||||
if (!json_object_is_type(jobj, json_type_string)) {
|
||||
log_dbg(cd, "Illegal value type in segments array at index %d.", i);
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
if (!json_contains(cd, jobj_segments, "", "Segments section",
|
||||
json_object_get_string(jobj), json_type_object))
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
- return TRUE;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
static json_bool segment_has_digest(const char *segment_name, json_object *jobj_digests)
|
||||
@@ -357,10 +359,10 @@ static json_bool segment_has_digest(const char *segment_name, json_object *jobj_
|
||||
UNUSED(key);
|
||||
json_object_object_get_ex(val, "segments", &jobj_segments);
|
||||
if (LUKS2_array_jobj(jobj_segments, segment_name))
|
||||
- return TRUE;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static json_bool validate_intervals(struct crypt_device *cd,
|
||||
@@ -372,18 +374,18 @@ static json_bool validate_intervals(struct crypt_device *cd,
|
||||
while (i < length) {
|
||||
if (ix[i].offset < 2 * metadata_size) {
|
||||
log_dbg(cd, "Illegal area offset: %" PRIu64 ".", ix[i].offset);
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
if (!ix[i].length) {
|
||||
log_dbg(cd, "Area length must be greater than zero.");
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
if ((ix[i].offset + ix[i].length) > keyslots_area_end) {
|
||||
log_dbg(cd, "Area [%" PRIu64 ", %" PRIu64 "] overflows binary keyslots area (ends at offset: %" PRIu64 ").",
|
||||
ix[i].offset, ix[i].offset + ix[i].length, keyslots_area_end);
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
for (j = 0; j < length; j++) {
|
||||
@@ -393,14 +395,14 @@ static json_bool validate_intervals(struct crypt_device *cd,
|
||||
log_dbg(cd, "Overlapping areas [%" PRIu64 ",%" PRIu64 "] and [%" PRIu64 ",%" PRIu64 "].",
|
||||
ix[i].offset, ix[i].offset + ix[i].length,
|
||||
ix[j].offset, ix[j].offset + ix[j].length);
|
||||
- return FALSE;
|
||||
+ return 0;
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
- return TRUE;
|
||||
+ return 1;
|
||||
}
|
||||
|
||||
static int LUKS2_keyslot_validate(struct crypt_device *cd, json_object *hdr_jobj, json_object *hdr_keyslot, const char *key)
|
||||
--
|
||||
2.20.1
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user