public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] CTRL-C hangs after "hush: fix segfault on syntax error"
@ 2014-11-20  5:21 Stephen Warren
  2014-11-20 16:21 ` Przemyslaw Marczak
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stephen Warren @ 2014-11-20  5:21 UTC (permalink / raw)
  To: u-boot

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] CTRL-C hangs after "hush: fix segfault on syntax error"
  2014-11-20  5:21 [U-Boot] CTRL-C hangs after "hush: fix segfault on syntax error" Stephen Warren
@ 2014-11-20 16:21 ` Przemyslaw Marczak
  2014-11-20 16:49 ` Simon Glass
  2014-11-21 22:05 ` [U-Boot] [PATCH] Revert " Rabin Vincent
  2 siblings, 0 replies; 5+ messages in thread
From: Przemyslaw Marczak @ 2014-11-20 16:21 UTC (permalink / raw)
  To: u-boot

Hello,

On 11/20/2014 06:21 AM, Stephen Warren wrote:
> 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,
-- 
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] CTRL-C hangs after "hush: fix segfault on syntax error"
  2014-11-20  5:21 [U-Boot] CTRL-C hangs after "hush: fix segfault on syntax error" Stephen Warren
  2014-11-20 16:21 ` Przemyslaw Marczak
@ 2014-11-20 16:49 ` Simon Glass
  2014-11-21 22:05 ` [U-Boot] [PATCH] Revert " Rabin Vincent
  2 siblings, 0 replies; 5+ messages in thread
From: Simon Glass @ 2014-11-20 16:49 UTC (permalink / raw)
  To: u-boot

Hi Stephen,

On 20 November 2014 05:21, Stephen Warren <swarren@wwwdotorg.org> wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] Revert "hush: fix segfault on syntax error"
  2014-11-20  5:21 [U-Boot] CTRL-C hangs after "hush: fix segfault on syntax error" Stephen Warren
  2014-11-20 16:21 ` Przemyslaw Marczak
  2014-11-20 16:49 ` Simon Glass
@ 2014-11-21 22:05 ` Rabin Vincent
  2014-11-24 22:13   ` Tom Rini
  2 siblings, 1 reply; 5+ messages in thread
From: Rabin Vincent @ 2014-11-21 22:05 UTC (permalink / raw)
  To: u-boot

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.

Reported-by: Stephen Warren <swarren@wwwdotorg.org>
Reported-by: Przemyslaw Marczak <p.marczak@samsung.com>
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 common/cli_hush.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/cli_hush.c b/common/cli_hush.c
index d643912..296542f 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -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;
-- 
2.1.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH] Revert "hush: fix segfault on syntax error"
  2014-11-21 22:05 ` [U-Boot] [PATCH] Revert " Rabin Vincent
@ 2014-11-24 22:13   ` Tom Rini
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2014-11-24 22:13 UTC (permalink / raw)
  To: u-boot

On Fri, Nov 21, 2014 at 11:05:22PM +0100, Rabin Vincent wrote:

> 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.
> 
> Reported-by: Stephen Warren <swarren@wwwdotorg.org>
> Reported-by: Przemyslaw Marczak <p.marczak@samsung.com>
> Signed-off-by: Rabin Vincent <rabin@rab.in>

Applied to u-boot/master, thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-24 22:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20  5:21 [U-Boot] CTRL-C hangs after "hush: fix segfault on syntax error" Stephen Warren
2014-11-20 16:21 ` Przemyslaw Marczak
2014-11-20 16:49 ` Simon Glass
2014-11-21 22:05 ` [U-Boot] [PATCH] Revert " Rabin Vincent
2014-11-24 22:13   ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox