All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: Kyle McMartin <kyle@infradead.org>
Cc: linux-parisc <linux-parisc@vger.kernel.org>
Subject: Re: [PATCH] [RFC] fix kernel crash (protection id trap) when	compiling ruby1.9
Date: Fri, 19 Dec 2008 23:59:11 +0100	[thread overview]
Message-ID: <494C273F.1040200@gmx.de> (raw)
In-Reply-To: <20081219212906.GG8945@bombadil.infradead.org>

Kyle McMartin wrote:
> Honestly, I can't decide whether to apply this. It really should never
> happen in the kernel, since the kernel can guarantee it won't get the
> access rights failure (highest privilege level, and can set %sr and
> %protid to whatever it wants.)

Yes, that's the problem.
We catch a bug in the kernel which shouldn't be there (and which we
can't find yet).
If it wouldn't be there, we wouldn't need this patch..
Chicken and egg problem.

> It really genuinely is a bug that probably should panic the kernel. The
> only precedent I can easily see is x86 fixing up a bad iret with a
> general protection fault, which is more or less analogous to code 27
> here.
> 
> On the other hand, taking the exception on a userspace access really
> isn't all that critical, and there's fundamentally little reason for the
> kernel not to SIGSEGV the process, and continue...
> 
> Argh.

Argh. Argh :-)


> (btw, I've instrumented my do_sys_poll with a pile of assertions that
>  %cr8 << 1 == %sr3 == current->mm.context... let's see if where we're
>  getting corrupted is deterministic, though, I would guess that it won't
>  be.)

I'll continue to debug as well. I have some more ideas left to try...

Thanks for cleaning up my patch and splitting out the fixup_exception()
code.
Your patch is fine and I think you should apply it (with one minor
addition - see below).
The reason I think why you should apply it is, that we shouldn't let the
kernel crash on (correct) userspace apps.
Maybe adding a comment that this check in trap #27 should be removed
when the bug is fixed would be good though.

> diff --git a/arch/parisc/include/asm/uaccess.h b/arch/parisc/include/asm/uaccess.h
> index 4878b95..1c6dbb6 100644
> --- a/arch/parisc/include/asm/uaccess.h
> +++ b/arch/parisc/include/asm/uaccess.h
> @@ -745,6 +745,10 @@ void handle_interruption(int code, struct pt_regs *regs)
>  		/* Fall Through */
>  	case 27: 
>  		/* Data memory protection ID trap */
> +		if (code == 27 && !user_mode(regs) &&
> +			fixup_exception(regs))
> +                   return;

I think you should add a self-explaining printk(KERN_CRIT,..) here, so
that we can track when this bug appeared in userspace.
Something like:
printk("strange data protection ID trap happened to <procname> PID: xxx.
(this is a bug in the kernel)\n");
(you probably find a better wording)

Having a correctly-coded userspace process which suddenly just return
failures in syscalls is not good and would make people wonder and
unnecessarily try to debug their (correct) userspace apps...

Helge

  reply	other threads:[~2008-12-19 22:59 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-17 22:46 [PATCH] [RFC] fix kernel crash (protection id trap) when compiling ruby1.9 Helge Deller
2008-12-18  0:05 ` [PATCH] [RFC] fix kernel crash (protection id trap) when compiling John David Anglin
2008-12-18  0:43   ` Kyle McMartin
2008-12-18  3:02     ` [PATCH] [RFC] fix kernel crash (protection id trap) when John David Anglin
2008-12-18  3:05       ` Kyle McMartin
2008-12-18  4:04       ` Kyle McMartin
2008-12-18 16:16         ` Carlos O'Donell
2008-12-18 18:28         ` Kyle McMartin
2008-12-19 15:25           ` Carlos O'Donell
2008-12-19 16:13             ` John David Anglin
2008-12-19 16:23               ` Carlos O'Donell
2008-12-19 16:28                 ` Kyle McMartin
2008-12-19 16:35                   ` Carlos O'Donell
2008-12-19 16:36                     ` Carlos O'Donell
2008-12-19 16:44                       ` Kyle McMartin
2008-12-19 17:28                         ` Carlos O'Donell
2008-12-19 17:33                           ` Kyle McMartin
2008-12-19 17:36                             ` Carlos O'Donell
2008-12-19 17:39                               ` Kyle McMartin
2008-12-19 17:42                                 ` Kyle McMartin
2008-12-19 18:43                                   ` Carlos O'Donell
2008-12-18  1:46 ` [PATCH] [RFC] fix kernel crash (protection id trap) when compiling ruby1.9 Carlos O'Donell
2008-12-18  2:02   ` Carlos O'Donell
2008-12-18 13:13     ` Helge Deller
2008-12-18 15:28       ` [PATCH] [RFC] fix kernel crash (protection id trap) when compiling John David Anglin
2008-12-18 16:09         ` Carlos O'Donell
2008-12-18  2:36   ` [PATCH] [RFC] fix kernel crash (protection id trap) when compiling ruby1.9 Kyle McMartin
2008-12-18 12:21     ` Carlos O'Donell
2008-12-18  7:03 ` Kyle McMartin
2008-12-18 13:09   ` Helge Deller
2008-12-18 15:05     ` Kyle McMartin
2008-12-19 21:29 ` Kyle McMartin
2008-12-19 22:59   ` Helge Deller [this message]
2008-12-19 23:34     ` Kyle McMartin
2008-12-20 17:07       ` [PATCH] [RFC] fix kernel crash (protection id trap) when John David Anglin
2008-12-21 15:20   ` John David Anglin
2008-12-21 17:27     ` John David Anglin
2008-12-21 21:33       ` Kyle McMartin
2008-12-21 22:02         ` Kyle McMartin
2008-12-21 22:52           ` John David Anglin
2008-12-21 22:11         ` John David Anglin
2008-12-21 22:52       ` Helge Deller
2008-12-21 22:58         ` John David Anglin
2008-12-21 23:08           ` Helge Deller
2008-12-22  0:07             ` John David Anglin
2008-12-22 22:43         ` James Bottomley
2008-12-22 22:46           ` Kyle McMartin
2008-12-23  2:31           ` John David Anglin
2008-12-23  2:54             ` Kyle McMartin
2008-12-23  3:15               ` John David Anglin
2008-12-23 13:13               ` John David Anglin
2008-12-21 22:20     ` Kyle McMartin
2008-12-21 22:48       ` John David Anglin
2008-12-22 22:46       ` James Bottomley
2008-12-22 22:47         ` Kyle McMartin
2008-12-21 22:59     ` Helge Deller

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=494C273F.1040200@gmx.de \
    --to=deller@gmx.de \
    --cc=kyle@infradead.org \
    --cc=linux-parisc@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.