x86: signal: use signal_fault() in sys_sigreturn()
PATCH 1/3 x86: signal: use signal_fault() in sys_sigreturn()
From: Hiroshi Shimamoto <[email protected]>
Impact: cleanup
Call signal_fault() in error route of sys_sigreturn(). Change log level to KERN_EMERG if current is init.
--- arch/x86/kernel/signal.c | 15 +++------------ 1 files changed, 3 insertions(+), 12 deletions(-)
arch/x86/kernel/signal.c +3 -12
@@ -594,17 +594,7 @@ asmlinkage unsigned long sys_sigreturn(unsigned long __unused)return ax; badframe: -if (show_unhandled_signals &&printk_ratelimit ()) { -printk ("%s%s[%d] bad frame in sigreturn frame:" -"%p ip:%lx sp:%lx oeax:%lx" , -task_pid_nr (current) >1 ?KERN_INFO :KERN_EMERG , - current->comm,task_pid_nr (current), frame, regs->ip, - regs->sp, regs->orig_ax); -print_vma_addr (" in " , regs->ip); -printk (KERN_CONT "\n" ); - } - -force_sig (SIGSEGV , current); +signal_fault (regs, frame,"sigreturn" );return 0 ; }
@@ -906,8 +896,9 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where)struct task_struct *me = current;if (show_unhandled_signals &&printk_ratelimit ()) { -printk (KERN_INFO +printk ("%s" "%s[%d] bad frame in %s frame:%p ip:%lx sp:%lx orax:%lx" , +task_pid_nr (current) >1 ?KERN_INFO :KERN_EMERG , me->comm, me->pid, where, frame, regs->ip, regs->sp, regs->orig_ax);print_vma_addr (" in " , regs->ip);
Signature · 1 line
1.6.0.4
PATCH 2/3 x86: ia32_signal: use __put_user() instead of __copy_to_user()
From: Hiroshi Shimamoto <[email protected]>
Impact: cleanup
__put_user() can be used for constant size 8, like arch/x86/kernel/signal.c.
--- arch/x86/ia32/ia32_signal.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/x86/ia32/ia32_signal.c +2 -2
@@ -467,7 +467,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,* These are actually not used anymore, but left because some * gdb versions depend on them as a marker. */ - err |=__copy_to_user (frame->retcode, &code,8 ); + err |=__put_user (*((u64 *)&code), (u64 *)frame->retcode);if (err)return -EFAULT ;
@@ -554,7 +554,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,* Not actually used anymore, but left because some gdb * versions need it. */ - err |=__copy_to_user (frame->retcode, &code,8 ); + err |=__put_user (*((u64 *)&code), (u64 *)frame->retcode);if (err)return -EFAULT ;
Signature · 1 line
1.6.0.4
PATCH 3/3 x86: ia32_signal: use proper macro __USER32_DS
In reply to Hiroshi ShimamotoFrom: Hiroshi Shimamoto <[email protected]>
Impact: cleanup
Use __USER32_DS instead of __USER_DS in ia32_signal.c. No impact, because __USER32_DS is defined __USER_DS.
--- arch/x86/ia32/ia32_signal.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/ia32/ia32_signal.c +1 -1
@@ -396,7 +396,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, }/* This is the legacy signal stack switching. */ -else if ((regs->ss &0xffff ) != __USER_DS && +else if ((regs->ss &0xffff ) != __USER32_DS && !(ka->sa.sa_flags &SA_RESTORER ) && ka->sa.sa_restorer) sp = (unsigned long ) ka->sa.sa_restorer;
Signature · 1 line
1.6.0.4
Quoted 11 lines · Hiroshi Shimamoto
From: Hiroshi Shimamoto <[email protected]>
Impact: cleanup
Call
signal_fault()in error route ofsys_sigreturn(). Change log level toKERN_EMERGif current is init.Signed-off-by Hiroshi Shimamoto <[email protected]>--- arch/x86/kernel/signal.c | 15 +++------------ 1 files changed, 3 insertions(+), 12 deletions(-)
applied your three patches to tip/x86/signal:
8bee3f0: x86: ia32_signal: use proper macro __USER32_DS
d0b48ca: x86: ia32_signal: use __put_user() instead of __copy_to_user()
ae417bb: x86: signal: use signal_fault() in sys_sigreturn()
thanks!
Ingo