Skip to contentSkip to conversation

CTRL-C hangs after "hush: fix segfault on syntax error"

U-Boot New Stephen Warren 5 participants 5 messages Nov 20, 2014 – Nov 24, 2014

lore
Share & tools
lore
#0 lore raw

Rabin,

With 128059b926b3 "hush: fix segfault on syntax error" applied, I find that if I press CTRL-C at the U-Boot prompt, U-Boot hangs. If I revert that commit, CTRL-C works fine (prints CTRL-C and returns to the command prompt).

I'm testing on real HW (rpi_b board), although I don't expect the exact HW matters. This issue doesn't reproduce with sandbox, since CTRL-C now seems to just execute the binary rather than being handled by U-Boot shell.

#1 lore raw

Hello,

Quoted 11 lines · Stephen Warren

Rabin,

With 128059b926b3 "hush: fix segfault on syntax error" applied, I find that if I press CTRL-C at the U-Boot prompt, U-Boot hangs. If I revert that commit, CTRL-C works fine (prints CTRL-C and returns to the command prompt).

I'm testing on real HW (rpi_b board), although I don't expect the exact HW matters. This issue doesn't reproduce with sandbox, since CTRL-C now seems to just execute the binary rather than being handled by U-Boot shell.

I can confirm this issue on Trats2. U-Boot hangs in infinite loop, but after revert this commit - it works well.
Using CTRL-C in commands works fine, it only hangs in the console.

It stays in: ./common/cli.c:206 (cli_loop())

Best regards,

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#2 lore raw
In reply to Stephen Warren

Hi Stephen,

Quoted 10 lines · Stephen Warren

Rabin,

With 128059b926b3 "hush: fix segfault on syntax error" applied, I find that if I press CTRL-C at the U-Boot prompt, U-Boot hangs. If I revert that commit, CTRL-C works fine (prints CTRL-C and returns to the command prompt).

I'm testing on real HW (rpi_b board), although I don't expect the exact HW matters. This issue doesn't reproduce with sandbox, since CTRL-C now seems to just execute the binary rather than being handled by U-Boot shell.

You can repeat this on sandbox:

./u-boot -t raw

Then Ctrl-C will work (i.e. hang).

This seems bad - as Przemyslaw mentions it hangs in cli_loop(). parse_stream_outer() should not return.

Regards,
Simon

#3 lore raw

PATCH 1/1 Revert "hush: fix segfault on syntax error"

In reply to Stephen Warren

128059b92 ("hush: fix segfault on syntax error") attempted to fix a segfault on syntax errors, but it broke Ctrl-C handling, and the assumption that it made, that rcode could not be -1, is incorrect. Revert this change.

---
 common/cli_hush.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/cli_hush.c +1 -1
index d643912..296542f 100644
@@ -3217,7 +3217,7 @@ static int parse_stream_outer(struct in_str *inp, int flag)
 		}
 		b_free(&temp);
 	/* loop on syntax errors, return on EOF */
-	} while (rcode != 1 && !(flag & FLAG_EXIT_FROM_LOOP) &&
+	} while (rcode != -1 && !(flag & FLAG_EXIT_FROM_LOOP) &&
 		(inp->peek != static_peek || b_peek(inp)));
 #ifndef __U_BOOT__
 	return 0;
Signature · 1 line
2.1.1
#4 lore raw

PATCH 1/1 Revert "hush: fix segfault on syntax error"

Quoted 8 lines · Rabin Vincent

128059b92 ("hush: fix segfault on syntax error") attempted to fix a segfault on syntax errors, but it broke Ctrl-C handling, and the assumption that it made, that rcode could not be -1, is incorrect. Revert this change.

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: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141124/585d7239/attachment.pgp>