aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/ptrace.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 273f56ea39d2..9acd07a6f5bb 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -262,7 +262,7 @@ static int ptrace_attach(struct task_struct *task, long request,
262 262
263 /* 263 /*
264 * Protect exec's credential calculations against our interference; 264 * Protect exec's credential calculations against our interference;
265 * interference; SUID, SGID and LSM creds get determined differently 265 * SUID, SGID and LSM creds get determined differently
266 * under ptrace. 266 * under ptrace.
267 */ 267 */
268 retval = -ERESTARTNOINTR; 268 retval = -ERESTARTNOINTR;
@@ -528,31 +528,16 @@ int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long ds
528 528
529static int ptrace_setoptions(struct task_struct *child, unsigned long data) 529static int ptrace_setoptions(struct task_struct *child, unsigned long data)
530{ 530{
531 unsigned flags;
532
531 if (data & ~(unsigned long)PTRACE_O_MASK) 533 if (data & ~(unsigned long)PTRACE_O_MASK)
532 return -EINVAL; 534 return -EINVAL;
533 535
534 child->ptrace &= ~PT_TRACE_MASK; 536 /* Avoid intermediate state when all opts are cleared */
535 537 flags = child->ptrace;
536 if (data & PTRACE_O_TRACESYSGOOD) 538 flags &= ~(PTRACE_O_MASK << PT_OPT_FLAG_SHIFT);
537 child->ptrace |= PT_TRACESYSGOOD; 539 flags |= (data << PT_OPT_FLAG_SHIFT);
538 540 child->ptrace = flags;
539 if (data & PTRACE_O_TRACEFORK)
540 child->ptrace |= PT_TRACE_FORK;
541
542 if (data & PTRACE_O_TRACEVFORK)
543 child->ptrace |= PT_TRACE_VFORK;
544
545 if (data & PTRACE_O_TRACECLONE)
546 child->ptrace |= PT_TRACE_CLONE;
547
548 if (data & PTRACE_O_TRACEEXEC)
549 child->ptrace |= PT_TRACE_EXEC;
550
551 if (data & PTRACE_O_TRACEVFORKDONE)
552 child->ptrace |= PT_TRACE_VFORK_DONE;
553
554 if (data & PTRACE_O_TRACEEXIT)
555 child->ptrace |= PT_TRACE_EXIT;
556 541
557 return 0; 542 return 0;
558} 543}