Merge lp:~vorlon/upstart/lp.855010 into lp:upstart

Proposed by Steve Langasek on 2012-02-28
Status: Needs review
Proposed branch: lp:~vorlon/upstart/lp.855010
Merge into: lp:upstart
Diff against target: 71 lines (+12/-20)
3 files modified
ChangeLog (+6/-0)
init/job_process.c (+4/-18)
init/tests/test_job_process.c (+2/-2)
To merge this branch: bzr merge lp:~vorlon/upstart/lp.855010
Reviewer Review Type Date Requested Status
James Hunt 2012-02-28 Pending
Review via email: mp+95078@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

1358. By Steve Langasek on 2012-02-28

don't treat exec as a sign to stop tracing; in some unusual cases (i.e.,
cups), a process may actually re-exec itself before forking.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-02-13 12:08:33 +0000
3+++ ChangeLog 2012-02-28 23:37:19 +0000
4@@ -1,3 +1,9 @@
5+2012-02-28 Steve Langasek <steve.langasek@ubuntu.com>
6+
7+ * init/job_process.c: don't treat exec as a sign to stop tracing; in
8+ some unusual cases (i.e., cups), a process may actually re-exec
9+ itself before forking.
10+
11 2012-02-13 James Hunt <james.hunt@ubuntu.com>
12
13 * init/log.c:
14
15=== modified file 'init/job_process.c'
16--- init/job_process.c 2012-02-03 13:17:24 +0000
17+++ init/job_process.c 2012-02-28 23:37:19 +0000
18@@ -1934,9 +1934,6 @@
19 * This function is called whenever a traced @process attached to @job calls
20 * the exec() system call after we've set options on it to distinguish them
21 * from ordinary SIGTRAPs.
22- *
23- * We assume that if the job calls exec that it's finished forking so we can
24- * drop the trace entirely; we have no interest in tracing the new child.
25 **/
26 static void
27 job_process_trace_exec (Job *job,
28@@ -1954,21 +1951,10 @@
29 nih_info (_("%s %s process (%d) executable changed"),
30 job_name (job), process_name (process), job->pid[process]);
31
32- if (job->trace_forks) {
33- if (ptrace (PTRACE_DETACH, job->pid[process], NULL, 0) < 0)
34- nih_warn (_("Failed to detach traced "
35- "%s %s process (%d): %s"),
36- job_name (job), process_name (process),
37- job->pid[process], strerror (errno));
38-
39- job->trace_state = TRACE_NONE;
40- job_change_state (job, job_next_state (job));
41- } else {
42- if (ptrace (PTRACE_CONT, job->pid[process], NULL, 0) < 0)
43- nih_warn (_("Failed to continue traced %s %s process (%d): %s"),
44- job_name (job), process_name (process),
45- job->pid[process], strerror (errno));
46- }
47+ if (ptrace (PTRACE_CONT, job->pid[process], NULL, 0) < 0)
48+ nih_warn (_("Failed to continue traced %s %s process (%d): %s"),
49+ job_name (job), process_name (process),
50+ job->pid[process], strerror (errno));
51 }
52
53
54
55=== modified file 'init/tests/test_job_process.c'
56--- init/tests/test_job_process.c 2012-02-13 12:08:33 +0000
57+++ init/tests/test_job_process.c 2012-02-28 23:37:19 +0000
58@@ -8145,11 +8145,11 @@
59 rewind (output);
60
61 TEST_EQ (job->goal, JOB_START);
62- TEST_EQ (job->state, JOB_RUNNING);
63+ TEST_EQ (job->state, JOB_SPAWNED);
64 TEST_EQ (job->pid[PROCESS_MAIN], pid);
65
66 TEST_EQ (job->trace_forks, 1);
67- TEST_EQ (job->trace_state, TRACE_NONE);
68+ TEST_EQ (job->trace_state, TRACE_NORMAL);
69
70 waitpid (job->pid[PROCESS_MAIN], &status, 0);
71 TEST_TRUE (WIFEXITED (status));

Subscribers

People subscribed via source and target branches