From 79af75f7776fc20b0d7eb6afe1e27c00fdb4b9b4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 15 Feb 2021 17:08:06 -0700 Subject: fit: Don't allow verification of images with @ nodes When searching for a node called 'fred', any unit address appended to the name is ignored by libfdt, meaning that 'fred' can match 'fred@1'. This means that we cannot be sure that the node originally intended is the one that is used. Disallow use of nodes with unit addresses. Update the forge test also, since it uses @ addresses. CVE-2021-27138 Signed-off-by: Simon Glass Reported-by: Bruce Monroe Reported-by: Arie Haenel Reported-by: Julien Lenoir --- test/py/tests/test_fit.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'test/py/tests/test_fit.py') diff --git a/test/py/tests/test_fit.py b/test/py/tests/test_fit.py index 84b3f95850..6d5b43c3ba 100755 --- a/test/py/tests/test_fit.py +++ b/test/py/tests/test_fit.py @@ -17,7 +17,7 @@ base_its = ''' #address-cells = <1>; images { - kernel@1 { + kernel-1 { data = /incbin/("%(kernel)s"); type = "kernel"; arch = "sandbox"; @@ -26,7 +26,7 @@ base_its = ''' load = <0x40000>; entry = <0x8>; }; - kernel@2 { + kernel-2 { data = /incbin/("%(loadables1)s"); type = "kernel"; arch = "sandbox"; @@ -35,19 +35,19 @@ base_its = ''' %(loadables1_load)s entry = <0x0>; }; - fdt@1 { + fdt-1 { description = "snow"; data = /incbin/("%(fdt)s"); type = "flat_dt"; arch = "sandbox"; %(fdt_load)s compression = "%(compression)s"; - signature@1 { + signature-1 { algo = "sha1,rsa2048"; key-name-hint = "dev"; }; }; - ramdisk@1 { + ramdisk-1 { description = "snow"; data = /incbin/("%(ramdisk)s"); type = "ramdisk"; @@ -56,7 +56,7 @@ base_its = ''' %(ramdisk_load)s compression = "%(compression)s"; }; - ramdisk@2 { + ramdisk-2 { description = "snow"; data = /incbin/("%(loadables2)s"); type = "ramdisk"; @@ -67,10 +67,10 @@ base_its = ''' }; }; configurations { - default = "conf@1"; - conf@1 { - kernel = "kernel@1"; - fdt = "fdt@1"; + default = "conf-1"; + conf-1 { + kernel = "kernel-1"; + fdt = "fdt-1"; %(ramdisk_config)s %(loadables_config)s }; @@ -410,7 +410,7 @@ def test_fit(u_boot_console): # Try a ramdisk with cons.log.section('Kernel + FDT + Ramdisk load'): - params['ramdisk_config'] = 'ramdisk = "ramdisk@1";' + params['ramdisk_config'] = 'ramdisk = "ramdisk-1";' params['ramdisk_load'] = 'load = <%#x>;' % params['ramdisk_addr'] fit = make_fit(mkimage, params) cons.restart_uboot() @@ -419,7 +419,7 @@ def test_fit(u_boot_console): # Configuration with some Loadables with cons.log.section('Kernel + FDT + Ramdisk load + Loadables'): - params['loadables_config'] = 'loadables = "kernel@2", "ramdisk@2";' + params['loadables_config'] = 'loadables = "kernel-2", "ramdisk-2";' params['loadables1_load'] = ('load = <%#x>;' % params['loadables1_addr']) params['loadables2_load'] = ('load = <%#x>;' % -- cgit v1.2.3