* [musl] remove SIGSTKFLT on mips?
@ 2020-05-21 16:51 enh
2020-05-21 19:21 ` Rich Felker
0 siblings, 1 reply; 5+ messages in thread
From: enh @ 2020-05-21 16:51 UTC (permalink / raw)
To: musl
(context: https://github.com/landley/toybox/issues/194)
seems like musl defines SIGSTKFLT for mips as signal 7. the kernel
disagrees and says SIGEMT is 7, and that mips doesn't have a
SIGSTKFLT:
arch/mips/include/uapi/asm/signal.h:#define SIGEMT 7
git blame says SIGSTKFLT was introduced in the original commit:
commit 6315004f6102dca44c4ba50654a36967b8b9c2a6
Author: Rich Felker <dalias@aerifal.cx>
Date: Wed Jul 11 04:22:13 2012 -0400
initial version of mips (o32) port, based on work by Richard
Pennington (rdp)
basically, this version of the code was obtained by starting with
rdp's work from his ellcc source tree, adapting it to musl's build
system and coding style, auditing the bits headers for discrepencies
with kernel definitions or glibc/LSB ABI or large file issues, fixing
up incompatibility with the old binutils from aboriginal linux, and
adding some new special cases to deal with the oddities of sigaction
and pipe syscall interfaces on mips.
at present, minimal test programs work, but some interfaces are broken
or missing. threaded programs probably will not link.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] remove SIGSTKFLT on mips?
2020-05-21 16:51 [musl] remove SIGSTKFLT on mips? enh
@ 2020-05-21 19:21 ` Rich Felker
2020-05-21 20:20 ` Khem Raj
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Rich Felker @ 2020-05-21 19:21 UTC (permalink / raw)
To: enh; +Cc: musl
[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]
On Thu, May 21, 2020 at 09:51:29AM -0700, enh wrote:
> (context: https://github.com/landley/toybox/issues/194)
>
> seems like musl defines SIGSTKFLT for mips as signal 7. the kernel
> disagrees and says SIGEMT is 7, and that mips doesn't have a
> SIGSTKFLT:
>
> arch/mips/include/uapi/asm/signal.h:#define SIGEMT 7
>
> git blame says SIGSTKFLT was introduced in the original commit:
>
> commit 6315004f6102dca44c4ba50654a36967b8b9c2a6
> Author: Rich Felker <dalias@aerifal.cx>
> Date: Wed Jul 11 04:22:13 2012 -0400
>
> initial version of mips (o32) port, based on work by Richard
> Pennington (rdp)
>
> basically, this version of the code was obtained by starting with
> rdp's work from his ellcc source tree, adapting it to musl's build
> system and coding style, auditing the bits headers for discrepencies
> with kernel definitions or glibc/LSB ABI or large file issues, fixing
> up incompatibility with the old binutils from aboriginal linux, and
> adding some new special cases to deal with the oddities of sigaction
> and pipe syscall interfaces on mips.
>
> at present, minimal test programs work, but some interfaces are broken
> or missing. threaded programs probably will not link.
I have the two attached patches pending push if there's no objection.
Rich
[-- Attachment #2: 0001-handle-possibility-that-SIGEMT-replaces-SIGSTKFLT-in.patch --]
[-- Type: text/plain, Size: 1108 bytes --]
From a19640a8912e9876f293267986875742867faa54 Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Thu, 21 May 2020 13:14:40 -0400
Subject: [PATCH 1/2] handle possibility that SIGEMT replaces SIGSTKFLT in
strsignal
presently all archs define SIGSTKFLT but this is not correct. change
strsignal as a prerequisite for fixing that.
---
src/string/strsignal.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/string/strsignal.c b/src/string/strsignal.c
index 96bfe841..922d3271 100644
--- a/src/string/strsignal.c
+++ b/src/string/strsignal.c
@@ -31,7 +31,11 @@ static const char map[] = {
[SIGPIPE] = 13,
[SIGALRM] = 14,
[SIGTERM] = 15,
+#if defined(SIGSTKFLT)
[SIGSTKFLT] = 16,
+#elif defined(SIGEMT)
+ [SIGEMT] = 16,
+#endif
[SIGCHLD] = 17,
[SIGCONT] = 18,
[SIGSTOP] = 19,
@@ -70,7 +74,11 @@ static const char strings[] =
"Broken pipe\0"
"Alarm clock\0"
"Terminated\0"
+#if defined(SIGSTKFLT)
"Stack fault\0"
+#elif defined(SIGEMT)
+ "Emulator trap\0"
+#endif
"Child process status\0"
"Continued\0"
"Stopped (signal)\0"
--
2.21.0
[-- Attachment #3: 0002-fix-incorrect-SIGSTKFLT-on-all-mips-archs.patch --]
[-- Type: text/plain, Size: 1701 bytes --]
From 8a9b96b328f084cc7a824174378643d2402b8dfb Mon Sep 17 00:00:00 2001
From: Rich Felker <dalias@aerifal.cx>
Date: Thu, 21 May 2020 13:06:21 -0400
Subject: [PATCH 2/2] fix incorrect SIGSTKFLT on all mips archs
signal 7 is SIGEMT on Linux mips* ABI according to the man pages and
kernel. it's not clear where the wrong name came from but it dates
back to original mips commit.
---
arch/mips/bits/signal.h | 2 +-
arch/mips64/bits/signal.h | 2 +-
arch/mipsn32/bits/signal.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/mips/bits/signal.h b/arch/mips/bits/signal.h
index e1d97ac7..1b69e762 100644
--- a/arch/mips/bits/signal.h
+++ b/arch/mips/bits/signal.h
@@ -93,7 +93,7 @@ typedef struct __ucontext {
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT SIGABRT
-#define SIGSTKFLT 7
+#define SIGEMT 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGBUS 10
diff --git a/arch/mips64/bits/signal.h b/arch/mips64/bits/signal.h
index c31ad07e..4f91c9fc 100644
--- a/arch/mips64/bits/signal.h
+++ b/arch/mips64/bits/signal.h
@@ -112,7 +112,7 @@ typedef struct __ucontext {
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT SIGABRT
-#define SIGSTKFLT 7
+#define SIGEMT 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGBUS 10
diff --git a/arch/mipsn32/bits/signal.h b/arch/mipsn32/bits/signal.h
index c31ad07e..4f91c9fc 100644
--- a/arch/mipsn32/bits/signal.h
+++ b/arch/mipsn32/bits/signal.h
@@ -112,7 +112,7 @@ typedef struct __ucontext {
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT SIGABRT
-#define SIGSTKFLT 7
+#define SIGEMT 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGBUS 10
--
2.21.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] remove SIGSTKFLT on mips?
2020-05-21 19:21 ` Rich Felker
@ 2020-05-21 20:20 ` Khem Raj
2020-05-21 20:23 ` Rich Felker
2020-05-23 15:46 ` Petr Vorel
2 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2020-05-21 20:20 UTC (permalink / raw)
To: musl
On 5/21/20 12:21 PM, Rich Felker wrote:
> On Thu, May 21, 2020 at 09:51:29AM -0700, enh wrote:
>> (context: https://github.com/landley/toybox/issues/194)
>>
>> seems like musl defines SIGSTKFLT for mips as signal 7. the kernel
>> disagrees and says SIGEMT is 7, and that mips doesn't have a
>> SIGSTKFLT:
>>
>> arch/mips/include/uapi/asm/signal.h:#define SIGEMT 7
>>
>> git blame says SIGSTKFLT was introduced in the original commit:
>>
>> commit 6315004f6102dca44c4ba50654a36967b8b9c2a6
>> Author: Rich Felker <dalias@aerifal.cx>
>> Date: Wed Jul 11 04:22:13 2012 -0400
>>
>> initial version of mips (o32) port, based on work by Richard
>> Pennington (rdp)
>>
>> basically, this version of the code was obtained by starting with
>> rdp's work from his ellcc source tree, adapting it to musl's build
>> system and coding style, auditing the bits headers for discrepencies
>> with kernel definitions or glibc/LSB ABI or large file issues, fixing
>> up incompatibility with the old binutils from aboriginal linux, and
>> adding some new special cases to deal with the oddities of sigaction
>> and pipe syscall interfaces on mips.
>>
>> at present, minimal test programs work, but some interfaces are broken
>> or missing. threaded programs probably will not link.
>
> I have the two attached patches pending push if there's no objection.
>
seems good to me
> Rich
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] remove SIGSTKFLT on mips?
2020-05-21 19:21 ` Rich Felker
2020-05-21 20:20 ` Khem Raj
@ 2020-05-21 20:23 ` Rich Felker
2020-05-23 15:46 ` Petr Vorel
2 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2020-05-21 20:23 UTC (permalink / raw)
To: musl
On Thu, May 21, 2020 at 03:21:03PM -0400, Rich Felker wrote:
> On Thu, May 21, 2020 at 09:51:29AM -0700, enh wrote:
> > (context: https://github.com/landley/toybox/issues/194)
> >
> > seems like musl defines SIGSTKFLT for mips as signal 7. the kernel
> > disagrees and says SIGEMT is 7, and that mips doesn't have a
> > SIGSTKFLT:
> >
> > arch/mips/include/uapi/asm/signal.h:#define SIGEMT 7
> >
> > git blame says SIGSTKFLT was introduced in the original commit:
> >
> > commit 6315004f6102dca44c4ba50654a36967b8b9c2a6
> > Author: Rich Felker <dalias@aerifal.cx>
> > Date: Wed Jul 11 04:22:13 2012 -0400
> >
> > initial version of mips (o32) port, based on work by Richard
> > Pennington (rdp)
> >
> > basically, this version of the code was obtained by starting with
> > rdp's work from his ellcc source tree, adapting it to musl's build
> > system and coding style, auditing the bits headers for discrepencies
> > with kernel definitions or glibc/LSB ABI or large file issues, fixing
> > up incompatibility with the old binutils from aboriginal linux, and
> > adding some new special cases to deal with the oddities of sigaction
> > and pipe syscall interfaces on mips.
> >
> > at present, minimal test programs work, but some interfaces are broken
> > or missing. threaded programs probably will not link.
>
> I have the two attached patches pending push if there's no objection.
> >From a19640a8912e9876f293267986875742867faa54 Mon Sep 17 00:00:00 2001
> From: Rich Felker <dalias@aerifal.cx>
> Date: Thu, 21 May 2020 13:14:40 -0400
> Subject: [PATCH 1/2] handle possibility that SIGEMT replaces SIGSTKFLT in
> strsignal
>
> presently all archs define SIGSTKFLT but this is not correct. change
> strsignal as a prerequisite for fixing that.
> ---
> src/string/strsignal.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/src/string/strsignal.c b/src/string/strsignal.c
> index 96bfe841..922d3271 100644
> --- a/src/string/strsignal.c
> +++ b/src/string/strsignal.c
> @@ -31,7 +31,11 @@ static const char map[] = {
> [SIGPIPE] = 13,
> [SIGALRM] = 14,
> [SIGTERM] = 15,
> +#if defined(SIGSTKFLT)
> [SIGSTKFLT] = 16,
> +#elif defined(SIGEMT)
> + [SIGEMT] = 16,
> +#endif
Note here that 16 does not imply the value is 16, just that the
remapping for archs that don't use the common signal order needs to
get the 16'th string here:
> [SIGCHLD] = 17,
> [SIGCONT] = 18,
> [SIGSTOP] = 19,
> @@ -70,7 +74,11 @@ static const char strings[] =
> "Broken pipe\0"
> "Alarm clock\0"
> "Terminated\0"
> +#if defined(SIGSTKFLT)
> "Stack fault\0"
> +#elif defined(SIGEMT)
> + "Emulator trap\0"
> +#endif
Which is conceptually slightly wrong since there needs to be a dummy
entry here if neither is defined, so as not to mess up the numbering.
I'll fix that before pushing even though in practice all archs have
one or the other (or the code wouldn't have compiled before).
Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [musl] remove SIGSTKFLT on mips?
2020-05-21 19:21 ` Rich Felker
2020-05-21 20:20 ` Khem Raj
2020-05-21 20:23 ` Rich Felker
@ 2020-05-23 15:46 ` Petr Vorel
2 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2020-05-23 15:46 UTC (permalink / raw)
To: musl; +Cc: enh
Hi,
> I have the two attached patches pending push if there's no objection.
Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
> Rich
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-05-23 15:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-21 16:51 [musl] remove SIGSTKFLT on mips? enh
2020-05-21 19:21 ` Rich Felker
2020-05-21 20:20 ` Khem Raj
2020-05-21 20:23 ` Rich Felker
2020-05-23 15:46 ` Petr Vorel
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).