[prev in list] [next in list] [prev in thread] [next in thread]
List: uclinux-dev
Subject: Re: [uClinux-dev] __stack_start for ColdFire uClinux
From: Larry Baker <baker () usgs ! gov>
Date: 2012-10-05 18:38:32
Message-ID: C13C5697-2E51-402E-A073-7D1D9279C507 () usgs ! gov
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
On 4 Oct 2012, at 1:05 PM, Larry Baker wrote:
> I am still puzzled, though, why uClinux is silent when a program is aborted when it \
> receives an unhandled fatal signal. Mainline Linux (really the shell?) prints out \
> a message like
> > [root@atompc sdk]# ./SIGILL
> > Illegal instruction
>
> (SIGILL.c is the example program from http://en.wikipedia.org/wiki/SIGILL.) After \
> a reboot of uClinux, I get nothing
> > / # SIGILL
>
> I have to enable print-fatal-signals as before to see anything:
>
> > / # echo 1 >/proc/sys/kernel/print-fatal-signals
> > / # SIGILL
> > SIGILL/79: potentially unexpected fatal signal 4.
> >
> >
> > Format 04 Vector: 002c PC: 4052e544 Status: 0000 Not tainted
> > ORIG_D0: ffffffff D0: 4052e544 A2: 4052ff60 A1: 4052e4ec
> > A0: 4052e544 D5: 4052e524 D4: 00000000
> > D3: 00000000 D2: 00000001 D1: 0000002f
> > USP: 4052ff04
>
> Is this a uClinux thing? Or, a BusyBox (my uClinux shell) thing?
I'll answer my own question.
It is the shell that prints out the "Illegal instruction" message. I found the code \
in bash that does that and added it to the BusyBox hush shell. The SDK I use has a \
rather old BusyBox, 1.13.3. The hush shell is in busybox-1.13.3/shell/hush.c. \
checkjobs() waits for all child processes -- there is no distinction made between job \
control jobs and non-job control jobs like there is in bash. There is already code \
there that can be (hand) enabled to be verbose about what happens to a job. Enabling \
that also makes hush very chatty. So, I added an #else clause for the #if DEBUG_JOBS \
conditional code in checkjobs() to mimic bash's behavior. Here's the patch for \
busybox-1.13.3:
--- busybox-1.13.3/shell/hush.c
+++ busybox-1.13.3-patched/shell/hush.c
@@ -1720,2 +1720,13 @@
childpid, WEXITSTATUS(status));
> +#else
> + if ((WIFSTOPPED (status) == 0) && WIFSIGNALED (status)) {
> + int sig = WTERMSIG (status);
> + if ((sig != SIGINT) && (sig != SIGPIPE)) {
> + char *s = strsignal (sig);
> + if ( s != NULL )
> + fprintf (stderr, "%s\n", s);
> + else
> + fprintf (stderr, "Unknown signal: %d\n", sig);
> + }
> + }
> #endif
With this patched hush, I get what I am used to seeing:
> / # trap
> Illegal instruction
> / # SIGILL
> Illegal instruction
Now I can go back and find out where the applications I use are failing. I suspect \
stack overflows, which my implementation of gcc -stack-check-symbol=__stack_start for \
non-68020 (e.g., ColdFire) processors can catch now.
Larry Baker
US Geological Survey
650-329-5608
baker@usgs.gov
[Attachment #5 (unknown)]
<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; \
-webkit-line-break: after-white-space; "><div><div>On 4 Oct 2012, at 1:05 PM, Larry \
Baker wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span \
class="Apple-style-span" style="border-collapse: separate; font-family: 'Helvetica \
Neue'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: \
normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; \
text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; \
-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; \
-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; \
-webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" \
style="font-family: monospace; ">I am still puzzled, though, why uClinux is silent \
when a program is aborted when it receives an unhandled fatal signal. Mainline \
Linux (really the shell?) prints out a message like<br><br><blockquote \
type="cite">[root@atompc sdk]# ./SIGILL<br></blockquote><blockquote \
type="cite">Illegal instruction<br></blockquote><br>(SIGILL.c is the example program \
from<span class="Apple-converted-space"> </span><a \
href="http://en.wikipedia.org/wiki">http://en.wikipedia.org/wiki</a>/SIGILL.) \
After a reboot of uClinux, I get nothing<br><br><blockquote type="cite">/ # \
SIGILL<br></blockquote><br>I have to enable print-fatal-signals as before to see \
anything:<br><br><blockquote type="cite">/ # echo 1 \
>/proc/sys/kernel/print-fatal-signals<br></blockquote><blockquote type="cite">/ # \
SIGILL<br></blockquote><blockquote type="cite">SIGILL/79: potentially unexpected \
fatal signal 4.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote \
type="cite"><br></blockquote><blockquote type="cite">Format 04 Vector: 002c \
PC: 4052e544 Status: 0000 Not \
tainted<br></blockquote><blockquote type="cite">ORIG_D0: ffffffff D0: 4052e544 \
A2: 4052ff60 A1: 4052e4ec<br></blockquote><blockquote type="cite">A0: \
4052e544 D5: 4052e524 D4: 00000000<br></blockquote><blockquote \
type="cite">D3: 00000000 D2: 00000001 D1: \
0000002f<br></blockquote><blockquote type="cite">USP: 4052ff04<br></blockquote><br>Is \
this a uClinux thing? Or, a BusyBox (my uClinux shell) \
thing?<br></span></span></blockquote></div><div><br></div>I'll answer my own \
question.<div><br></div><div>It is the shell that prints out the "Illegal \
instruction" message. I found the code in bash that does that and added it to \
the BusyBox hush shell. The SDK I use has a rather old BusyBox, 1.13.3. \
The hush shell is in busybox-1.13.3/shell/hush.c. checkjobs() waits \
for all child processes -- there is no distinction made between job control jobs and \
non-job control jobs like there is in bash. There is already code there that \
can be (hand) enabled to be verbose about what happens to a job. Enabling that \
also makes hush very chatty. So, I added an #else clause for the #if DEBUG_JOBS \
conditional code in checkjobs() to mimic bash's behavior. Here's the patch \
for busybox-1.13.3:</div><div><br></div><div><div>--- \
busybox-1.13.3/shell/hush.c</div><div>+++ \
busybox-1.13.3-patched/shell/hush.c</div><div>@@ -1720,2 +1720,13 \
@@</div><div> <span class="Apple-tab-span" \
style="white-space:pre"> </span>childpid, \
WEXITSTATUS(status));</div><div></div></div><blockquote \
type="cite"><div><div>+#else</div><div>+<span class="Apple-tab-span" \
style="white-space:pre"> </span>if ((WIFSTOPPED (status) == 0) && \
WIFSIGNALED (status)) {</div><div>+<span class="Apple-tab-span" \
style="white-space:pre"> </span>int sig = WTERMSIG (status);</div><div>+<span \
class="Apple-tab-span" style="white-space:pre"> </span>if ((sig != SIGINT) \
&& (sig != SIGPIPE)) {</div><div>+<span class="Apple-tab-span" \
style="white-space:pre"> </span>char *s = strsignal (sig);</div><div>+<span \
class="Apple-tab-span" style="white-space:pre"> </span>if ( s != NULL \
)</div><div>+<span class="Apple-tab-span" style="white-space:pre"> </span>fprintf \
(stderr, "%s\n", s);</div><div>+<span class="Apple-tab-span" \
style="white-space:pre"> </span>else</div><div>+<span class="Apple-tab-span" \
style="white-space:pre"> </span>fprintf (stderr, "Unknown signal: %d\n", \
sig);</div><div>+<span class="Apple-tab-span" \
style="white-space:pre"> </span>}</div><div>+<span class="Apple-tab-span" \
style="white-space:pre"> </span>}</div><div> #endif</div></div></blockquote><div><br></div><div>With \
this patched hush, I get what I am used to \
seeing:</div><div><br></div><div><div></div><blockquote type="cite"><div>/ # \
trap</div><div>Illegal \
instruction</div></blockquote><div><br></div><div></div></div><blockquote \
type="cite"><div><div>/ # SIGILL</div><div>Illegal \
instruction</div></div></blockquote><div><br></div><div>Now I can go back and find \
out where the applications I use are failing. I suspect stack overflows, which \
my implementation of gcc -stack-check-symbol=__stack_start for non-68020 (e.g., \
ColdFire) processors can catch now.</div><div><br><div><div>Larry Baker<br>US \
Geological Survey<br>650-329-5608<br><a \
href="mailto:baker@usgs.gov">baker@usgs.gov</a><br><br><br></div><br><div></div></div></div></body></html>
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic