All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Redfearn <matt.redfearn@imgtec.com>
To: <IMG-MIPSLinuxKerneldevelopers@imgtec.com>
Cc: Matt Redfearn <matt.redfearn@imgtec.com>,
	Paul Burton <paul.burton@imgtec.com>, <linux-mips@linux-mips.org>,
	<linux-kernel@vger.kernel.org>,
	"Amanieu d'Antras" <amanieu@gmail.com>,
	"Ralf Baechle" <ralf@linux-mips.org>,
	Alex Smith <alex.smith@imgtec.com>,
	"Andrew Morton" <akpm@linux-foundation.org>
Subject: [PATCH v2 2/6] MIPS: Support sending SIG_SYS to 32bit userspace from 64bit kernel
Date: Tue, 29 Mar 2016 09:35:30 +0100	[thread overview]
Message-ID: <1459240534-8658-3-git-send-email-matt.redfearn@imgtec.com> (raw)
In-Reply-To: <1459240534-8658-1-git-send-email-matt.redfearn@imgtec.com>

The seccomp_bpf self test revealed that a 64bit kernel delivered an
invalid SIG_SYS to a 32bit userspace, because it was falling into the
default of the switch statement. Add a case to handle delivering the
signal.

With this patch, the seccomp_bpf self test now passes the TRAP.handler
case with O32 and N32 userlands.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
---

Changes in v2: None

 arch/mips/kernel/signal32.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 4909639aa35b..78c8349d151c 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -227,6 +227,12 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
 			err |= __put_user(from->si_uid, &to->si_uid);
 			err |= __put_user(from->si_int, &to->si_int);
 			break;
+		case __SI_SYS >> 16:
+			err |= __copy_to_user(&to->si_call_addr, &from->si_call_addr,
+					      sizeof(compat_uptr_t));
+			err |= __put_user(from->si_syscall, &to->si_syscall);
+			err |= __put_user(from->si_arch, &to->si_arch);
+			break;
 		}
 	}
 	return err;
-- 
2.5.0

WARNING: multiple messages have this Message-ID (diff)
From: Matt Redfearn <matt.redfearn@imgtec.com>
To: IMG-MIPSLinuxKerneldevelopers@imgtec.com
Cc: Matt Redfearn <matt.redfearn@imgtec.com>,
	Paul Burton <paul.burton@imgtec.com>,
	linux-mips@linux-mips.org, linux-kernel@vger.kernel.org,
	Amanieu d'Antras <amanieu@gmail.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	Alex Smith <alex.smith@imgtec.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH v2 2/6] MIPS: Support sending SIG_SYS to 32bit userspace from 64bit kernel
Date: Tue, 29 Mar 2016 09:35:30 +0100	[thread overview]
Message-ID: <1459240534-8658-3-git-send-email-matt.redfearn@imgtec.com> (raw)
Message-ID: <20160329083530.kTAucMyahrUGQisLhJY059prOJ1OMoyNFOwKWaZb9Uo@z> (raw)
In-Reply-To: <1459240534-8658-1-git-send-email-matt.redfearn@imgtec.com>

The seccomp_bpf self test revealed that a 64bit kernel delivered an
invalid SIG_SYS to a 32bit userspace, because it was falling into the
default of the switch statement. Add a case to handle delivering the
signal.

With this patch, the seccomp_bpf self test now passes the TRAP.handler
case with O32 and N32 userlands.

Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
---

Changes in v2: None

 arch/mips/kernel/signal32.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 4909639aa35b..78c8349d151c 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -227,6 +227,12 @@ int copy_siginfo_to_user32(compat_siginfo_t __user *to, const siginfo_t *from)
 			err |= __put_user(from->si_uid, &to->si_uid);
 			err |= __put_user(from->si_int, &to->si_int);
 			break;
+		case __SI_SYS >> 16:
+			err |= __copy_to_user(&to->si_call_addr, &from->si_call_addr,
+					      sizeof(compat_uptr_t));
+			err |= __put_user(from->si_syscall, &to->si_syscall);
+			err |= __put_user(from->si_arch, &to->si_arch);
+			break;
 		}
 	}
 	return err;
-- 
2.5.0

  parent reply	other threads:[~2016-03-29  8:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29  8:35 [PATCH v2 0/6] MIPS seccomp_bpf self test and fixups Matt Redfearn
2016-03-29  8:35 ` Matt Redfearn
2016-03-29  8:35 ` [PATCH v2 1/6] selftests/seccomp: add MIPS self-test support Matt Redfearn
2016-03-29  8:35   ` Matt Redfearn
2016-03-29  8:35 ` Matt Redfearn [this message]
2016-03-29  8:35   ` [PATCH v2 2/6] MIPS: Support sending SIG_SYS to 32bit userspace from 64bit kernel Matt Redfearn
2016-03-29  8:35 ` [PATCH v2 3/6] MIPS: scall: Handle seccomp filters which redirect syscalls Matt Redfearn
2016-03-29  8:35   ` Matt Redfearn
2016-03-29  8:35 ` [PATCH v2 4/6] seccomp: Get compat syscalls from asm-generic header Matt Redfearn
2016-03-29  8:35   ` Matt Redfearn
2016-03-29  8:35 ` [PATCH v2 5/6] MIPS: seccomp: Support compat with both O32 and N32 Matt Redfearn
2016-03-29  8:35   ` Matt Redfearn
2016-03-29  8:35 ` [PATCH v2 6/6] secomp: Constify mode1 syscall whitelist Matt Redfearn
2016-03-29  8:35   ` Matt Redfearn
2016-03-30  5:06 ` [PATCH v2 0/6] MIPS seccomp_bpf self test and fixups Kees Cook
2016-03-31  8:57   ` Matt Redfearn
2016-03-31  8:57     ` Matt Redfearn

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=1459240534-8658-3-git-send-email-matt.redfearn@imgtec.com \
    --to=matt.redfearn@imgtec.com \
    --cc=IMG-MIPSLinuxKerneldevelopers@imgtec.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.smith@imgtec.com \
    --cc=amanieu@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=paul.burton@imgtec.com \
    --cc=ralf@linux-mips.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.