From: "Eric W. Biederman" <ebiederm@xmission.com>
To: linux-kernel@vger.kernel.org
Cc: linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
"Eric W. Biederman" <ebiederm@xmission.com>
Subject: [REVIEW][PATCH 9/9] signal/powerpc: Use force_sig_fault where appropriate
Date: Tue, 18 Sep 2018 19:58:50 +0200 [thread overview]
Message-ID: <20180918175850.4437-9-ebiederm@xmission.com> (raw)
In-Reply-To: <878t3yitze.fsf@xmission.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
---
arch/powerpc/kernel/process.c | 9 +-------
arch/powerpc/mm/fault.c | 9 +-------
arch/powerpc/platforms/cell/spu_base.c | 4 ++--
arch/powerpc/platforms/cell/spufs/fault.c | 26 +++++++----------------
4 files changed, 12 insertions(+), 36 deletions(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 913c5725cdb2..553a396e7fc1 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -620,8 +620,6 @@ void do_send_trap(struct pt_regs *regs, unsigned long address,
void do_break (struct pt_regs *regs, unsigned long address,
unsigned long error_code)
{
- siginfo_t info;
-
current->thread.trap_nr = TRAP_HWBKPT;
if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
11, SIGSEGV) == NOTIFY_STOP)
@@ -634,12 +632,7 @@ void do_break (struct pt_regs *regs, unsigned long address,
hw_breakpoint_disable();
/* Deliver the signal to userspace */
- clear_siginfo(&info);
- info.si_signo = SIGTRAP;
- info.si_errno = 0;
- info.si_code = TRAP_HWBKPT;
- info.si_addr = (void __user *)address;
- force_sig_info(SIGTRAP, &info, current);
+ force_sig_fault(SIGTRAP, TRAP_HWBKPT, (void __user *)address, current);
}
#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 406d0e0ef096..1697e903bbf2 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -165,17 +165,10 @@ static noinline int bad_access(struct pt_regs *regs, unsigned long address)
static int do_sigbus(struct pt_regs *regs, unsigned long address,
vm_fault_t fault)
{
- siginfo_t info;
-
if (!user_mode(regs))
return SIGBUS;
current->thread.trap_nr = BUS_ADRERR;
- clear_siginfo(&info);
- info.si_signo = SIGBUS;
- info.si_errno = 0;
- info.si_code = BUS_ADRERR;
- info.si_addr = (void __user *)address;
#ifdef CONFIG_MEMORY_FAILURE
if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
unsigned int lsb = 0; /* shutup gcc */
@@ -194,7 +187,7 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
}
#endif
- force_sig_info(SIGBUS, &info, current);
+ force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current);
return 0;
}
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 0c45cdbac4cf..7f12c7b78c0f 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -50,11 +50,11 @@ struct cbe_spu_info cbe_spu_info[MAX_NUMNODES];
EXPORT_SYMBOL_GPL(cbe_spu_info);
/*
- * The spufs fault-handling code needs to call force_sig_info to raise signals
+ * The spufs fault-handling code needs to call force_sig_fault to raise signals
* on DMA errors. Export it here to avoid general kernel-wide access to this
* function
*/
-EXPORT_SYMBOL_GPL(force_sig_info);
+EXPORT_SYMBOL_GPL(force_sig_fault);
/*
* Protects cbe_spu_info and spu->number.
diff --git a/arch/powerpc/platforms/cell/spufs/fault.c b/arch/powerpc/platforms/cell/spufs/fault.c
index 83cf58daaa79..971ac43b5d60 100644
--- a/arch/powerpc/platforms/cell/spufs/fault.c
+++ b/arch/powerpc/platforms/cell/spufs/fault.c
@@ -36,42 +36,32 @@
static void spufs_handle_event(struct spu_context *ctx,
unsigned long ea, int type)
{
- siginfo_t info;
-
if (ctx->flags & SPU_CREATE_EVENTS_ENABLED) {
ctx->event_return |= type;
wake_up_all(&ctx->stop_wq);
return;
}
- clear_siginfo(&info);
-
switch (type) {
case SPE_EVENT_INVALID_DMA:
- info.si_signo = SIGBUS;
- info.si_code = BUS_OBJERR;
+ force_sig_fault(SIGBUS, BUS_OBJERR, NULL, current);
break;
case SPE_EVENT_SPE_DATA_STORAGE:
- info.si_signo = SIGSEGV;
- info.si_addr = (void __user *)ea;
- info.si_code = SEGV_ACCERR;
ctx->ops->restart_dma(ctx);
+ force_sig_fault(SIGSEGV, SEGV_ACCERR, (void __user *)ea,
+ current);
break;
case SPE_EVENT_DMA_ALIGNMENT:
- info.si_signo = SIGBUS;
/* DAR isn't set for an alignment fault :( */
- info.si_code = BUS_ADRALN;
+ force_sig_fault(SIGBUS, BUS_ADRALN, NULL, current);
break;
case SPE_EVENT_SPE_ERROR:
- info.si_signo = SIGILL;
- info.si_addr = (void __user *)(unsigned long)
- ctx->ops->npc_read(ctx) - 4;
- info.si_code = ILL_ILLOPC;
+ force_sig_fault(
+ SIGILL, ILL_ILLOPC,
+ (void __user *)(unsigned long)
+ ctx->ops->npc_read(ctx) - 4, current);
break;
}
-
- if (info.si_signo)
- force_sig_info(info.si_signo, &info, current);
}
int spufs_handle_class0(struct spu_context *ctx)
--
2.17.1
next prev parent reply other threads:[~2018-09-18 17:58 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-18 17:41 [REVIEW][PATCH 0/9] signal/powerpc: siginfo cleanups Eric W. Biederman
2018-09-18 17:41 ` Eric W. Biederman
2018-09-18 17:58 ` [REVIEW][PATCH 1/9] signal/powerpc: Use force_sig_mceerr as appropriate Eric W. Biederman
2018-09-18 17:58 ` Eric W. Biederman
2018-09-21 8:20 ` Stephen Rothwell
2018-09-21 8:20 ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 2/9] signal/powerpc: Remove pkey parameter from __bad_area Eric W. Biederman
2018-09-18 17:58 ` Eric W. Biederman
2018-09-21 8:23 ` Stephen Rothwell
2018-09-21 8:23 ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 3/9] signal/powerpc: Call _exception_pkey directly from bad_key_fault_exception Eric W. Biederman
2018-09-18 17:58 ` Eric W. Biederman
2018-09-21 8:27 ` Stephen Rothwell
2018-09-21 8:27 ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 4/9] signal/powerpc: Remove pkey parameter from __bad_area_nosemaphore Eric W. Biederman
2018-09-18 17:58 ` Eric W. Biederman
2018-09-21 8:32 ` Stephen Rothwell
2018-09-21 8:32 ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 5/9] signal/powerpc: Factor the common exception code into exception_common Eric W. Biederman
2018-09-18 17:58 ` Eric W. Biederman
2018-09-21 8:38 ` Stephen Rothwell
2018-09-21 8:38 ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 6/9] signal/powerpc: Call force_sig_fault from _exception Eric W. Biederman
2018-09-18 17:58 ` Eric W. Biederman
2018-09-21 8:48 ` Stephen Rothwell
2018-09-21 8:48 ` Stephen Rothwell
2018-09-18 17:58 ` [REVIEW][PATCH 7/9] signal/poewrpc: Specialize _exception_pkey for handling pkey exceptions Eric W. Biederman
2018-09-18 17:58 ` Eric W. Biederman
2018-09-21 8:54 ` Stephen Rothwell
2018-09-21 8:54 ` Stephen Rothwell
2018-09-21 8:58 ` Christophe LEROY
2018-09-21 8:58 ` Christophe LEROY
2018-09-18 17:58 ` [REVIEW][PATCH 8/9] signal/powerpc: Simplify _exception_pkey by using force_sig_pkuerr Eric W. Biederman
2018-09-18 17:58 ` Eric W. Biederman
2018-09-21 8:57 ` Stephen Rothwell
2018-09-21 8:57 ` Stephen Rothwell
2018-09-18 17:58 ` Eric W. Biederman [this message]
2018-09-18 17:58 ` [REVIEW][PATCH 9/9] signal/powerpc: Use force_sig_fault where appropriate Eric W. Biederman
2018-09-21 9:05 ` Stephen Rothwell
2018-09-21 9:05 ` Stephen Rothwell
2018-09-21 9:06 ` [REVIEW][PATCH 0/9] signal/powerpc: siginfo cleanups Stephen Rothwell
2018-09-21 9:06 ` Stephen Rothwell
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=20180918175850.4437-9-ebiederm@xmission.com \
--to=ebiederm@xmission.com \
--cc=benh@kernel.crashing.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox