diff mbox

ppc: Fix catching some segfaults in user mode

Message ID 1470210923.12584.67.camel@kernel.crashing.org
State New
Headers show

Commit Message

Benjamin Herrenschmidt Aug. 3, 2016, 7:55 a.m. UTC
The usermode "translate" code generates an error code value that
has the "is_write" bit set, which causes our switch/case to miss
and display "Invalid segfault errno" and a spurrious second state
dump. Fix it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 linux-user/main.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Gibson Aug. 4, 2016, 2:03 a.m. UTC | #1
On Wed, Aug 03, 2016 at 05:55:23PM +1000, Benjamin Herrenschmidt wrote:
> The usermode "translate" code generates an error code value that
> has the "is_write" bit set, which causes our switch/case to miss
> and display "Invalid segfault errno" and a spurrious second state
> dump. Fix it.
> 
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

Applied to ppc-for-2.8, thanks.

> ---
>  linux-user/main.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/linux-user/main.c b/linux-user/main.c
> index 24f34e6..eb9975c 100644
> --- a/linux-user/main.c
> +++ b/linux-user/main.c
> @@ -1656,6 +1656,7 @@ void cpu_loop(CPUPPCState *env)
>              /* XXX: check this. Seems bugged */
>              switch (env->error_code & 0xFF000000) {
>              case 0x40000000:
> +            case 0x42000000:
>                  info.si_signo = TARGET_SIGSEGV;
>                  info.si_errno = 0;
>                  info.si_code = TARGET_SEGV_MAPERR;
>
diff mbox

Patch

diff --git a/linux-user/main.c b/linux-user/main.c
index 24f34e6..eb9975c 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -1656,6 +1656,7 @@  void cpu_loop(CPUPPCState *env)
             /* XXX: check this. Seems bugged */
             switch (env->error_code & 0xFF000000) {
             case 0x40000000:
+            case 0x42000000:
                 info.si_signo = TARGET_SIGSEGV;
                 info.si_errno = 0;
                 info.si_code = TARGET_SEGV_MAPERR;