From: David Daney <ddaney.cavm@gmail.com>
To: James Hogan <james.hogan@imgtec.com>
Cc: linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
Ralf Baechle <ralf@linux-mips.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>,
Kees Cook <keescook@chromium.org>
Subject: Re: [RFC PATCH] kernel/signal.c: avoid BUG_ON with SIG128 (MIPS)
Date: Wed, 29 May 2013 10:19:32 -0700 [thread overview]
Message-ID: <51A638A4.2000705@gmail.com> (raw)
In-Reply-To: <1369846916-13202-1-git-send-email-james.hogan@imgtec.com>
On 05/29/2013 10:01 AM, James Hogan wrote:
> MIPS has 128 signals, the highest of which has the number 128. The
I wonder if we should change the ABI and reduce the number of signals to
127 instead of this patch.
David Daney
> following command causes get_signal_to_deliver() to pass this signal
> number straight through to do_group_exit() as the exit code:
>
> strace sleep 10 & sleep 1 && kill -128 `pidof sleep`
>
> However do_group_exit() checks for the core dump bit (0x80) in the exit
> code which matches in this particular case and the kernel panics:
>
> BUG_ON(exit_code & 0x80); /* core dumps don't get here */
>
> This is worked around by changing get_signal_to_deliver() to pass
> min(info->si_signo, 127) instead of info->si_signo, so that this highest
> of signal numbers get rounded down to 127. This makes the exit code
> technically incorrect, but it's better than killing the whole kernel.
>
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Kees Cook <keescook@chromium.org>
> ---
>
> This is based on v3.10-rc3.
>
> It's a little hacky, but aside from reducing the number of signals to
> 127 to avoid this case (which isn't backwards compatible) I'm not sure
> what else can be done. Any comments?
>
> kernel/signal.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 113411b..69bc00f 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -2366,8 +2366,12 @@ relock:
>
> /*
> * Death signals, no core dump.
> + *
> + * MIPS has a signal number 128 which clashes with the core dump
> + * bit. If this was the signal we still want to report a valid
> + * exit code, so round it down to 127.
> */
> - do_group_exit(info->si_signo);
> + do_group_exit(min(info->si_signo, 127));
> /* NOTREACHED */
> }
> spin_unlock_irq(&sighand->siglock);
>
next prev parent reply other threads:[~2013-05-29 17:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-29 17:01 [RFC PATCH] kernel/signal.c: avoid BUG_ON with SIG128 (MIPS) James Hogan
2013-05-29 17:19 ` David Daney [this message]
2013-05-29 17:36 ` Oleg Nesterov
2013-05-29 21:56 ` James Hogan
2013-06-28 20:03 ` Denys Vlasenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=51A638A4.2000705@gmail.com \
--to=ddaney.cavm@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=james.hogan@imgtec.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=oleg@redhat.com \
--cc=ralf@linux-mips.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox