lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1304869745-1073-8-git-send-email-tj@kernel.org>
Date:	Sun,  8 May 2011 17:49:01 +0200
From:	Tejun Heo <tj@...nel.org>
To:	oleg@...hat.com, jan.kratochvil@...hat.com,
	vda.linux@...glemail.com
Cc:	linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
	akpm@...ux-foundation.org, indan@....nu, Tejun Heo <tj@...nel.org>
Subject: [PATCH 07/11] ptrace: add JOBCTL_TRAPPED

For to-be-added end of group stop notification, ptracer needs to tell
whether tracee is in group stop or INTERRUPT trap.  Add JOBCTL_TRAPPED
flag which is set when tracee commits to group stop or INTERRUPT trap
in ptrace_stop() and cleared when leaving ptrace_stop().

The flag isn't yet used and doesn't cause any behavior difference.

Signed-off-by: Tejun Heo <tj@...nel.org>
---
 include/linux/sched.h |    1 +
 kernel/signal.c       |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 221ab51..9d92444 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1787,6 +1787,7 @@ extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *
 #define JOBCTL_TRAP_SEIZE	(1 << 19) /* trap for seize */
 #define JOBCTL_TRAP_INTERRUPT	(1 << 20) /* trap for interrupt */
 #define JOBCTL_TRAPPING		(1 << 22) /* switching to TRACED */
+#define JOBCTL_TRAPPED		(1 << 23) /* trapped for group stop */
 
 #define JOBCTL_TRAP_MASK	(JOBCTL_TRAP_SEIZE | JOBCTL_TRAP_INTERRUPT)
 #define JOBCTL_PENDING_MASK	(JOBCTL_STOP_PENDING | JOBCTL_TRAP_MASK)
diff --git a/kernel/signal.c b/kernel/signal.c
index 9705f5d..208f061 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1764,6 +1764,14 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
 	if (is_intr)
 		current->jobctl &= ~JOBCTL_TRAP_INTERRUPT;
 
+	/*
+	 * Traps for both actual group stop and INTERRUPT are considered
+	 * trapped for job control and have TRAPPED set.  This enables
+	 * end-of-group-stop retrapping of INTERRUPTed tracees.
+	 */
+	if (why == CLD_STOPPED || is_intr)
+		current->jobctl |= JOBCTL_TRAPPED;
+
 	spin_unlock_irq(&current->sighand->siglock);
 	read_lock(&tasklist_lock);
 	if (may_ptrace_stop()) {
@@ -1824,6 +1832,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
 	 * any signal-sending on another CPU that wants to examine it.
 	 */
 	spin_lock_irq(&current->sighand->siglock);
+	current->jobctl &= ~JOBCTL_TRAPPED;
 	current->last_siginfo = NULL;
 
 	/*
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ