Skip to contentSkip to conversation

Revert "mkimage: fit: Do not tail-pad fitImage with external data"

PATCH New Tom Rini 2 participants 7 messages May 6, 2020 – May 7, 2020

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 Revert "mkimage: fit: Do not tail-pad fitImage with external data"

This has been reported to break booting of U-Boot from SPL on a number of platforms due to a lack of alignment of the external data. The issues this commit is addressing will need to be resolved another way.

This reverts commit 20a154f95bfe0a3b5bfba90bea7f001c58217536.

---
 tools/fit_image.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/fit_image.c +2 -1
index 1e0f1e9fce8b..88ff093d05be 100644
@@ -435,7 +435,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
 	int image_number;
 	int align_size;
 
-	align_size = params->bl_len ? params->bl_len : 1;
+	align_size = params->bl_len ? params->bl_len : 4;
 	fd = mmap_fdt(params->cmdname, fname, 0, &fdt, &sbuf, false, false);
 	if (fd < 0)
 		return -EIO;
@@ -493,6 +493,7 @@ static int fit_extract_data(struct image_tool_params *params, const char *fname)
 	fdt_pack(fdt);
 
 	new_size = fdt_totalsize(fdt);
+	new_size = ALIGN(new_size, align_size);
 	fdt_set_totalsize(fdt, new_size);
 	debug("Size reduced from %x to %x\n", fit_size, fdt_totalsize(fdt));
 	debug("External data size %x\n", buf_ptr);
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 Revert "mkimage: fit: Do not tail-pad fitImage with external data"

Quoted 9 lines · Tom Rini

This has been reported to break booting of U-Boot from SPL on a number of platforms due to a lack of alignment of the external data. The issues this commit is addressing will need to be resolved another way.

This reverts commit 20a154f95bfe0a3b5bfba90bea7f001c58217536.

The commit message should also warn that this re-opens the data leak in the padding.

author
#2 lore raw

PATCH 1/1 Revert "mkimage: fit: Do not tail-pad fitImage with external data"

Quoted 5 lines · Marek Vasut
Quoted 4 lines · Tom Rini

This has been reported to break booting of U-Boot from SPL on a number of platforms due to a lack of alignment of the external data. The issues this commit is addressing will need to be resolved another way.

Quoted 8 lines
Quoted 5 lines

This reverts commit 20a154f95bfe0a3b5bfba90bea7f001c58217536.

The commit message should also warn that this re-opens the data leak in the padding.

Sure. Are you going to send a patch switching to calloc or should I?

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200506/3d244773/attachment.sig>
#3 lore raw

PATCH 1/1 Revert "mkimage: fit: Do not tail-pad fitImage with external data"

Quoted 8 lines · Tom Rini
Quoted 7 lines · Marek Vasut
Quoted 6 lines · Tom Rini

This has been reported to break booting of U-Boot from SPL on a number of platforms due to a lack of alignment of the external data. The issues this commit is addressing will need to be resolved another way.

This reverts commit 20a154f95bfe0a3b5bfba90bea7f001c58217536.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

The commit message should also warn that this re-opens the data leak in the padding.

Sure. Are you going to send a patch switching to calloc or should I?

I think the discussion about the padding requirement isn't finished yet? See my remark about the load = <>; part.

author
#4 lore raw

PATCH 1/1 Revert "mkimage: fit: Do not tail-pad fitImage with external data"

Quoted 13 lines · Marek Vasut
Quoted 12 lines · Tom Rini
Quoted 11 lines · Marek Vasut
Quoted 9 lines · Tom Rini

This has been reported to break booting of U-Boot from SPL on a number of platforms due to a lack of alignment of the external data. The issues this commit is addressing will need to be resolved another way.

This reverts commit 20a154f95bfe0a3b5bfba90bea7f001c58217536.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The commit message should also warn that this re-opens the data leak in the padding.

Sure. Are you going to send a patch switching to calloc or should I?

I think the discussion about the padding requirement isn't finished yet? See my remark about the load = <>; part.

I'm unsure what more you need to provide a potential fix to the platforms that have reported breakage. I suspect you might even have a platform handy that is broken, given the imx platform.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200506/f7ce3be8/attachment.sig>
#5 lore raw

PATCH 1/1 Revert "mkimage: fit: Do not tail-pad fitImage with external data"

Quoted 17 lines · Tom Rini
Quoted 16 lines · Marek Vasut
Quoted 15 lines · Tom Rini
Quoted 13 lines · Marek Vasut
Quoted 9 lines · Tom Rini

This has been reported to break booting of U-Boot from SPL on a number of platforms due to a lack of alignment of the external data. The issues this commit is addressing will need to be resolved another way.

This reverts commit 20a154f95bfe0a3b5bfba90bea7f001c58217536.

The commit message should also warn that this re-opens the data leak in the padding.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Sure. Are you going to send a patch switching to calloc or should I?

I think the discussion about the padding requirement isn't finished yet? See my remark about the load = <>; part.

I'm unsure what more you need to provide a potential fix to the platforms that have reported breakage. I suspect you might even have a platform handy that is broken, given the imx platform.

Let's continue the discussion in one thread.

I think we should only ever enforce the padding if really required. Apply this one and add the calloc fix, but we should fix the root cause, not go back to papering over this problem.

author
#6 lore raw

PATCH 1/1 Revert "mkimage: fit: Do not tail-pad fitImage with external data"

In reply to Tom Rini
Quoted 9 lines · Tom Rini

This has been reported to break booting of U-Boot from SPL on a number of platforms due to a lack of alignment of the external data. The issues this commit is addressing will need to be resolved another way.

This reverts commit 20a154f95bfe0a3b5bfba90bea7f001c58217536.

With a note about the information leak re-added:

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200507/56f6d079/attachment.sig>