* [PATCH] arch: powerpc: kernel: signal_32.c: Remove unused function
@ 2014-12-07 22:07 Rickard Strandqvist
2014-12-07 22:18 ` Richard Weinberger
0 siblings, 1 reply; 4+ messages in thread
From: Rickard Strandqvist @ 2014-12-07 22:07 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras
Cc: Michael Neuling, Rickard Strandqvist, linux-kernel,
Richard Weinberger, linuxppc-dev
Remove the function sys_debug_setcontext() that is not used anywhere.
This was partially found by using a static code analysis program called cppcheck.
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
arch/powerpc/kernel/signal_32.c | 107 ---------------------------------------
1 file changed, 107 deletions(-)
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index b171001..a571614 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -1297,113 +1297,6 @@ long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
return 0;
}
-#ifdef CONFIG_PPC32
-int sys_debug_setcontext(struct ucontext __user *ctx,
- int ndbg, struct sig_dbg_op __user *dbg,
- int r6, int r7, int r8,
- struct pt_regs *regs)
-{
- struct sig_dbg_op op;
- int i;
- unsigned char tmp;
- unsigned long new_msr = regs->msr;
-#ifdef CONFIG_PPC_ADV_DEBUG_REGS
- unsigned long new_dbcr0 = current->thread.debug.dbcr0;
-#endif
-
- for (i=0; i<ndbg; i++) {
- if (copy_from_user(&op, dbg + i, sizeof(op)))
- return -EFAULT;
- switch (op.dbg_type) {
- case SIG_DBG_SINGLE_STEPPING:
-#ifdef CONFIG_PPC_ADV_DEBUG_REGS
- if (op.dbg_value) {
- new_msr |= MSR_DE;
- new_dbcr0 |= (DBCR0_IDM | DBCR0_IC);
- } else {
- new_dbcr0 &= ~DBCR0_IC;
- if (!DBCR_ACTIVE_EVENTS(new_dbcr0,
- current->thread.debug.dbcr1)) {
- new_msr &= ~MSR_DE;
- new_dbcr0 &= ~DBCR0_IDM;
- }
- }
-#else
- if (op.dbg_value)
- new_msr |= MSR_SE;
- else
- new_msr &= ~MSR_SE;
-#endif
- break;
- case SIG_DBG_BRANCH_TRACING:
-#ifdef CONFIG_PPC_ADV_DEBUG_REGS
- return -EINVAL;
-#else
- if (op.dbg_value)
- new_msr |= MSR_BE;
- else
- new_msr &= ~MSR_BE;
-#endif
- break;
-
- default:
- return -EINVAL;
- }
- }
-
- /* We wait until here to actually install the values in the
- registers so if we fail in the above loop, it will not
- affect the contents of these registers. After this point,
- failure is a problem, anyway, and it's very unlikely unless
- the user is really doing something wrong. */
- regs->msr = new_msr;
-#ifdef CONFIG_PPC_ADV_DEBUG_REGS
- current->thread.debug.dbcr0 = new_dbcr0;
-#endif
-
- if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx))
- || __get_user(tmp, (u8 __user *) ctx)
- || __get_user(tmp, (u8 __user *) (ctx + 1) - 1))
- return -EFAULT;
-
- /*
- * If we get a fault copying the context into the kernel's
- * image of the user's registers, we can't just return -EFAULT
- * because the user's registers will be corrupted. For instance
- * the NIP value may have been updated but not some of the
- * other registers. Given that we have done the access_ok
- * and successfully read the first and last bytes of the region
- * above, this should only happen in an out-of-memory situation
- * or if another thread unmaps the region containing the context.
- * We kill the task with a SIGSEGV in this situation.
- */
- if (do_setcontext(ctx, regs, 1)) {
- if (show_unhandled_signals)
- printk_ratelimited(KERN_INFO "%s[%d]: bad frame in "
- "sys_debug_setcontext: %p nip %08lx "
- "lr %08lx\n",
- current->comm, current->pid,
- ctx, regs->nip, regs->link);
-
- force_sig(SIGSEGV, current);
- goto out;
- }
-
- /*
- * It's not clear whether or why it is desirable to save the
- * sigaltstack setting on signal delivery and restore it on
- * signal return. But other architectures do this and we have
- * always done it up until now so it is probably better not to
- * change it. -- paulus
- */
- restore_altstack(&ctx->uc_stack);
-
- set_thread_flag(TIF_RESTOREALL);
- out:
- return 0;
-}
-#endif
-
/*
* OK, we're invoking a handler
*/
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] arch: powerpc: kernel: signal_32.c: Remove unused function
2014-12-07 22:07 [PATCH] arch: powerpc: kernel: signal_32.c: Remove unused function Rickard Strandqvist
@ 2014-12-07 22:18 ` Richard Weinberger
2014-12-07 23:11 ` Rickard Strandqvist
0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2014-12-07 22:18 UTC (permalink / raw)
To: Rickard Strandqvist, Benjamin Herrenschmidt, Paul Mackerras
Cc: Michael Neuling, linuxppc-dev, linux-kernel
Am 07.12.2014 um 23:07 schrieb Rickard Strandqvist:
> Remove the function sys_debug_setcontext() that is not used anywhere.
>
> This was partially found by using a static code analysis program called cppcheck.
Please don't blindly trust code analysis tools.
The function you're removing *is* in use.
LD init/built-in.o
arch/powerpc/kernel/built-in.o: In function `sys_call_table':
(.rodata+0x744): undefined reference to `sys_debug_setcontext'
make: *** [vmlinux] Error 1
Thanks,
//richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arch: powerpc: kernel: signal_32.c: Remove unused function
2014-12-07 22:18 ` Richard Weinberger
@ 2014-12-07 23:11 ` Rickard Strandqvist
2014-12-07 23:15 ` Richard Weinberger
0 siblings, 1 reply; 4+ messages in thread
From: Rickard Strandqvist @ 2014-12-07 23:11 UTC (permalink / raw)
To: Richard Weinberger
Cc: Michael Neuling, linux-kernel@vger.kernel.org, Paul Mackerras,
linuxppc-dev
Hi
Ok, sorry :-(
But I really do not. I've hacked together a script that will scan all
the code for the function, and test builds with some different config
options turned on.
Kind regards
Rickard Strandqvist
2014-12-07 23:18 GMT+01:00 Richard Weinberger <richard@nod.at>:
> Am 07.12.2014 um 23:07 schrieb Rickard Strandqvist:
>> Remove the function sys_debug_setcontext() that is not used anywhere.
>>
>> This was partially found by using a static code analysis program called cppcheck.
>
> Please don't blindly trust code analysis tools.
> The function you're removing *is* in use.
>
> LD init/built-in.o
> arch/powerpc/kernel/built-in.o: In function `sys_call_table':
> (.rodata+0x744): undefined reference to `sys_debug_setcontext'
> make: *** [vmlinux] Error 1
>
> Thanks,
> //richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arch: powerpc: kernel: signal_32.c: Remove unused function
2014-12-07 23:11 ` Rickard Strandqvist
@ 2014-12-07 23:15 ` Richard Weinberger
0 siblings, 0 replies; 4+ messages in thread
From: Richard Weinberger @ 2014-12-07 23:15 UTC (permalink / raw)
To: Rickard Strandqvist
Cc: Michael Neuling, linux-kernel@vger.kernel.org, Paul Mackerras,
linuxppc-dev
Am 08.12.2014 um 00:11 schrieb Rickard Strandqvist:
> Hi
>
> Ok, sorry :-(
>
> But I really do not. I've hacked together a script that will scan all
> the code for the function, and test builds with some different config
> options turned on.
Looks like you did not build a powerpc32 kernel. :-)
FWIW, this is the reference to the function:
arch/powerpc/include/asm/systbl.h:OLDSYS(debug_setcontext)
Thanks,
//richard
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-07 23:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-07 22:07 [PATCH] arch: powerpc: kernel: signal_32.c: Remove unused function Rickard Strandqvist
2014-12-07 22:18 ` Richard Weinberger
2014-12-07 23:11 ` Rickard Strandqvist
2014-12-07 23:15 ` Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).