mirror of https://gitee.com/openkylin/linux.git
[PATCH] convert that currently tests _NSIG directly to use valid_signal()
Convert most of the current code that uses _NSIG directly to instead use valid_signal(). This avoids gcc -W warnings and off-by-one errors. Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
e5bdd883a1
commit
7ed20e1ad5
|
@ -14,6 +14,7 @@
|
|||
#include <linux/user.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
@ -335,7 +336,7 @@ do_sys_ptrace(long request, long pid, long addr, long data,
|
|||
/* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -365,7 +366,7 @@ do_sys_ptrace(long request, long pid, long addr, long data,
|
|||
|
||||
case PTRACE_SINGLESTEP: /* execute single instruction. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
/* Mark single stepping. */
|
||||
child->thread_info->bpt_nsaved = -1;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <linux/user.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
@ -693,7 +694,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat
|
|||
case PTRACE_SYSCALL:
|
||||
case PTRACE_CONT:
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -728,7 +729,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat
|
|||
*/
|
||||
case PTRACE_SINGLESTEP:
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
child->ptrace |= PT_SINGLESTEP;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/ptrace.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
@ -591,7 +592,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat
|
|||
case PTRACE_SYSCALL:
|
||||
case PTRACE_CONT:
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -626,7 +627,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat
|
|||
*/
|
||||
case PTRACE_SINGLESTEP:
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
child->ptrace |= PT_SINGLESTEP;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <linux/errno.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/page.h>
|
||||
|
@ -184,7 +185,7 @@ sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_CONT:
|
||||
ret = -EIO;
|
||||
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
|
||||
if (request == PTRACE_SYSCALL) {
|
||||
|
@ -219,7 +220,7 @@ sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_SINGLESTEP:
|
||||
ret = -EIO;
|
||||
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <linux/user.h>
|
||||
#include <linux/config.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/page.h>
|
||||
|
@ -239,7 +240,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -267,7 +268,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
|
||||
case PTRACE_SINGLESTEP: /* set the trap flag. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
ptrace_enable(child);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/ptrace.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/config.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/page.h>
|
||||
|
@ -171,7 +172,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data >= _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break ;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -202,7 +203,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
|
||||
case PTRACE_SINGLESTEP: { /* set the trap flag. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
child->exit_code = data;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <linux/security.h>
|
||||
#include <linux/audit.h>
|
||||
#include <linux/seccomp.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
@ -511,7 +512,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL) {
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -543,7 +544,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
|
||||
case PTRACE_SINGLESTEP: /* set the trap flag. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
set_singlestep(child);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <linux/user.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/audit.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/processor.h>
|
||||
|
@ -1481,7 +1482,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
|
|||
case PTRACE_CONT:
|
||||
/* restart after signal. */
|
||||
ret = -EIO;
|
||||
if (data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
goto out_tsk;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -1520,7 +1521,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
|
|||
/* let child execute for one instruction */
|
||||
case PTRACE_SINGLEBLOCK:
|
||||
ret = -EIO;
|
||||
if (data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
goto out_tsk;
|
||||
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/ptrace.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/io.h>
|
||||
|
@ -665,7 +666,7 @@ do_ptrace(long request, struct task_struct *child, long addr, long data)
|
|||
case PTRACE_SYSCALL:
|
||||
case PTRACE_CONT:
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -700,7 +701,7 @@ do_ptrace(long request, struct task_struct *child, long addr, long data)
|
|||
unsigned long pc, insn;
|
||||
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
if ((child->ptrace & PT_DTRACE) == 0) {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <linux/ptrace.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/config.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/page.h>
|
||||
|
@ -251,7 +252,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
long tmp;
|
||||
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL) {
|
||||
child->thread.work.syscall_trace = ~0;
|
||||
|
@ -292,7 +293,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
long tmp;
|
||||
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
child->thread.work.syscall_trace = 0;
|
||||
tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <linux/ptrace.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/config.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/page.h>
|
||||
|
@ -240,7 +241,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
long tmp;
|
||||
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -278,7 +279,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
long tmp;
|
||||
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <linux/smp_lock.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/cpu.h>
|
||||
#include <asm/fpu.h>
|
||||
|
@ -257,7 +258,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL) {
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/smp_lock.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/cpu.h>
|
||||
#include <asm/fpu.h>
|
||||
|
@ -241,7 +242,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned int) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL) {
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <linux/personality.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/compat.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
@ -285,7 +286,7 @@ long sys_ptrace(long request, pid_t pid, long addr, long data)
|
|||
ret = -EIO;
|
||||
DBG("sys_ptrace(%s)\n",
|
||||
request == PTRACE_SYSCALL ? "SYSCALL" : "CONT");
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
goto out_tsk;
|
||||
child->ptrace &= ~(PT_SINGLESTEP|PT_BLOCKSTEP);
|
||||
if (request == PTRACE_SYSCALL) {
|
||||
|
@ -311,7 +312,7 @@ long sys_ptrace(long request, pid_t pid, long addr, long data)
|
|||
case PTRACE_SINGLEBLOCK:
|
||||
DBG("sys_ptrace(SINGLEBLOCK)\n");
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
goto out_tsk;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
child->ptrace &= ~PT_SINGLESTEP;
|
||||
|
@ -328,7 +329,7 @@ long sys_ptrace(long request, pid_t pid, long addr, long data)
|
|||
case PTRACE_SINGLESTEP:
|
||||
DBG("sys_ptrace(SINGLESTEP)\n");
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
goto out_tsk;
|
||||
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <linux/ptrace.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/page.h>
|
||||
|
@ -356,7 +357,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL) {
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -389,7 +390,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
|
|||
|
||||
case PTRACE_SINGLESTEP: { /* set the trap flag. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
set_single_step(child);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <linux/security.h>
|
||||
#include <linux/audit.h>
|
||||
#include <linux/seccomp.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/page.h>
|
||||
|
@ -162,7 +163,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -194,7 +195,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
|
|||
|
||||
case PTRACE_SINGLESTEP: { /* set the trap flag. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
set_single_step(child);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <linux/ptrace.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/page.h>
|
||||
|
@ -293,7 +294,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -325,7 +326,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data)
|
|||
|
||||
case PTRACE_SINGLESTEP: { /* set the trap flag. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
set_single_step(child);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <linux/user.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/audit.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/segment.h>
|
||||
#include <asm/page.h>
|
||||
|
@ -609,7 +610,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
|
|||
/* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT:
|
||||
/* restart after signal. */
|
||||
if ((unsigned long) data >= _NSIG)
|
||||
if (!valid_signal(data))
|
||||
return -EIO;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -637,7 +638,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
|
|||
|
||||
case PTRACE_SINGLESTEP:
|
||||
/* set the trap flag. */
|
||||
if ((unsigned long) data >= _NSIG)
|
||||
if (!valid_signal(data))
|
||||
return -EIO;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
child->exit_code = data;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <linux/user.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
@ -197,7 +198,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -228,7 +229,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
struct pt_regs *dummy = NULL;
|
||||
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
if ((child->ptrace & PT_DTRACE) == 0) {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <linux/errno.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/user.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
@ -255,7 +256,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
|
@ -285,7 +286,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data)
|
|||
struct pt_regs *regs;
|
||||
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
if ((child->ptrace & PT_DTRACE) == 0) {
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/smp.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/system.h>
|
||||
|
@ -526,7 +527,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
|
|||
addr = 1;
|
||||
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
if (data > _NSIG) {
|
||||
if (!valid_signal(data)) {
|
||||
pt_error_return(regs, EIO);
|
||||
goto out_tsk;
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <linux/smp.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/asi.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
@ -559,7 +560,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
|
|||
addr = 1;
|
||||
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
if (data > _NSIG) {
|
||||
if (!valid_signal(data)) {
|
||||
pt_error_return(regs, EIO);
|
||||
goto out_tsk;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ long sys_ptrace(long request, long pid, long addr, long data)
|
|||
case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */
|
||||
case PTRACE_CONT: { /* restart after signal. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
|
||||
child->ptrace &= ~PT_DTRACE;
|
||||
|
@ -179,7 +179,7 @@ long sys_ptrace(long request, long pid, long addr, long data)
|
|||
|
||||
case PTRACE_SINGLESTEP: { /* set the trap flag. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
|
||||
child->ptrace |= PT_DTRACE;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <linux/sched.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/errno.h>
|
||||
#include <asm/ptrace.h>
|
||||
|
@ -208,7 +209,7 @@ int sys_ptrace(long request, long pid, long addr, long data)
|
|||
/* Execute a single instruction. */
|
||||
case PTRACE_SINGLESTEP:
|
||||
rval = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
|
||||
/* Turn CHILD's single-step flag on or off. */
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/security.h>
|
||||
#include <linux/audit.h>
|
||||
#include <linux/seccomp.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
@ -467,7 +468,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
|
|||
case PTRACE_CONT: /* restart after signal. */
|
||||
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
if (request == PTRACE_SYSCALL)
|
||||
set_tsk_thread_flag(child,TIF_SYSCALL_TRACE);
|
||||
|
@ -529,7 +530,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data
|
|||
|
||||
case PTRACE_SINGLESTEP: /* set the trap flag. */
|
||||
ret = -EIO;
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
break;
|
||||
clear_tsk_thread_flag(child,TIF_SYSCALL_TRACE);
|
||||
set_singlestep(child);
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <linux/major.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/console.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
@ -641,7 +642,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file,
|
|||
extern int spawnpid, spawnsig;
|
||||
if (!perm || !capable(CAP_KILL))
|
||||
return -EPERM;
|
||||
if (arg < 1 || arg > _NSIG || arg == SIGKILL)
|
||||
if (!valid_signal(arg) || arg < 1 || arg == SIGKILL)
|
||||
return -EINVAL;
|
||||
spawnpid = current->pid;
|
||||
spawnsig = arg;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/poll.h>
|
||||
#include <asm/siginfo.h>
|
||||
|
@ -308,7 +309,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
|
|||
break;
|
||||
case F_SETSIG:
|
||||
/* arg == 0 restores default behaviour. */
|
||||
if (arg < 0 || arg > _NSIG) {
|
||||
if (!valid_signal(arg)) {
|
||||
break;
|
||||
}
|
||||
err = 0;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <linux/skbuff.h>
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/signal.h>
|
||||
#include <net/sock.h>
|
||||
#include "util.h"
|
||||
|
||||
|
@ -976,8 +977,7 @@ asmlinkage long sys_mq_notify(mqd_t mqdes,
|
|||
notification.sigev_notify != SIGEV_THREAD))
|
||||
return -EINVAL;
|
||||
if (notification.sigev_notify == SIGEV_SIGNAL &&
|
||||
(notification.sigev_signo < 0 ||
|
||||
notification.sigev_signo > _NSIG)) {
|
||||
!valid_signal(notification.sigev_signo)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
if (notification.sigev_notify == SIGEV_THREAD) {
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <linux/mempolicy.h>
|
||||
#include <linux/cpuset.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/unistd.h>
|
||||
|
@ -277,7 +278,7 @@ void set_special_pids(pid_t session, pid_t pgrp)
|
|||
*/
|
||||
int allow_signal(int sig)
|
||||
{
|
||||
if (sig < 1 || sig > _NSIG)
|
||||
if (!valid_signal(sig) || sig < 1)
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irq(¤t->sighand->siglock);
|
||||
|
@ -298,7 +299,7 @@ EXPORT_SYMBOL(allow_signal);
|
|||
|
||||
int disallow_signal(int sig)
|
||||
{
|
||||
if (sig < 1 || sig > _NSIG)
|
||||
if (!valid_signal(sig) || sig < 1)
|
||||
return -EINVAL;
|
||||
|
||||
spin_lock_irq(¤t->sighand->siglock);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <linux/mount.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)
|
||||
|
||||
|
@ -654,7 +655,7 @@ static int futex_fd(unsigned long uaddr, int signal)
|
|||
int ret, err;
|
||||
|
||||
ret = -EINVAL;
|
||||
if (signal < 0 || signal > _NSIG)
|
||||
if (!valid_signal(signal))
|
||||
goto out;
|
||||
|
||||
ret = get_unused_fd();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <linux/smp_lock.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <asm/pgtable.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
@ -166,7 +167,7 @@ int ptrace_attach(struct task_struct *task)
|
|||
|
||||
int ptrace_detach(struct task_struct *child, unsigned int data)
|
||||
{
|
||||
if ((unsigned long) data > _NSIG)
|
||||
if (!valid_signal(data))
|
||||
return -EIO;
|
||||
|
||||
/* Architecture-specific hardware disable .. */
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <linux/syscalls.h>
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/posix-timers.h>
|
||||
#include <linux/signal.h>
|
||||
#include <asm/param.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/unistd.h>
|
||||
|
@ -646,7 +647,7 @@ static int check_kill_permission(int sig, struct siginfo *info,
|
|||
struct task_struct *t)
|
||||
{
|
||||
int error = -EINVAL;
|
||||
if (sig < 0 || sig > _NSIG)
|
||||
if (!valid_signal(sig))
|
||||
return error;
|
||||
error = -EPERM;
|
||||
if ((!info || ((unsigned long)info != 1 &&
|
||||
|
@ -1245,7 +1246,7 @@ send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
|
|||
* Make sure legacy kernel users don't send in bad values
|
||||
* (normal paths check this in check_kill_permission).
|
||||
*/
|
||||
if (sig < 0 || sig > _NSIG)
|
||||
if (!valid_signal(sig))
|
||||
return -EINVAL;
|
||||
|
||||
/*
|
||||
|
@ -1520,7 +1521,7 @@ void do_notify_parent(struct task_struct *tsk, int sig)
|
|||
if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN)
|
||||
sig = 0;
|
||||
}
|
||||
if (sig > 0 && sig <= _NSIG)
|
||||
if (valid_signal(sig) && sig > 0)
|
||||
__group_send_sig_info(sig, &info, tsk->parent);
|
||||
__wake_up_parent(tsk, tsk->parent);
|
||||
spin_unlock_irqrestore(&psig->siglock, flags);
|
||||
|
@ -2364,7 +2365,7 @@ do_sigaction(int sig, const struct k_sigaction *act, struct k_sigaction *oact)
|
|||
{
|
||||
struct k_sigaction *k;
|
||||
|
||||
if (sig < 1 || sig > _NSIG || (act && sig_kernel_only(sig)))
|
||||
if (!valid_signal(sig) || sig < 1 || (act && sig_kernel_only(sig)))
|
||||
return -EINVAL;
|
||||
|
||||
k = ¤t->sighand->action[sig-1];
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <linux/dcookies.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/tty.h>
|
||||
#include <linux/signal.h>
|
||||
|
||||
#include <linux/compat.h>
|
||||
#include <linux/syscalls.h>
|
||||
|
@ -1637,7 +1638,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3,
|
|||
switch (option) {
|
||||
case PR_SET_PDEATHSIG:
|
||||
sig = arg2;
|
||||
if (sig < 0 || sig > _NSIG) {
|
||||
if (!valid_signal(sig)) {
|
||||
error = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue