Skip to contentSkip to conversation

bootstd: Fix bootflow info for efi_mgr

PATCH In review Sam Protsenko 4 participants 7 messages Oct 3, 2025 – Oct 14, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bootstd: Fix bootflow info for efi_mgr

A "Synchronous Abort" CPU exception happens on an attempt to run the "bootflow info" command for a global boot method (e.g. efi_mgr):

=> bootflow select 0
=> bootflow info

"Synchronous Abort" handler, esr 0x96000006, far 0x8

It happens because do_bootflow_info() tries to dereference bflow->dev, which is NULL in case of efi_mgr. Add the corresponding check to prevent this NULL pointer dereference and make "bootflow info" command work properly for global boot methods.

Fixes 2d653f686b6d ("bootstd: Add a bootflow command")
---
 cmd/bootflow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/bootflow.c +1 -1
index 551dffbb8b89..081f64e12ce9 100644
@@ -404,7 +404,7 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
 	}
 
 	printf("Name:      %s\n", bflow->name);
-	printf("Device:    %s\n", bflow->dev->name);
+	printf("Device:    %s\n", bflow->dev ? bflow->dev->name : "(none)");
 	printf("Block dev: %s\n", bflow->blk ? bflow->blk->name : "(none)");
 	printf("Method:    %s\n", bflow->method->name);
 	printf("State:     %s\n", bootflow_state_get_name(bflow->state));

base-commit: d33b21b7e261691e8d6613a24cc9b0ececba3b01

Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 34 lines · Sam Protsenko

A "Synchronous Abort" CPU exception happens on an attempt to run the "bootflow info" command for a global boot method (e.g. efi_mgr):

=> bootflow select 0
=> bootflow info

"Synchronous Abort" handler, esr 0x96000006, far 0x8

It happens because do_bootflow_info() tries to dereference bflow->dev, which is NULL in case of efi_mgr. Add the corresponding check to prevent this NULL pointer dereference and make "bootflow info" command work properly for global boot methods.

Fixes 2d653f686b6d ("bootstd: Add a bootflow command")
---
 cmd/bootflow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/bootflow.c +1 -1
index 551dffbb8b89..081f64e12ce9 100644
@@ -404,7 +404,7 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
        }
 
        printf("Name:      %s\n", bflow->name);
-       printf("Device:    %s\n", bflow->dev->name);
+       printf("Device:    %s\n", bflow->dev ? bflow->dev->name : "(none)");
        printf("Block dev: %s\n", bflow->blk ? bflow->blk->name : "(none)");
        printf("Method:    %s\n", bflow->method->name);
        printf("State:     %s\n", bootflow_state_get_name(bflow->state));
Quoted 4 lines

base-commit: d33b21b7e261691e8d6613a24cc9b0ececba3b01 --
2.39.5

If you like, you could an a test for this to bootflow_cmd_info()

Regards,
Simon

#2 lore raw

Hi Simon,

On Mon, Oct 6, 2025 at 3:40 PM Simon Glass <[email protected]> wrote:

[snip]

Quoted 5 lines

If you like, you could an a test for this to bootflow_cmd_info()

I remember the last time when I tried running bootstd tests they were broken. Are they functional now? Also, do we have some short documentation on running bootstd tests? If so, could you please reference it. I mean, I can add the test, but unfortunately don't have enough time to fix the broken test suite (if it's still broken).

Quoted 2 lines

Regards,
Simon

#3 lore raw
Quoted 9 lines · Sam Protsenko

Hi Simon,

On Mon, Oct 6, 2025 at 3:40 PM Simon Glass <[email protected]> wrote:

[snip]

Quoted 3 lines
Quoted 8 lines
Quoted 2 lines

If you like, you could an a test for this to bootflow_cmd_info()

I remember the last time when I tried running bootstd tests they were broken. Are they functional now? Also, do we have some short documentation on running bootstd tests? If so, could you please reference it. I mean, I can add the test, but unfortunately don't have enough time to fix the broken test suite (if it's still broken).

I think any future regressions in this area are things that smatch would catch and we'll get that in CI soon enough. Coverity (and smatch) may or may not have also caught this, FWIW.

Signature · 1 line
Tom
#4 lore raw
In reply to Sam Protsenko

Hi Sam,

Quoted 10 lines · Sam Protsenko

Hi Simon,

On Mon, Oct 6, 2025 at 3:40 PM Simon Glass <[email protected]> wrote:

[snip]

Quoted 3 lines
Quoted 8 lines
Quoted 2 lines

If you like, you could an a test for this to bootflow_cmd_info()

I remember the last time when I tried running bootstd tests they were broken. Are they functional now? Also, do we have some short documentation on running bootstd tests? If so, could you please reference it. I mean, I can add the test, but unfortunately don't have enough time to fix the broken test suite (if it's still broken).

It runs in CI so I don't think it can be broken. But perhaps it doesn't work locally for you?

You need to run test.py first (e.g. with -k bootstd) to get it to create the test files. After that you can just run sandbox with 'ut bootstd ...' which is a bit quicker.

There is quite a bit of documentation too at [1]

Regards,
Simon

[1] https://docs.u-boot.org/en/latest/develop/testing.html

Reviewed-by on v1 1/1
#5 lore raw
In reply to Sam Protsenko

Hi Sam,

Thank you for the patch.

Quoted 8 lines · Sam Protsenko

A "Synchronous Abort" CPU exception happens on an attempt to run the "bootflow info" command for a global boot method (e.g. efi_mgr):

=> bootflow select 0
=> bootflow info

"Synchronous Abort" handler, esr 0x96000006, far 0x8

Quoted 7 lines

It happens because do_bootflow_info() tries to dereference bflow->dev, which is NULL in case of efi_mgr. Add the corresponding check to prevent this NULL pointer dereference and make "bootflow info" command work properly for global boot methods.

Fixes 2d653f686b6d ("bootstd: Add a bootflow command")
Quoted 21 lines
---
 cmd/bootflow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/bootflow.c +1 -1
index 551dffbb8b89..081f64e12ce9 100644
@@ -404,7 +404,7 @@ static int do_bootflow_info(struct cmd_tbl *cmdtp, int flag, int argc,
 	}
 
 	printf("Name:      %s\n", bflow->name);
-	printf("Device:    %s\n", bflow->dev->name);
+	printf("Device:    %s\n", bflow->dev ? bflow->dev->name : "(none)");
 	printf("Block dev: %s\n", bflow->blk ? bflow->blk->name : "(none)");
 	printf("Method:    %s\n", bflow->method->name);
 	printf("State:     %s\n", bootflow_state_get_name(bflow->state));

base-commit: d33b21b7e261691e8d6613a24cc9b0ececba3b01

Signature · 1 line
2.39.5
#6 lore raw
In reply to Sam Protsenko
Quoted 9 lines · Sam Protsenko

A "Synchronous Abort" CPU exception happens on an attempt to run the "bootflow info" command for a global boot method (e.g. efi_mgr):

=> bootflow select 0
=> bootflow info

"Synchronous Abort" handler, esr 0x96000006, far 0x8

[...]

Applied to u-boot/master, thanks!

[1/1] bootstd: Fix bootflow info for efi_mgr

      commit: 3b278dd9e6643a9f75ef108d229c619e197067d0
Signature · 1 line
Tom