diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/arm/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/arm26/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/cris/arch-v10/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/frv/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/h8300/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/i386/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/ia64/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/m32r/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/m68k/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/m68knommu/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/mips/kernel/ptrace.c | 3 | ||||
-rw-r--r-- | arch/mips/kernel/ptrace32.c | 3 | ||||
-rw-r--r-- | arch/parisc/kernel/ptrace.c | 7 | ||||
-rw-r--r-- | arch/ppc/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/ppc64/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/ppc64/kernel/ptrace32.c | 5 | ||||
-rw-r--r-- | arch/s390/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/sh/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/sh64/kernel/ptrace.c | 5 | ||||
-rw-r--r-- | arch/sparc/kernel/ptrace.c | 3 | ||||
-rw-r--r-- | arch/sparc64/kernel/ptrace.c | 3 | ||||
-rw-r--r-- | arch/um/kernel/ptrace.c | 4 | ||||
-rw-r--r-- | arch/v850/kernel/ptrace.c | 3 | ||||
-rw-r--r-- | arch/x86_64/kernel/ptrace.c | 5 |
25 files changed, 70 insertions, 46 deletions
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c index d00583161574..bbd37536d14e 100644 --- a/arch/alpha/kernel/ptrace.c +++ b/arch/alpha/kernel/ptrace.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/user.h> | 14 | #include <linux/user.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/security.h> | 16 | #include <linux/security.h> |
17 | #include <linux/signal.h> | ||
17 | 18 | ||
18 | #include <asm/uaccess.h> | 19 | #include <asm/uaccess.h> |
19 | #include <asm/pgtable.h> | 20 | #include <asm/pgtable.h> |
@@ -335,7 +336,7 @@ do_sys_ptrace(long request, long pid, long addr, long data, | |||
335 | /* continue and stop at next (return from) syscall */ | 336 | /* continue and stop at next (return from) syscall */ |
336 | case PTRACE_CONT: /* restart after signal. */ | 337 | case PTRACE_CONT: /* restart after signal. */ |
337 | ret = -EIO; | 338 | ret = -EIO; |
338 | if ((unsigned long) data > _NSIG) | 339 | if (!valid_signal(data)) |
339 | break; | 340 | break; |
340 | if (request == PTRACE_SYSCALL) | 341 | if (request == PTRACE_SYSCALL) |
341 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 342 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -365,7 +366,7 @@ do_sys_ptrace(long request, long pid, long addr, long data, | |||
365 | 366 | ||
366 | case PTRACE_SINGLESTEP: /* execute single instruction. */ | 367 | case PTRACE_SINGLESTEP: /* execute single instruction. */ |
367 | ret = -EIO; | 368 | ret = -EIO; |
368 | if ((unsigned long) data > _NSIG) | 369 | if (!valid_signal(data)) |
369 | break; | 370 | break; |
370 | /* Mark single stepping. */ | 371 | /* Mark single stepping. */ |
371 | child->thread_info->bpt_nsaved = -1; | 372 | child->thread_info->bpt_nsaved = -1; |
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index efd7a341614b..cd99b83f14c2 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/user.h> | 19 | #include <linux/user.h> |
20 | #include <linux/security.h> | 20 | #include <linux/security.h> |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/signal.h> | ||
22 | 23 | ||
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | #include <asm/pgtable.h> | 25 | #include <asm/pgtable.h> |
@@ -693,7 +694,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat | |||
693 | case PTRACE_SYSCALL: | 694 | case PTRACE_SYSCALL: |
694 | case PTRACE_CONT: | 695 | case PTRACE_CONT: |
695 | ret = -EIO; | 696 | ret = -EIO; |
696 | if ((unsigned long) data > _NSIG) | 697 | if (!valid_signal(data)) |
697 | break; | 698 | break; |
698 | if (request == PTRACE_SYSCALL) | 699 | if (request == PTRACE_SYSCALL) |
699 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 700 | 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 | |||
728 | */ | 729 | */ |
729 | case PTRACE_SINGLESTEP: | 730 | case PTRACE_SINGLESTEP: |
730 | ret = -EIO; | 731 | ret = -EIO; |
731 | if ((unsigned long) data > _NSIG) | 732 | if (!valid_signal(data)) |
732 | break; | 733 | break; |
733 | child->ptrace |= PT_SINGLESTEP; | 734 | child->ptrace |= PT_SINGLESTEP; |
734 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 735 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
diff --git a/arch/arm26/kernel/ptrace.c b/arch/arm26/kernel/ptrace.c index 2a137146a77c..8a52124de0e1 100644 --- a/arch/arm26/kernel/ptrace.c +++ b/arch/arm26/kernel/ptrace.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/ptrace.h> | 18 | #include <linux/ptrace.h> |
19 | #include <linux/user.h> | 19 | #include <linux/user.h> |
20 | #include <linux/security.h> | 20 | #include <linux/security.h> |
21 | #include <linux/signal.h> | ||
21 | 22 | ||
22 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
23 | #include <asm/pgtable.h> | 24 | #include <asm/pgtable.h> |
@@ -591,7 +592,7 @@ static int do_ptrace(int request, struct task_struct *child, long addr, long dat | |||
591 | case PTRACE_SYSCALL: | 592 | case PTRACE_SYSCALL: |
592 | case PTRACE_CONT: | 593 | case PTRACE_CONT: |
593 | ret = -EIO; | 594 | ret = -EIO; |
594 | if ((unsigned long) data > _NSIG) | 595 | if (!valid_signal(data)) |
595 | break; | 596 | break; |
596 | if (request == PTRACE_SYSCALL) | 597 | if (request == PTRACE_SYSCALL) |
597 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 598 | 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 | |||
626 | */ | 627 | */ |
627 | case PTRACE_SINGLESTEP: | 628 | case PTRACE_SINGLESTEP: |
628 | ret = -EIO; | 629 | ret = -EIO; |
629 | if ((unsigned long) data > _NSIG) | 630 | if (!valid_signal(data)) |
630 | break; | 631 | break; |
631 | child->ptrace |= PT_SINGLESTEP; | 632 | child->ptrace |= PT_SINGLESTEP; |
632 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 633 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c index da15db8ae482..581ecabaae53 100644 --- a/arch/cris/arch-v10/kernel/ptrace.c +++ b/arch/cris/arch-v10/kernel/ptrace.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/ptrace.h> | 11 | #include <linux/ptrace.h> |
12 | #include <linux/user.h> | 12 | #include <linux/user.h> |
13 | #include <linux/signal.h> | ||
13 | 14 | ||
14 | #include <asm/uaccess.h> | 15 | #include <asm/uaccess.h> |
15 | #include <asm/page.h> | 16 | #include <asm/page.h> |
@@ -184,7 +185,7 @@ sys_ptrace(long request, long pid, long addr, long data) | |||
184 | case PTRACE_CONT: | 185 | case PTRACE_CONT: |
185 | ret = -EIO; | 186 | ret = -EIO; |
186 | 187 | ||
187 | if ((unsigned long) data > _NSIG) | 188 | if (!valid_signal(data)) |
188 | break; | 189 | break; |
189 | 190 | ||
190 | if (request == PTRACE_SYSCALL) { | 191 | if (request == PTRACE_SYSCALL) { |
@@ -219,7 +220,7 @@ sys_ptrace(long request, long pid, long addr, long data) | |||
219 | case PTRACE_SINGLESTEP: | 220 | case PTRACE_SINGLESTEP: |
220 | ret = -EIO; | 221 | ret = -EIO; |
221 | 222 | ||
222 | if ((unsigned long) data > _NSIG) | 223 | if (!valid_signal(data)) |
223 | break; | 224 | break; |
224 | 225 | ||
225 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 226 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
diff --git a/arch/frv/kernel/ptrace.c b/arch/frv/kernel/ptrace.c index 2a0efb739adc..cbe03cba9f02 100644 --- a/arch/frv/kernel/ptrace.c +++ b/arch/frv/kernel/ptrace.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/user.h> | 20 | #include <linux/user.h> |
21 | #include <linux/config.h> | 21 | #include <linux/config.h> |
22 | #include <linux/security.h> | 22 | #include <linux/security.h> |
23 | #include <linux/signal.h> | ||
23 | 24 | ||
24 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
25 | #include <asm/page.h> | 26 | #include <asm/page.h> |
@@ -239,7 +240,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
239 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 240 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
240 | case PTRACE_CONT: /* restart after signal. */ | 241 | case PTRACE_CONT: /* restart after signal. */ |
241 | ret = -EIO; | 242 | ret = -EIO; |
242 | if ((unsigned long) data > _NSIG) | 243 | if (!valid_signal(data)) |
243 | break; | 244 | break; |
244 | if (request == PTRACE_SYSCALL) | 245 | if (request == PTRACE_SYSCALL) |
245 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 246 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -267,7 +268,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
267 | 268 | ||
268 | case PTRACE_SINGLESTEP: /* set the trap flag. */ | 269 | case PTRACE_SINGLESTEP: /* set the trap flag. */ |
269 | ret = -EIO; | 270 | ret = -EIO; |
270 | if ((unsigned long) data > _NSIG) | 271 | if (!valid_signal(data)) |
271 | break; | 272 | break; |
272 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 273 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
273 | ptrace_enable(child); | 274 | ptrace_enable(child); |
diff --git a/arch/h8300/kernel/ptrace.c b/arch/h8300/kernel/ptrace.c index 5f19d774a288..05c15e869777 100644 --- a/arch/h8300/kernel/ptrace.c +++ b/arch/h8300/kernel/ptrace.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/ptrace.h> | 24 | #include <linux/ptrace.h> |
25 | #include <linux/user.h> | 25 | #include <linux/user.h> |
26 | #include <linux/config.h> | 26 | #include <linux/config.h> |
27 | #include <linux/signal.h> | ||
27 | 28 | ||
28 | #include <asm/uaccess.h> | 29 | #include <asm/uaccess.h> |
29 | #include <asm/page.h> | 30 | #include <asm/page.h> |
@@ -171,7 +172,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
171 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 172 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
172 | case PTRACE_CONT: { /* restart after signal. */ | 173 | case PTRACE_CONT: { /* restart after signal. */ |
173 | ret = -EIO; | 174 | ret = -EIO; |
174 | if ((unsigned long) data >= _NSIG) | 175 | if (!valid_signal(data)) |
175 | break ; | 176 | break ; |
176 | if (request == PTRACE_SYSCALL) | 177 | if (request == PTRACE_SYSCALL) |
177 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 178 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -202,7 +203,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
202 | 203 | ||
203 | case PTRACE_SINGLESTEP: { /* set the trap flag. */ | 204 | case PTRACE_SINGLESTEP: { /* set the trap flag. */ |
204 | ret = -EIO; | 205 | ret = -EIO; |
205 | if ((unsigned long) data > _NSIG) | 206 | if (!valid_signal(data)) |
206 | break; | 207 | break; |
207 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 208 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
208 | child->exit_code = data; | 209 | child->exit_code = data; |
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c index b2f17640ceff..e8c965ce86eb 100644 --- a/arch/i386/kernel/ptrace.c +++ b/arch/i386/kernel/ptrace.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/security.h> | 16 | #include <linux/security.h> |
17 | #include <linux/audit.h> | 17 | #include <linux/audit.h> |
18 | #include <linux/seccomp.h> | 18 | #include <linux/seccomp.h> |
19 | #include <linux/signal.h> | ||
19 | 20 | ||
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | #include <asm/pgtable.h> | 22 | #include <asm/pgtable.h> |
@@ -511,7 +512,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
511 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 512 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
512 | case PTRACE_CONT: /* restart after signal. */ | 513 | case PTRACE_CONT: /* restart after signal. */ |
513 | ret = -EIO; | 514 | ret = -EIO; |
514 | if ((unsigned long) data > _NSIG) | 515 | if (!valid_signal(data)) |
515 | break; | 516 | break; |
516 | if (request == PTRACE_SYSCALL) { | 517 | if (request == PTRACE_SYSCALL) { |
517 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 518 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -543,7 +544,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
543 | 544 | ||
544 | case PTRACE_SINGLESTEP: /* set the trap flag. */ | 545 | case PTRACE_SINGLESTEP: /* set the trap flag. */ |
545 | ret = -EIO; | 546 | ret = -EIO; |
546 | if ((unsigned long) data > _NSIG) | 547 | if (!valid_signal(data)) |
547 | break; | 548 | break; |
548 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 549 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
549 | set_singlestep(child); | 550 | set_singlestep(child); |
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 55789fcd7210..c253fd5914fc 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/user.h> | 17 | #include <linux/user.h> |
18 | #include <linux/security.h> | 18 | #include <linux/security.h> |
19 | #include <linux/audit.h> | 19 | #include <linux/audit.h> |
20 | #include <linux/signal.h> | ||
20 | 21 | ||
21 | #include <asm/pgtable.h> | 22 | #include <asm/pgtable.h> |
22 | #include <asm/processor.h> | 23 | #include <asm/processor.h> |
@@ -1481,7 +1482,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data) | |||
1481 | case PTRACE_CONT: | 1482 | case PTRACE_CONT: |
1482 | /* restart after signal. */ | 1483 | /* restart after signal. */ |
1483 | ret = -EIO; | 1484 | ret = -EIO; |
1484 | if (data > _NSIG) | 1485 | if (!valid_signal(data)) |
1485 | goto out_tsk; | 1486 | goto out_tsk; |
1486 | if (request == PTRACE_SYSCALL) | 1487 | if (request == PTRACE_SYSCALL) |
1487 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 1488 | 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) | |||
1520 | /* let child execute for one instruction */ | 1521 | /* let child execute for one instruction */ |
1521 | case PTRACE_SINGLEBLOCK: | 1522 | case PTRACE_SINGLEBLOCK: |
1522 | ret = -EIO; | 1523 | ret = -EIO; |
1523 | if (data > _NSIG) | 1524 | if (!valid_signal(data)) |
1524 | goto out_tsk; | 1525 | goto out_tsk; |
1525 | 1526 | ||
1526 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 1527 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c index 8b40f362dd6f..124f7c1b775e 100644 --- a/arch/m32r/kernel/ptrace.c +++ b/arch/m32r/kernel/ptrace.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/ptrace.h> | 24 | #include <linux/ptrace.h> |
25 | #include <linux/user.h> | 25 | #include <linux/user.h> |
26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
27 | #include <linux/signal.h> | ||
27 | 28 | ||
28 | #include <asm/cacheflush.h> | 29 | #include <asm/cacheflush.h> |
29 | #include <asm/io.h> | 30 | #include <asm/io.h> |
@@ -665,7 +666,7 @@ do_ptrace(long request, struct task_struct *child, long addr, long data) | |||
665 | case PTRACE_SYSCALL: | 666 | case PTRACE_SYSCALL: |
666 | case PTRACE_CONT: | 667 | case PTRACE_CONT: |
667 | ret = -EIO; | 668 | ret = -EIO; |
668 | if ((unsigned long) data > _NSIG) | 669 | if (!valid_signal(data)) |
669 | break; | 670 | break; |
670 | if (request == PTRACE_SYSCALL) | 671 | if (request == PTRACE_SYSCALL) |
671 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 672 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -700,7 +701,7 @@ do_ptrace(long request, struct task_struct *child, long addr, long data) | |||
700 | unsigned long pc, insn; | 701 | unsigned long pc, insn; |
701 | 702 | ||
702 | ret = -EIO; | 703 | ret = -EIO; |
703 | if ((unsigned long) data > _NSIG) | 704 | if (!valid_signal(data)) |
704 | break; | 705 | break; |
705 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 706 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
706 | if ((child->ptrace & PT_DTRACE) == 0) { | 707 | if ((child->ptrace & PT_DTRACE) == 0) { |
diff --git a/arch/m68k/kernel/ptrace.c b/arch/m68k/kernel/ptrace.c index 0beb53333ba3..f4e1e5eb8e12 100644 --- a/arch/m68k/kernel/ptrace.c +++ b/arch/m68k/kernel/ptrace.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/ptrace.h> | 19 | #include <linux/ptrace.h> |
20 | #include <linux/user.h> | 20 | #include <linux/user.h> |
21 | #include <linux/config.h> | 21 | #include <linux/config.h> |
22 | #include <linux/signal.h> | ||
22 | 23 | ||
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | #include <asm/page.h> | 25 | #include <asm/page.h> |
@@ -251,7 +252,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
251 | long tmp; | 252 | long tmp; |
252 | 253 | ||
253 | ret = -EIO; | 254 | ret = -EIO; |
254 | if ((unsigned long) data > _NSIG) | 255 | if (!valid_signal(data)) |
255 | break; | 256 | break; |
256 | if (request == PTRACE_SYSCALL) { | 257 | if (request == PTRACE_SYSCALL) { |
257 | child->thread.work.syscall_trace = ~0; | 258 | child->thread.work.syscall_trace = ~0; |
@@ -292,7 +293,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
292 | long tmp; | 293 | long tmp; |
293 | 294 | ||
294 | ret = -EIO; | 295 | ret = -EIO; |
295 | if ((unsigned long) data > _NSIG) | 296 | if (!valid_signal(data)) |
296 | break; | 297 | break; |
297 | child->thread.work.syscall_trace = 0; | 298 | child->thread.work.syscall_trace = 0; |
298 | tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16); | 299 | tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16); |
diff --git a/arch/m68knommu/kernel/ptrace.c b/arch/m68knommu/kernel/ptrace.c index 15cf79080b15..9724e1cd82e5 100644 --- a/arch/m68knommu/kernel/ptrace.c +++ b/arch/m68knommu/kernel/ptrace.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/ptrace.h> | 19 | #include <linux/ptrace.h> |
20 | #include <linux/user.h> | 20 | #include <linux/user.h> |
21 | #include <linux/config.h> | 21 | #include <linux/config.h> |
22 | #include <linux/signal.h> | ||
22 | 23 | ||
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | #include <asm/page.h> | 25 | #include <asm/page.h> |
@@ -240,7 +241,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
240 | long tmp; | 241 | long tmp; |
241 | 242 | ||
242 | ret = -EIO; | 243 | ret = -EIO; |
243 | if ((unsigned long) data > _NSIG) | 244 | if (!valid_signal(data)) |
244 | break; | 245 | break; |
245 | if (request == PTRACE_SYSCALL) | 246 | if (request == PTRACE_SYSCALL) |
246 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 247 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -278,7 +279,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
278 | long tmp; | 279 | long tmp; |
279 | 280 | ||
280 | ret = -EIO; | 281 | ret = -EIO; |
281 | if ((unsigned long) data > _NSIG) | 282 | if (!valid_signal(data)) |
282 | break; | 283 | break; |
283 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 284 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
284 | tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16); | 285 | tmp = get_reg(child, PT_SR) | (TRACE_BITS << 16); |
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c index 92f2c39afe27..a2f899c2f4d4 100644 --- a/arch/mips/kernel/ptrace.c +++ b/arch/mips/kernel/ptrace.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/smp_lock.h> | 26 | #include <linux/smp_lock.h> |
27 | #include <linux/user.h> | 27 | #include <linux/user.h> |
28 | #include <linux/security.h> | 28 | #include <linux/security.h> |
29 | #include <linux/signal.h> | ||
29 | 30 | ||
30 | #include <asm/cpu.h> | 31 | #include <asm/cpu.h> |
31 | #include <asm/fpu.h> | 32 | #include <asm/fpu.h> |
@@ -257,7 +258,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
257 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 258 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
258 | case PTRACE_CONT: { /* restart after signal. */ | 259 | case PTRACE_CONT: { /* restart after signal. */ |
259 | ret = -EIO; | 260 | ret = -EIO; |
260 | if ((unsigned long) data > _NSIG) | 261 | if (!valid_signal(data)) |
261 | break; | 262 | break; |
262 | if (request == PTRACE_SYSCALL) { | 263 | if (request == PTRACE_SYSCALL) { |
263 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 264 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c index 611dee919d50..eee207969c21 100644 --- a/arch/mips/kernel/ptrace32.c +++ b/arch/mips/kernel/ptrace32.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/smp_lock.h> | 24 | #include <linux/smp_lock.h> |
25 | #include <linux/user.h> | 25 | #include <linux/user.h> |
26 | #include <linux/security.h> | 26 | #include <linux/security.h> |
27 | #include <linux/signal.h> | ||
27 | 28 | ||
28 | #include <asm/cpu.h> | 29 | #include <asm/cpu.h> |
29 | #include <asm/fpu.h> | 30 | #include <asm/fpu.h> |
@@ -241,7 +242,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data) | |||
241 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 242 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
242 | case PTRACE_CONT: { /* restart after signal. */ | 243 | case PTRACE_CONT: { /* restart after signal. */ |
243 | ret = -EIO; | 244 | ret = -EIO; |
244 | if ((unsigned int) data > _NSIG) | 245 | if (!valid_signal(data)) |
245 | break; | 246 | break; |
246 | if (request == PTRACE_SYSCALL) { | 247 | if (request == PTRACE_SYSCALL) { |
247 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 248 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
diff --git a/arch/parisc/kernel/ptrace.c b/arch/parisc/kernel/ptrace.c index 2937a9236384..c07db9dff7cd 100644 --- a/arch/parisc/kernel/ptrace.c +++ b/arch/parisc/kernel/ptrace.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/personality.h> | 17 | #include <linux/personality.h> |
18 | #include <linux/security.h> | 18 | #include <linux/security.h> |
19 | #include <linux/compat.h> | 19 | #include <linux/compat.h> |
20 | #include <linux/signal.h> | ||
20 | 21 | ||
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
22 | #include <asm/pgtable.h> | 23 | #include <asm/pgtable.h> |
@@ -285,7 +286,7 @@ long sys_ptrace(long request, pid_t pid, long addr, long data) | |||
285 | ret = -EIO; | 286 | ret = -EIO; |
286 | DBG("sys_ptrace(%s)\n", | 287 | DBG("sys_ptrace(%s)\n", |
287 | request == PTRACE_SYSCALL ? "SYSCALL" : "CONT"); | 288 | request == PTRACE_SYSCALL ? "SYSCALL" : "CONT"); |
288 | if ((unsigned long) data > _NSIG) | 289 | if (!valid_signal(data)) |
289 | goto out_tsk; | 290 | goto out_tsk; |
290 | child->ptrace &= ~(PT_SINGLESTEP|PT_BLOCKSTEP); | 291 | child->ptrace &= ~(PT_SINGLESTEP|PT_BLOCKSTEP); |
291 | if (request == PTRACE_SYSCALL) { | 292 | if (request == PTRACE_SYSCALL) { |
@@ -311,7 +312,7 @@ long sys_ptrace(long request, pid_t pid, long addr, long data) | |||
311 | case PTRACE_SINGLEBLOCK: | 312 | case PTRACE_SINGLEBLOCK: |
312 | DBG("sys_ptrace(SINGLEBLOCK)\n"); | 313 | DBG("sys_ptrace(SINGLEBLOCK)\n"); |
313 | ret = -EIO; | 314 | ret = -EIO; |
314 | if ((unsigned long) data > _NSIG) | 315 | if (!valid_signal(data)) |
315 | goto out_tsk; | 316 | goto out_tsk; |
316 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 317 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
317 | child->ptrace &= ~PT_SINGLESTEP; | 318 | child->ptrace &= ~PT_SINGLESTEP; |
@@ -328,7 +329,7 @@ long sys_ptrace(long request, pid_t pid, long addr, long data) | |||
328 | case PTRACE_SINGLESTEP: | 329 | case PTRACE_SINGLESTEP: |
329 | DBG("sys_ptrace(SINGLESTEP)\n"); | 330 | DBG("sys_ptrace(SINGLESTEP)\n"); |
330 | ret = -EIO; | 331 | ret = -EIO; |
331 | if ((unsigned long) data > _NSIG) | 332 | if (!valid_signal(data)) |
332 | goto out_tsk; | 333 | goto out_tsk; |
333 | 334 | ||
334 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 335 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
diff --git a/arch/ppc/kernel/ptrace.c b/arch/ppc/kernel/ptrace.c index 426b6f7d9de3..59d59a8dc249 100644 --- a/arch/ppc/kernel/ptrace.c +++ b/arch/ppc/kernel/ptrace.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/ptrace.h> | 26 | #include <linux/ptrace.h> |
27 | #include <linux/user.h> | 27 | #include <linux/user.h> |
28 | #include <linux/security.h> | 28 | #include <linux/security.h> |
29 | #include <linux/signal.h> | ||
29 | 30 | ||
30 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
31 | #include <asm/page.h> | 32 | #include <asm/page.h> |
@@ -356,7 +357,7 @@ int sys_ptrace(long request, long pid, long addr, long data) | |||
356 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 357 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
357 | case PTRACE_CONT: { /* restart after signal. */ | 358 | case PTRACE_CONT: { /* restart after signal. */ |
358 | ret = -EIO; | 359 | ret = -EIO; |
359 | if ((unsigned long) data > _NSIG) | 360 | if (!valid_signal(data)) |
360 | break; | 361 | break; |
361 | if (request == PTRACE_SYSCALL) { | 362 | if (request == PTRACE_SYSCALL) { |
362 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 363 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -389,7 +390,7 @@ int sys_ptrace(long request, long pid, long addr, long data) | |||
389 | 390 | ||
390 | case PTRACE_SINGLESTEP: { /* set the trap flag. */ | 391 | case PTRACE_SINGLESTEP: { /* set the trap flag. */ |
391 | ret = -EIO; | 392 | ret = -EIO; |
392 | if ((unsigned long) data > _NSIG) | 393 | if (!valid_signal(data)) |
393 | break; | 394 | break; |
394 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 395 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
395 | set_single_step(child); | 396 | set_single_step(child); |
diff --git a/arch/ppc64/kernel/ptrace.c b/arch/ppc64/kernel/ptrace.c index 354a287c67eb..5a846324ca8c 100644 --- a/arch/ppc64/kernel/ptrace.c +++ b/arch/ppc64/kernel/ptrace.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/security.h> | 28 | #include <linux/security.h> |
29 | #include <linux/audit.h> | 29 | #include <linux/audit.h> |
30 | #include <linux/seccomp.h> | 30 | #include <linux/seccomp.h> |
31 | #include <linux/signal.h> | ||
31 | 32 | ||
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
33 | #include <asm/page.h> | 34 | #include <asm/page.h> |
@@ -162,7 +163,7 @@ int sys_ptrace(long request, long pid, long addr, long data) | |||
162 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 163 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
163 | case PTRACE_CONT: { /* restart after signal. */ | 164 | case PTRACE_CONT: { /* restart after signal. */ |
164 | ret = -EIO; | 165 | ret = -EIO; |
165 | if ((unsigned long) data > _NSIG) | 166 | if (!valid_signal(data)) |
166 | break; | 167 | break; |
167 | if (request == PTRACE_SYSCALL) | 168 | if (request == PTRACE_SYSCALL) |
168 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 169 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -194,7 +195,7 @@ int sys_ptrace(long request, long pid, long addr, long data) | |||
194 | 195 | ||
195 | case PTRACE_SINGLESTEP: { /* set the trap flag. */ | 196 | case PTRACE_SINGLESTEP: { /* set the trap flag. */ |
196 | ret = -EIO; | 197 | ret = -EIO; |
197 | if ((unsigned long) data > _NSIG) | 198 | if (!valid_signal(data)) |
198 | break; | 199 | break; |
199 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 200 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
200 | set_single_step(child); | 201 | set_single_step(child); |
diff --git a/arch/ppc64/kernel/ptrace32.c b/arch/ppc64/kernel/ptrace32.c index ee81b1b776cc..16436426c7e2 100644 --- a/arch/ppc64/kernel/ptrace32.c +++ b/arch/ppc64/kernel/ptrace32.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/ptrace.h> | 26 | #include <linux/ptrace.h> |
27 | #include <linux/user.h> | 27 | #include <linux/user.h> |
28 | #include <linux/security.h> | 28 | #include <linux/security.h> |
29 | #include <linux/signal.h> | ||
29 | 30 | ||
30 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
31 | #include <asm/page.h> | 32 | #include <asm/page.h> |
@@ -293,7 +294,7 @@ int sys32_ptrace(long request, long pid, unsigned long addr, unsigned long data) | |||
293 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 294 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
294 | case PTRACE_CONT: { /* restart after signal. */ | 295 | case PTRACE_CONT: { /* restart after signal. */ |
295 | ret = -EIO; | 296 | ret = -EIO; |
296 | if ((unsigned long) data > _NSIG) | 297 | if (!valid_signal(data)) |
297 | break; | 298 | break; |
298 | if (request == PTRACE_SYSCALL) | 299 | if (request == PTRACE_SYSCALL) |
299 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 300 | 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) | |||
325 | 326 | ||
326 | case PTRACE_SINGLESTEP: { /* set the trap flag. */ | 327 | case PTRACE_SINGLESTEP: { /* set the trap flag. */ |
327 | ret = -EIO; | 328 | ret = -EIO; |
328 | if ((unsigned long) data > _NSIG) | 329 | if (!valid_signal(data)) |
329 | break; | 330 | break; |
330 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 331 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
331 | set_single_step(child); | 332 | set_single_step(child); |
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 647233c02fc8..9f0d73e3f5f7 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/user.h> | 32 | #include <linux/user.h> |
33 | #include <linux/security.h> | 33 | #include <linux/security.h> |
34 | #include <linux/audit.h> | 34 | #include <linux/audit.h> |
35 | #include <linux/signal.h> | ||
35 | 36 | ||
36 | #include <asm/segment.h> | 37 | #include <asm/segment.h> |
37 | #include <asm/page.h> | 38 | #include <asm/page.h> |
@@ -609,7 +610,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data) | |||
609 | /* continue and stop at next (return from) syscall */ | 610 | /* continue and stop at next (return from) syscall */ |
610 | case PTRACE_CONT: | 611 | case PTRACE_CONT: |
611 | /* restart after signal. */ | 612 | /* restart after signal. */ |
612 | if ((unsigned long) data >= _NSIG) | 613 | if (!valid_signal(data)) |
613 | return -EIO; | 614 | return -EIO; |
614 | if (request == PTRACE_SYSCALL) | 615 | if (request == PTRACE_SYSCALL) |
615 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 616 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -637,7 +638,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data) | |||
637 | 638 | ||
638 | case PTRACE_SINGLESTEP: | 639 | case PTRACE_SINGLESTEP: |
639 | /* set the trap flag. */ | 640 | /* set the trap flag. */ |
640 | if ((unsigned long) data >= _NSIG) | 641 | if (!valid_signal(data)) |
641 | return -EIO; | 642 | return -EIO; |
642 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 643 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
643 | child->exit_code = data; | 644 | child->exit_code = data; |
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c index 1b0dfb4d8ea4..b28919b65682 100644 --- a/arch/sh/kernel/ptrace.c +++ b/arch/sh/kernel/ptrace.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/user.h> | 20 | #include <linux/user.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/security.h> | 22 | #include <linux/security.h> |
23 | #include <linux/signal.h> | ||
23 | 24 | ||
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
@@ -197,7 +198,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
197 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 198 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
198 | case PTRACE_CONT: { /* restart after signal. */ | 199 | case PTRACE_CONT: { /* restart after signal. */ |
199 | ret = -EIO; | 200 | ret = -EIO; |
200 | if ((unsigned long) data > _NSIG) | 201 | if (!valid_signal(data)) |
201 | break; | 202 | break; |
202 | if (request == PTRACE_SYSCALL) | 203 | if (request == PTRACE_SYSCALL) |
203 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 204 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -228,7 +229,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
228 | struct pt_regs *dummy = NULL; | 229 | struct pt_regs *dummy = NULL; |
229 | 230 | ||
230 | ret = -EIO; | 231 | ret = -EIO; |
231 | if ((unsigned long) data > _NSIG) | 232 | if (!valid_signal(data)) |
232 | break; | 233 | break; |
233 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 234 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
234 | if ((child->ptrace & PT_DTRACE) == 0) { | 235 | if ((child->ptrace & PT_DTRACE) == 0) { |
diff --git a/arch/sh64/kernel/ptrace.c b/arch/sh64/kernel/ptrace.c index 800288c1562b..fd2000956dae 100644 --- a/arch/sh64/kernel/ptrace.c +++ b/arch/sh64/kernel/ptrace.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/errno.h> | 27 | #include <linux/errno.h> |
28 | #include <linux/ptrace.h> | 28 | #include <linux/ptrace.h> |
29 | #include <linux/user.h> | 29 | #include <linux/user.h> |
30 | #include <linux/signal.h> | ||
30 | 31 | ||
31 | #include <asm/io.h> | 32 | #include <asm/io.h> |
32 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
@@ -255,7 +256,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
255 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 256 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
256 | case PTRACE_CONT: { /* restart after signal. */ | 257 | case PTRACE_CONT: { /* restart after signal. */ |
257 | ret = -EIO; | 258 | ret = -EIO; |
258 | if ((unsigned long) data > _NSIG) | 259 | if (!valid_signal(data)) |
259 | break; | 260 | break; |
260 | if (request == PTRACE_SYSCALL) | 261 | if (request == PTRACE_SYSCALL) |
261 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 262 | set_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
@@ -285,7 +286,7 @@ asmlinkage int sys_ptrace(long request, long pid, long addr, long data) | |||
285 | struct pt_regs *regs; | 286 | struct pt_regs *regs; |
286 | 287 | ||
287 | ret = -EIO; | 288 | ret = -EIO; |
288 | if ((unsigned long) data > _NSIG) | 289 | if (!valid_signal(data)) |
289 | break; | 290 | break; |
290 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 291 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
291 | if ((child->ptrace & PT_DTRACE) == 0) { | 292 | if ((child->ptrace & PT_DTRACE) == 0) { |
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c index c4f93bd2daf2..475c4c13462c 100644 --- a/arch/sparc/kernel/ptrace.c +++ b/arch/sparc/kernel/ptrace.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
19 | #include <linux/smp_lock.h> | 19 | #include <linux/smp_lock.h> |
20 | #include <linux/security.h> | 20 | #include <linux/security.h> |
21 | #include <linux/signal.h> | ||
21 | 22 | ||
22 | #include <asm/pgtable.h> | 23 | #include <asm/pgtable.h> |
23 | #include <asm/system.h> | 24 | #include <asm/system.h> |
@@ -526,7 +527,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) | |||
526 | addr = 1; | 527 | addr = 1; |
527 | 528 | ||
528 | case PTRACE_CONT: { /* restart after signal. */ | 529 | case PTRACE_CONT: { /* restart after signal. */ |
529 | if (data > _NSIG) { | 530 | if (!valid_signal(data)) { |
530 | pt_error_return(regs, EIO); | 531 | pt_error_return(regs, EIO); |
531 | goto out_tsk; | 532 | goto out_tsk; |
532 | } | 533 | } |
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c index 5f080cf04b33..80a76e2ad732 100644 --- a/arch/sparc64/kernel/ptrace.c +++ b/arch/sparc64/kernel/ptrace.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
20 | #include <linux/smp_lock.h> | 20 | #include <linux/smp_lock.h> |
21 | #include <linux/security.h> | 21 | #include <linux/security.h> |
22 | #include <linux/signal.h> | ||
22 | 23 | ||
23 | #include <asm/asi.h> | 24 | #include <asm/asi.h> |
24 | #include <asm/pgtable.h> | 25 | #include <asm/pgtable.h> |
@@ -559,7 +560,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs) | |||
559 | addr = 1; | 560 | addr = 1; |
560 | 561 | ||
561 | case PTRACE_CONT: { /* restart after signal. */ | 562 | case PTRACE_CONT: { /* restart after signal. */ |
562 | if (data > _NSIG) { | 563 | if (!valid_signal(data)) { |
563 | pt_error_return(regs, EIO); | 564 | pt_error_return(regs, EIO); |
564 | goto out_tsk; | 565 | goto out_tsk; |
565 | } | 566 | } |
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c index 3a99ee6d94eb..e50e60ff5d27 100644 --- a/arch/um/kernel/ptrace.c +++ b/arch/um/kernel/ptrace.c | |||
@@ -143,7 +143,7 @@ long sys_ptrace(long request, long pid, long addr, long data) | |||
143 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ | 143 | case PTRACE_SYSCALL: /* continue and stop at next (return from) syscall */ |
144 | case PTRACE_CONT: { /* restart after signal. */ | 144 | case PTRACE_CONT: { /* restart after signal. */ |
145 | ret = -EIO; | 145 | ret = -EIO; |
146 | if ((unsigned long) data > _NSIG) | 146 | if (!valid_signal(data)) |
147 | break; | 147 | break; |
148 | 148 | ||
149 | child->ptrace &= ~PT_DTRACE; | 149 | child->ptrace &= ~PT_DTRACE; |
@@ -179,7 +179,7 @@ long sys_ptrace(long request, long pid, long addr, long data) | |||
179 | 179 | ||
180 | case PTRACE_SINGLESTEP: { /* set the trap flag. */ | 180 | case PTRACE_SINGLESTEP: { /* set the trap flag. */ |
181 | ret = -EIO; | 181 | ret = -EIO; |
182 | if ((unsigned long) data > _NSIG) | 182 | if (!valid_signal(data)) |
183 | break; | 183 | break; |
184 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); | 184 | clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); |
185 | child->ptrace |= PT_DTRACE; | 185 | child->ptrace |= PT_DTRACE; |
diff --git a/arch/v850/kernel/ptrace.c b/arch/v850/kernel/ptrace.c index 8fa780757dcd..4726b87f5e5a 100644 --- a/arch/v850/kernel/ptrace.c +++ b/arch/v850/kernel/ptrace.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/sched.h> | 23 | #include <linux/sched.h> |
24 | #include <linux/smp_lock.h> | 24 | #include <linux/smp_lock.h> |
25 | #include <linux/ptrace.h> | 25 | #include <linux/ptrace.h> |
26 | #include <linux/signal.h> | ||
26 | 27 | ||
27 | #include <asm/errno.h> | 28 | #include <asm/errno.h> |
28 | #include <asm/ptrace.h> | 29 | #include <asm/ptrace.h> |
@@ -208,7 +209,7 @@ int sys_ptrace(long request, long pid, long addr, long data) | |||
208 | /* Execute a single instruction. */ | 209 | /* Execute a single instruction. */ |
209 | case PTRACE_SINGLESTEP: | 210 | case PTRACE_SINGLESTEP: |
210 | rval = -EIO; | 211 | rval = -EIO; |
211 | if ((unsigned long) data > _NSIG) | 212 | if (!valid_signal(data)) |
212 | break; | 213 | break; |
213 | 214 | ||
214 | /* Turn CHILD's single-step flag on or off. */ | 215 | /* Turn CHILD's single-step flag on or off. */ |
diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c index c7011675007d..c64b9c97c745 100644 --- a/arch/x86_64/kernel/ptrace.c +++ b/arch/x86_64/kernel/ptrace.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/security.h> | 18 | #include <linux/security.h> |
19 | #include <linux/audit.h> | 19 | #include <linux/audit.h> |
20 | #include <linux/seccomp.h> | 20 | #include <linux/seccomp.h> |
21 | #include <linux/signal.h> | ||
21 | 22 | ||
22 | #include <asm/uaccess.h> | 23 | #include <asm/uaccess.h> |
23 | #include <asm/pgtable.h> | 24 | #include <asm/pgtable.h> |
@@ -467,7 +468,7 @@ asmlinkage long sys_ptrace(long request, long pid, unsigned long addr, long data | |||
467 | case PTRACE_CONT: /* restart after signal. */ | 468 | case PTRACE_CONT: /* restart after signal. */ |
468 | 469 | ||
469 | ret = -EIO; | 470 | ret = -EIO; |
470 | if ((unsigned long) data > _NSIG) | 471 | if (!valid_signal(data)) |
471 | break; | 472 | break; |
472 | if (request == PTRACE_SYSCALL) | 473 | if (request == PTRACE_SYSCALL) |
473 | set_tsk_thread_flag(child,TIF_SYSCALL_TRACE); | 474 | 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 | |||
529 | 530 | ||
530 | case PTRACE_SINGLESTEP: /* set the trap flag. */ | 531 | case PTRACE_SINGLESTEP: /* set the trap flag. */ |
531 | ret = -EIO; | 532 | ret = -EIO; |
532 | if ((unsigned long) data > _NSIG) | 533 | if (!valid_signal(data)) |
533 | break; | 534 | break; |
534 | clear_tsk_thread_flag(child,TIF_SYSCALL_TRACE); | 535 | clear_tsk_thread_flag(child,TIF_SYSCALL_TRACE); |
535 | set_singlestep(child); | 536 | set_singlestep(child); |