+ proc-connector-add-event-for-process-becoming-session-leader.patch added to -mm tree
Quoted 2 lines
The act of a process becoming a session leader is a useful signal to a supervising init daemon such as Upstart.
...
Review void __set_special_pids(struct pid *pid) · line 366
Quoted 9 lines
(quoted diff) +3
-1@@ -360,8 +360,10 @@ void __set_special_pids(struct pid *pid) { struct task_struct *curr = current->group_leader; - if (task_session(curr) != pid) + if (task_session(curr) != pid) { change_pid(curr, PIDTYPE_SID, pid); + proc_sid_connector(curr); + }
Wouldn't it better to change sys_setsid() then? This looks more clear imho, and we can move proc_sid_connector() outside of tasklist_lock.
Note also that __set_special_pids() does not neccessary mean we are becoming a session leader, see daemonize().
Oleg.
Quoted 16 lines · Oleg Nesterov
Quoted 2 lines
The act of a process becoming a session leader is a useful signal to a supervising init daemon such as Upstart.
...
Review void __set_special_pids(struct pid *pid) · line 366
Quoted 9 lines
(quoted diff) +3
-1@@ -360,8 +360,10 @@ void __set_special_pids(struct pid *pid) { struct task_struct *curr = current->group_leader; - if (task_session(curr) != pid) + if (task_session(curr) != pid) { change_pid(curr, PIDTYPE_SID, pid); + proc_sid_connector(curr); + }Wouldn't it better to change
sys_setsid()then? This looks more clear imho, and we can moveproc_sid_connector()outside oftasklist_lock.
Quoted 3 lines
Note also that
__set_special_pids()does not neccessary mean we are becoming a session leader, seedaemonize().
Actually, I specifically wanted to receive this event if the process called daemonize() which is why this is done here rather than in sys_setsid()
The new session is important information to init in figuring out what the process is up to (ie, fork(), setsid(), fork() = daemonise)
Scott
Signature · 2 lines
Scott James Remnant [email protected]
Quoted 19 lines · Scott James Remnant
Quoted 16 lines · Oleg Nesterov
Quoted 2 lines
The act of a process becoming a session leader is a useful signal to a supervising init daemon such as Upstart.
...
Review void __set_special_pids(struct pid *pid) · line 366
Quoted 9 lines
(quoted diff) +3
-1@@ -360,8 +360,10 @@ void __set_special_pids(struct pid *pid) { struct task_struct *curr = current->group_leader; - if (task_session(curr) != pid) + if (task_session(curr) != pid) { change_pid(curr, PIDTYPE_SID, pid); + proc_sid_connector(curr); + }Wouldn't it better to change
sys_setsid()then? This looks more clear imho, and we can moveproc_sid_connector()outside oftasklist_lock.
Quoted 6 lines
Quoted 3 lines
Note also that
__set_special_pids()does not neccessary mean we are becoming a session leader, seedaemonize().Actually, I specifically wanted to receive this event if the process called
daemonize()which is why this is done here rather than insys_setsid()
Aha. I was confused by "becoming a session leader" in the changelog.
Quoted 2 lines
The new session is important information to init in figuring out what the process is up to (ie,
fork(),setsid(),fork()= daemonise)
daemonize() is only needed when a user-space thread does kernel_thread(), hopefully it will die eventually, this is already deprecated. Then we can move proc_sid_connector() to sys_setsid(), I think.
Thanks!
Oleg.