signal/powerpc: Use force_sig_fault where appropriate
Reviewed-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
parent
77c70728db
commit
f383d8b4ae
@ -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,
|
void do_break (struct pt_regs *regs, unsigned long address,
|
||||||
unsigned long error_code)
|
unsigned long error_code)
|
||||||
{
|
{
|
||||||
siginfo_t info;
|
|
||||||
|
|
||||||
current->thread.trap_nr = TRAP_HWBKPT;
|
current->thread.trap_nr = TRAP_HWBKPT;
|
||||||
if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
|
if (notify_die(DIE_DABR_MATCH, "dabr_match", regs, error_code,
|
||||||
11, SIGSEGV) == NOTIFY_STOP)
|
11, SIGSEGV) == NOTIFY_STOP)
|
||||||
@ -634,12 +632,7 @@ void do_break (struct pt_regs *regs, unsigned long address,
|
|||||||
hw_breakpoint_disable();
|
hw_breakpoint_disable();
|
||||||
|
|
||||||
/* Deliver the signal to userspace */
|
/* Deliver the signal to userspace */
|
||||||
clear_siginfo(&info);
|
force_sig_fault(SIGTRAP, TRAP_HWBKPT, (void __user *)address, current);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
|
#endif /* CONFIG_PPC_ADV_DEBUG_REGS */
|
||||||
|
|
||||||
|
@ -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,
|
static int do_sigbus(struct pt_regs *regs, unsigned long address,
|
||||||
vm_fault_t fault)
|
vm_fault_t fault)
|
||||||
{
|
{
|
||||||
siginfo_t info;
|
|
||||||
|
|
||||||
if (!user_mode(regs))
|
if (!user_mode(regs))
|
||||||
return SIGBUS;
|
return SIGBUS;
|
||||||
|
|
||||||
current->thread.trap_nr = BUS_ADRERR;
|
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
|
#ifdef CONFIG_MEMORY_FAILURE
|
||||||
if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
|
if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
|
||||||
unsigned int lsb = 0; /* shutup gcc */
|
unsigned int lsb = 0; /* shutup gcc */
|
||||||
@ -194,7 +187,7 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
force_sig_info(SIGBUS, &info, current);
|
force_sig_fault(SIGBUS, BUS_ADRERR, (void __user *)address, current);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,11 @@ struct cbe_spu_info cbe_spu_info[MAX_NUMNODES];
|
|||||||
EXPORT_SYMBOL_GPL(cbe_spu_info);
|
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
|
* on DMA errors. Export it here to avoid general kernel-wide access to this
|
||||||
* function
|
* function
|
||||||
*/
|
*/
|
||||||
EXPORT_SYMBOL_GPL(force_sig_info);
|
EXPORT_SYMBOL_GPL(force_sig_fault);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Protects cbe_spu_info and spu->number.
|
* Protects cbe_spu_info and spu->number.
|
||||||
|
@ -36,42 +36,32 @@
|
|||||||
static void spufs_handle_event(struct spu_context *ctx,
|
static void spufs_handle_event(struct spu_context *ctx,
|
||||||
unsigned long ea, int type)
|
unsigned long ea, int type)
|
||||||
{
|
{
|
||||||
siginfo_t info;
|
|
||||||
|
|
||||||
if (ctx->flags & SPU_CREATE_EVENTS_ENABLED) {
|
if (ctx->flags & SPU_CREATE_EVENTS_ENABLED) {
|
||||||
ctx->event_return |= type;
|
ctx->event_return |= type;
|
||||||
wake_up_all(&ctx->stop_wq);
|
wake_up_all(&ctx->stop_wq);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_siginfo(&info);
|
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SPE_EVENT_INVALID_DMA:
|
case SPE_EVENT_INVALID_DMA:
|
||||||
info.si_signo = SIGBUS;
|
force_sig_fault(SIGBUS, BUS_OBJERR, NULL, current);
|
||||||
info.si_code = BUS_OBJERR;
|
|
||||||
break;
|
break;
|
||||||
case SPE_EVENT_SPE_DATA_STORAGE:
|
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);
|
ctx->ops->restart_dma(ctx);
|
||||||
|
force_sig_fault(SIGSEGV, SEGV_ACCERR, (void __user *)ea,
|
||||||
|
current);
|
||||||
break;
|
break;
|
||||||
case SPE_EVENT_DMA_ALIGNMENT:
|
case SPE_EVENT_DMA_ALIGNMENT:
|
||||||
info.si_signo = SIGBUS;
|
|
||||||
/* DAR isn't set for an alignment fault :( */
|
/* DAR isn't set for an alignment fault :( */
|
||||||
info.si_code = BUS_ADRALN;
|
force_sig_fault(SIGBUS, BUS_ADRALN, NULL, current);
|
||||||
break;
|
break;
|
||||||
case SPE_EVENT_SPE_ERROR:
|
case SPE_EVENT_SPE_ERROR:
|
||||||
info.si_signo = SIGILL;
|
force_sig_fault(
|
||||||
info.si_addr = (void __user *)(unsigned long)
|
SIGILL, ILL_ILLOPC,
|
||||||
ctx->ops->npc_read(ctx) - 4;
|
(void __user *)(unsigned long)
|
||||||
info.si_code = ILL_ILLOPC;
|
ctx->ops->npc_read(ctx) - 4, current);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.si_signo)
|
|
||||||
force_sig_info(info.si_signo, &info, current);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int spufs_handle_class0(struct spu_context *ctx)
|
int spufs_handle_class0(struct spu_context *ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user