#883179 dash: compiles in signals from build architecture when cross-compiled

Package:
src:dash
Source:
dash
Submitter:
James Cowgill
Date:
2023-02-27 13:12:05 UTC
Severity:
normal
Tags:
#883179#5
Date:
2017-11-30 11:38:10 UTC
From:
To:
Hi,

When cross-compiled, dash compiles in a list of signal names used for
various purposes (eg kill -NAME). Unfortunately the signal names are
generated by using the *build* compiler instead of the *host* compiler
so the signals are incorrect when dash is actually run on the host machine.

This was originally noticed by YunQiang Su while working on MIPS r6.
Since NSIG is larger on MIPS than on x86, running a command which
attempts to parse an invalid signal (like "kill -s TERM 1" which tries
to parse a signal named "s" first) will search off the end of the list
of signals and crash with a NULL pointer dereference (src/trap.c
decode_signal).

I notice the signal generation code has been copied from bash. Newer
versions of bash have a fix for this which initialized the list of
signals at runtime when cross-compiled. Maybe you could copy the fix
from bash?

Thanks,
James

#883179#10
Date:
2017-11-30 23:19:38 UTC
From:
To:
Hi,

James Cowgill wrote:

Interesting!  I assume you're referring to src/mksignames.c.

I think this should be doable using preprocessor alone instead of
generated code.  Failing that, I think we can do something in
configure e.g. using the #warning trick.  Will look into it.

I think that would go against dash's goal of being small and simple.
It might be possible to simplify the way the signal name table is used
to avoid the need for code generation altogether, though, which would
be even nicer.

Thanks,
Jonathan

#883179#17
Date:
2023-02-27 13:10:51 UTC
From:
To:
Add to the cross compile list of bug.... not really a ftcbfs but it is will
lead to ftcbfs