signal/powerpc: siginfo cleanups
Subsystems (4)
cover signal/powerpc: siginfo cleanups
This is the continuation of my work to sort out signaling of exceptions with siginfo. The old functions by passing siginfo resulted in many cases of fields of siginfo that were not initialized and then passed to userspace, and also resulted in callers getting confused and initializing the wrong fields. My remedy is to have specific functions for sending each different kind of signal with siginfo. Those functions take the information needed to fill in siginfo and do the work themselves.
This is my set of changes to update powerpc to use those functions. Along with some refactoring so those functions can be cleanly used.
Folks please review and double check me. I think I have kept these changes simple and obviously correct but I am human and mess up sometimes.
After these patches have had a chance to be reviewed I plan to merge them by my siginfo tree. If you would rather take them in the powerpc
tree let me know. All of the prerequisites should have been merged
through Linus's tree several releases ago.
Eric W. Biederman (9):
signal/powerpc: Use force_sig_mceerr as appropriate signal/powerpc: Remove pkey parameter from __bad_area signal/powerpc: Call _exception_pkey directly from bad_key_fault_exception signal/powerpc: Remove pkey parameter from __bad_area_nosemaphore signal/powerpc: Factor the common exception code into exception_common signal/powerpc: Call force_sig_fault from _exception signal/poewrpc: Specialize _exception_pkey for handling pkey exceptions signal/powerpc: Simplify _exception_pkey by using force_sig_pkuerr signal/powerpc: Use force_sig_fault where appropriate
arch/powerpc/include/asm/bug.h | 2 +- arch/powerpc/kernel/process.c | 9 +---- arch/powerpc/kernel/traps.c | 27 ++++++++------- arch/powerpc/mm/fault.c | 55 +++++++++++++++++-------------- arch/powerpc/platforms/cell/spu_base.c | 4 +-- arch/powerpc/platforms/cell/spufs/fault.c | 26 +++++---------- 6 files changed, 57 insertions(+), 66 deletions(-)
Eric
PATCH 1/9 signal/powerpc: Use force_sig_mceerr as appropriate
In do_sigbus isolate the mceerr signaling code and call force_sig_mceerr instead of falling through to the force_sig_info that works for all of the other signals.
--- arch/powerpc/mm/fault.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
arch/powerpc/mm/fault.c +11 -7
@@ -158,7 +158,6 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address, vm_fault_t fault) {siginfo_t info; -unsigned int lsb =0 ;if (!user_mode (regs))return SIGBUS ;
@@ -171,17 +170,22 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address, 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 */ +pr_err ("MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n" , current->comm, current->pid, address); - info.si_code =BUS_MCEERR_AR ; + +if (fault &VM_FAULT_HWPOISON_LARGE ) + lsb =hstate_index_to_shift (VM_FAULT_GET_HINDEX (fault)); +if (fault &VM_FAULT_HWPOISON ) + lsb =PAGE_SHIFT ; + +force_sig_mceerr (BUS_MCEERR_AR , (void __user *)address, lsb, + current); +return 0 ; } -if (fault &VM_FAULT_HWPOISON_LARGE ) - lsb =hstate_index_to_shift (VM_FAULT_GET_HINDEX (fault)); -if (fault &VM_FAULT_HWPOISON ) - lsb =PAGE_SHIFT ;#endif - info.si_addr_lsb = lsb;force_sig_info (SIGBUS , &info, current);return 0 ; }
Signature · 1 line
2.17.1
Re: [REVIEW][PATCH 1/9] signal/powerpc: Use force_sig_mceerr as appropriate
Hi Eric,
Quoted 6 lines · On Tue, 18 Sep 2018 19:58:42 +0200 "Eric W. Biederman" <[email protected]>…
In
do_sigbusisolate the mceerr signaling code and callforce_sig_mceerrinstead of falling through to theforce_sig_infothat works for all of the other signals.Signed-off-by "Eric W. Biederman" <[email protected]>
Looks good to me. I was going to mention further cleanup, but I see you do that in a later patch.
Signature · 2 lines
Cheers, Stephen Rothwell
PATCH 2/9 signal/powerpc: Remove pkey parameter from __bad_area
In reply to Eric W. BiedermanThere are no callers of __bad_area that pass in a pkey parameter so it makes no sense to take one.
--- arch/powerpc/mm/fault.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/powerpc/mm/fault.c +4 -5
@@ -124,8 +124,7 @@ static noinline int bad_area_nosemaphore(struct pt_regs *regs, unsigned long addreturn __bad_area_nosemaphore (regs, address,SEGV_MAPERR ,0 ); } -static int __bad_area (struct pt_regs *regs,unsigned long address,int si_code, -int pkey) +static int __bad_area (struct pt_regs *regs,unsigned long address,int si_code) {struct mm_struct *mm = current->mm;
@@ -135,12 +134,12 @@ static int __bad_area(struct pt_regs *regs, unsigned long address, int si_code,*/ up_read (&mm->mmap_sem); -return __bad_area_nosemaphore (regs, address, si_code, pkey); +return __bad_area_nosemaphore (regs, address, si_code,0 ); } static noinline int bad_area(struct pt_regs *regs, unsigned long address) { -return __bad_area (regs, address,SEGV_MAPERR ,0 ); +return __bad_area (regs, address,SEGV_MAPERR ); } static int bad_key_fault_exception(struct pt_regs *regs, unsigned long address,
@@ -151,7 +150,7 @@ static int bad_key_fault_exception(struct pt_regs *regs, unsigned long address, static noinline int bad_access(struct pt_regs *regs, unsigned long address) { -return __bad_area (regs, address,SEGV_ACCERR ,0 ); +return __bad_area (regs, address,SEGV_ACCERR ); } static int do_sigbus(struct pt_regs *regs, unsigned long address,
Signature · 1 line
2.17.1
Re: [REVIEW][PATCH 2/9] signal/powerpc: Remove pkey parameter from __bad_area
Hi Eric,
Quoted 5 lines · On Tue, 18 Sep 2018 19:58:43 +0200 "Eric W. Biederman" <[email protected]>…
There are no callers of
__bad_areathat pass in a pkey parameter so it makes no sense to take one.Signed-off-by "Eric W. Biederman" <[email protected]>
Fairly straight forward.
Signature · 2 lines
Cheers, Stephen Rothwell
PATCH 3/9 signal/powerpc: Call _exception_pkey directly from bad_key_fault_exception
In reply to Eric W. BiedermanThis removes the need for other code paths to deal with pkey exceptions.
--- arch/powerpc/mm/fault.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/powerpc/mm/fault.c +11 -1
@@ -145,7 +145,17 @@ static noinline int bad_area(struct pt_regs *regs, unsigned long address)static int bad_key_fault_exception (struct pt_regs *regs,unsigned long address,int pkey) { -return __bad_area_nosemaphore (regs, address,SEGV_PKUERR , pkey); +/* +* If we are in kernel mode, bail out with a SEGV, this will +* be caught by the assembly which will restore the non-volatile +* registers before calling bad_page_fault() +*/ +if (!user_mode (regs)) +return SIGSEGV ; + +_exception_pkey (SIGSEGV , regs,SEGV_PKUERR , address, pkey); + +return 0 ; } static noinline int bad_access(struct pt_regs *regs, unsigned long address)
Signature · 1 line
2.17.1
Re: [REVIEW][PATCH 3/9] signal/powerpc: Call _exception_pkey directly from bad_key_fault_exception
Hi Eric,
Quoted 4 lines · On Tue, 18 Sep 2018 19:58:44 +0200 "Eric W. Biederman" <[email protected]>…
This removes the need for other code paths to deal with pkey exceptions.
Signed-off-by "Eric W. Biederman" <[email protected]>
Straight forward expansion.
Signature · 2 lines
Cheers, Stephen Rothwell
PATCH 4/9 signal/powerpc: Remove pkey parameter from __bad_area_nosemaphore
In reply to Eric W. BiedermanNow that bad_key_fault_exception no longer calls __bad_area_nosemaphore there is no reason for __bad_area_nosemaphore to handle pkeys.
--- arch/powerpc/mm/fault.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/powerpc/mm/fault.c +4 -5
@@ -103,8 +103,7 @@ static bool store_updates_sp(unsigned int inst)*/ static int -__bad_area_nosemaphore (struct pt_regs *regs,unsigned long address,int si_code, -int pkey) +__bad_area_nosemaphore (struct pt_regs *regs,unsigned long address,int si_code) {/* * If we are in kernel mode, bail out with a SEGV, this will
@@ -114,14 +113,14 @@ __bad_area_nosemaphore(struct pt_regs *regs, unsigned long address, int si_code,if (!user_mode (regs))return SIGSEGV ; -_exception_pkey (SIGSEGV , regs, si_code, address, pkey); +_exception (SIGSEGV , regs, si_code, address);return 0 ; } static noinline int bad_area_nosemaphore(struct pt_regs *regs, unsigned long address) { -return __bad_area_nosemaphore (regs, address,SEGV_MAPERR ,0 ); +return __bad_area_nosemaphore (regs, address,SEGV_MAPERR ); }static int __bad_area (struct pt_regs *regs,unsigned long address,int si_code)
@@ -134,7 +133,7 @@ static int __bad_area(struct pt_regs *regs, unsigned long address, int si_code)*/ up_read (&mm->mmap_sem); -return __bad_area_nosemaphore (regs, address, si_code,0 ); +return __bad_area_nosemaphore (regs, address, si_code); } static noinline int bad_area(struct pt_regs *regs, unsigned long address)
Signature · 1 line
2.17.1
Re: [REVIEW][PATCH 4/9] signal/powerpc: Remove pkey parameter from __bad_area_nosemaphore
Hi Eric,
Quoted 5 lines · On Tue, 18 Sep 2018 19:58:45 +0200 "Eric W. Biederman" <[email protected]>…
Now that
bad_key_fault_exceptionno longer calls__bad_area_nosemaphorethere is no reason for__bad_area_nosemaphoreto handle pkeys.Signed-off-by "Eric W. Biederman" <[email protected]>
Again, very straight forward given that _exception(a,b,c,d) -> _exception_pkey(a,b,c,d,0).
Signature · 2 lines
Cheers, Stephen Rothwell
PATCH 5/9 signal/powerpc: Factor the common exception code into exception_common
In reply to Eric W. BiedermanIt is brittle and wrong to populate si_pkey when there was not a pkey exception. The field does not exist for all si_codes and in some cases another field exists in the same memory location.
So factor out the code that all exceptions handlers must run into exception_common, leaving the individual exception handlers to generate the signals themselves.
--- arch/powerpc/kernel/traps.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
arch/powerpc/kernel/traps.c +13 -5
@@ -338,14 +338,12 @@ static void show_signal_msg(int signr, struct pt_regs *regs, int code,show_user_instructions (regs); } -void _exception_pkey (int signr,struct pt_regs *regs,int code, -unsigned long addr,int key) +static bool exception_common (int signr,struct pt_regs *regs,int code, +unsigned long addr) { -siginfo_t info; -if (!user_mode (regs)) {die ("Exception in kernel mode" , regs, signr); -return ; +return false; }show_signal_msg (signr, regs, code, addr);
@@ -361,6 +359,16 @@ void _exception_pkey(int signr, struct pt_regs *regs, int code,*/ thread_pkey_regs_save (¤t->thread); +return true; +} + +void _exception_pkey (int signr,struct pt_regs *regs,int code,unsigned long addr,int key) +{ +siginfo_t info; + +if (!exception_common (signr, regs, code, addr)) +return ; +clear_siginfo (&info); info.si_signo = signr; info.si_code = code;
Signature · 1 line
2.17.1
Re: [REVIEW][PATCH 5/9] signal/powerpc: Factor the common exception code into exception_common
Hi Eric,
Quoted 10 lines · On Tue, 18 Sep 2018 19:58:46 +0200 "Eric W. Biederman" <[email protected]>…
It is brittle and wrong to populate
si_pkeywhen there was not a pkey exception. The field does not exist for allsi_codesand in some cases another field exists in the same memory location.So factor out the code that all exceptions handlers must run into
exception_common, leaving the individual exception handlers to generate the signals themselves.Signed-off-by "Eric W. Biederman" <[email protected]>
Clearly no change in semantics.
Signature · 2 lines
Cheers, Stephen Rothwell
PATCH 6/9 signal/powerpc: Call force_sig_fault from _exception
In reply to Eric W. BiedermanThe callers of _exception don't need the pkey exception logic because they are not processing a pkey exception. So just call exception_common directly and then call force_sig_fault to generate the appropriate siginfo and deliver the appropriate signal.
--- arch/powerpc/kernel/traps.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/kernel/traps.c +4 -1
@@ -380,7 +380,10 @@ void _exception_pkey(int signr, struct pt_regs *regs, int code, unsigned long advoid _exception (int signr,struct pt_regs *regs,int code,unsigned long addr) { -_exception_pkey (signr, regs, code, addr,0 ); +if (!exception_common (signr, regs, code, addr)) +return ; + +force_sig_fault (signr, code, (void __user *)addr, current); }void system_reset_exception (struct pt_regs *regs)
Signature · 1 line
2.17.1
Re: [REVIEW][PATCH 6/9] signal/powerpc: Call force_sig_fault from _exception
Hi Eric,
Quoted 7 lines · On Tue, 18 Sep 2018 19:58:47 +0200 "Eric W. Biederman" <[email protected]>…
The callers of
_exceptiondon't need the pkey exception logic because they are not processing a pkey exception. So just callexception_commondirectly and then callforce_sig_faultto generate the appropriate siginfo and deliver the appropriate signal.Signed-off-by "Eric W. Biederman" <[email protected]>
Looks right to me.
Signature · 2 lines
Cheers, Stephen Rothwell
PATCH 7/9 signal/poewrpc: Specialize _exception_pkey for handling pkey exceptions
In reply to Eric W. BiedermanNow that _exception no longer calls _exception_pkey it is no longer necessary to handle any signal with any si_code. All pkey exceptions are SIGSEGV with paired with SEGV_PKUERR. So just handle that case and remove the now unnecessary parameters from _exception_pkey.
--- arch/powerpc/include/asm/bug.h | 2 +- arch/powerpc/kernel/traps.c | 10 +++++----- arch/powerpc/mm/fault.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/bug.h +1 -1
@@ -133,7 +133,7 @@ struct pt_regs;extern int do_page_fault (struct pt_regs *,unsigned long ,unsigned long );extern void bad_page_fault (struct pt_regs *,unsigned long ,int );extern void _exception (int ,struct pt_regs *,int ,unsigned long ); -extern void _exception_pkey (int ,struct pt_regs *,int ,unsigned long ,int ); +extern void _exception_pkey (struct pt_regs *,unsigned long ,int );extern void die (const char *,struct pt_regs *,long );extern bool die_will_crash (void );extern void panic_flush_kmsg_start (void );
arch/powerpc/kernel/traps.c +5 -5
@@ -362,20 +362,20 @@ static bool exception_common(int signr, struct pt_regs *regs, int code,return true; } -void _exception_pkey (int signr,struct pt_regs *regs,int code,unsigned long addr,int key) +void _exception_pkey (struct pt_regs *regs,unsigned long addr,int key) {siginfo_t info; -if (!exception_common (signr, regs, code, addr)) +if (!exception_common (SIGSEGV , regs,SEGV_PKUERR , addr))return ;clear_siginfo (&info); - info.si_signo = signr; - info.si_code = code; + info.si_signo =SIGSEGV ; + info.si_code =SEGV_PKUERR ; info.si_addr = (void __user *) addr; info.si_pkey = key; -force_sig_info (signr, &info, current); +force_sig_info (info.si_signo, &info, current); }void _exception (int signr,struct pt_regs *regs,int code,unsigned long addr)
arch/powerpc/mm/fault.c +1 -1
@@ -152,7 +152,7 @@ static int bad_key_fault_exception(struct pt_regs *regs, unsigned long address,if (!user_mode (regs))return SIGSEGV ; -_exception_pkey (SIGSEGV , regs,SEGV_PKUERR , address, pkey); +_exception_pkey (regs, address, pkey);return 0 ; }
Signature · 1 line
2.17.1
Re: [REVIEW][PATCH 7/9] signal/poewrpc: Specialize _exception_pkey for handling pkey exceptions
Hi Eric,
Quoted 7 lines · On Tue, 18 Sep 2018 19:58:48 +0200 "Eric W. Biederman" <[email protected]>…
Now that
_exceptionno longer calls_exception_pkeyit is no longer necessary to handle any signal with anysi_code. All pkey exceptions are SIGSEGV with paired withSEGV_PKUERR. So just handle that case and remove the now unnecessary parameters from_exception_pkey.Signed-off-by "Eric W. Biederman" <[email protected]>
Looks fine to me (small query below).
arch/powerpc/kernel/traps.c static bool exception_common(int signr, struct pt_regs *regs, int code, · line 378
Quoted 10 lines
arch/powerpc/kernel/traps.c +3
-3clear_siginfo (&info); - info.si_signo = signr; - info.si_code = code; + info.si_signo =SIGSEGV ; + info.si_code =SEGV_PKUERR ; info.si_addr = (void __user *) addr; info.si_pkey = key; -force_sig_info (signr, &info, current); +force_sig_info (info.si_signo, &info, current);
^^^^^^^^^^^^^
Why not just SIGSEGV?
Signature · 2 lines
Cheers, Stephen Rothwell
Re: [REVIEW][PATCH 7/9] signal/poewrpc: Specialize _exception_pkey for handling pkey exceptions
Le 21/09/2018 à 10:54, Stephen Rothwell a écrit :
Quoted 9 lines
Hi Eric,
Quoted 6 lines · On Tue, 18 Sep 2018 19:58:48 +0200 "Eric W. Biederman" <[email protected]>…
Now that
_exceptionno longer calls_exception_pkeyit is no longer necessary to handle any signal with anysi_code. All pkey exceptions are SIGSEGV with paired withSEGV_PKUERR. So just handle that case and remove the now unnecessary parameters from_exception_pkey.
Quoted 5 lines
Quoted 1 line
Signed-off-by "Eric W. Biederman" <[email protected]>Looks fine to me (small query below).
Reviewed-by Stephen Rothwell <[email protected]>
In the patch title, s/poewrpc/powerpc
Quoted 14 lines
arch/powerpc/kernel/traps.c static bool exception_common(int signr, struct pt_regs *regs, int code, · line 378
Quoted 11 lines
clear_siginfo(&info);arch/powerpc/kernel/traps.c +3
-3- info.si_signo = signr; - info.si_code = code; + info.si_signo =SIGSEGV ; + info.si_code =SEGV_PKUERR ; info.si_addr = (void __user *) addr; info.si_pkey = key; -force_sig_info (signr, &info, current); +force_sig_info (info.si_signo, &info, current);^^^^^^^^^^^^^Why not just SIGSEGV?
PATCH 8/9 signal/powerpc: Simplify _exception_pkey by using force_sig_pkuerr
In reply to Eric W. BiedermanCall force_sig_pkuerr directly instead of rolling it by hand in _exception_pkey.
--- arch/powerpc/kernel/traps.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
arch/powerpc/kernel/traps.c +1 -9
@@ -364,18 +364,10 @@ static bool exception_common(int signr, struct pt_regs *regs, int code,void _exception_pkey (struct pt_regs *regs,unsigned long addr,int key) { -siginfo_t info; -if (!exception_common (SIGSEGV , regs,SEGV_PKUERR , addr))return ; -clear_siginfo (&info); - info.si_signo =SIGSEGV ; - info.si_code =SEGV_PKUERR ; - info.si_addr = (void __user *) addr; - info.si_pkey = key; - -force_sig_info (info.si_signo, &info, current); +force_sig_pkuerr ((void __user *) addr, key); }void _exception (int signr,struct pt_regs *regs,int code,unsigned long addr)
Signature · 1 line
2.17.1
Re: [REVIEW][PATCH 8/9] signal/powerpc: Simplify _exception_pkey by using force_sig_pkuerr
Hi Eric,
Quoted 5 lines · On Tue, 18 Sep 2018 19:58:49 +0200 "Eric W. Biederman" <[email protected]>…
Call
force_sig_pkuerrdirectly instead of rolling it by hand in_exception_pkey.Signed-off-by "Eric W. Biederman" <[email protected]>
You can ignore the question in the previous email :-)
Signature · 2 lines
Cheers, Stephen Rothwell
PATCH 9/9 signal/powerpc: Use force_sig_fault where appropriate
In reply to Eric W. Biederman--- 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(-)
arch/powerpc/kernel/process.c +1 -8
@@ -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 */
arch/powerpc/mm/fault.c +1 -8
@@ -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 ; }
arch/powerpc/platforms/cell/spu_base.c +2 -2
@@ -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.
arch/powerpc/platforms/cell/spufs/fault.c +8 -18
@@ -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)
Signature · 1 line
2.17.1
Re: [REVIEW][PATCH 9/9] signal/powerpc: Use force_sig_fault where appropriate
Hi Eric,
Quoted 2 lines · On Tue, 18 Sep 2018 19:58:50 +0200 "Eric W. Biederman" <[email protected]>…
Signed-off-by "Eric W. Biederman" <[email protected]>
Again, looks all good to me.
Signature · 2 lines
Cheers, Stephen Rothwell
Hi Eric,
Quoted 4 lines · On Tue, 18 Sep 2018 19:41:09 +0200 [email protected] (Eric W. Biederman)…
Folks please review and double check me. I think I have kept these changes simple and obviously correct but I am human and mess up sometimes.
Its always good to see a nicely set out patch series like this.
Signature · 2 lines
Cheers, Stephen Rothwell