Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2077

kernel-2.6.18-238.el5.src.rpm

From: Jerome Marchand <jmarchan@redhat.com>
Date: Wed, 14 Jan 2009 20:21:06 +0100
Subject: [misc] ptrace, utrace: fix blocked signal injection
Message-id: 496E3B22.7070707@redhat.com
O-Subject: [RHEL5.4 PATCH] ptrace, utrace: fix blocked signal injection
Bugzilla: 451849

Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=451849

Description:
A ptraced process receive the signal sent by ptrace(PTRACE_CONT, .. ,
signal) even if blocked.

Solution:
When the signal to deliver is blocked, use a traditional signal in
ptrace_induce_signal() instead of forcefully inject it with
utrace_inject_signal(). The process will received the signal in due
time.

Upstream status:
Upstream is not affected

Brew build:
https://brewweb.devel.redhat.com/taskinfo?taskID=1642852

Test status:
Tested successfully.

Jerome

diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 3001d81..53aa435 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -650,10 +650,11 @@ ptrace_induce_signal(struct task_struct *target,
 	if (!valid_signal(signr))
 		return -EIO;
 
-	if (state->syscall) {
+	if (state->syscall || sigismember(&target->blocked, signr)) {
 		/*
 		 * This is the traditional ptrace behavior when given
 		 * a signal to resume from a syscall tracing stop.
+		 * In addition, don't inject a blocked signal.
 		 */
 		send_sig(signr, target, 1);
 	}