kernel/fork.c:2388 copy_process() warn: passing zero to 'ERR_PTR'
PATCH 5/7 kernel/fork.c:2388 copy_process() warn: passing zero to 'ERR_PTR'
tree: https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git pidfd_capabilities head: 39f8e5a5a89ad52ff07fd5af7e514def2b527ed5 commit: f661df61f0498a3bffb2ff4549d5515e94a05735 [5/7] pidfd: introduce and port to pidfd_struct
If you fix the issue, kindly add following tag
smatch warnings:kernel/fork.c:2388 copy_process() warn: passing zero to 'ERR_PTR' kernel/fork.c:2388 copy_process() warn: inconsistent returns 'irq'.
# https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git/commit/?id=f661df61f0498a3bffb2ff4549d5515e94a05735
git remote add brauner https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
git remote update brauner
git checkout f661df61f0498a3bffb2ff4549d5515e94a05735
vim +/ERR_PTR +2388 kernel/fork.c
3c90e6e99b08f0 Srivatsa Vaddagiri 2007-11-09 2069 /* Perform scheduler related setup. Assign this task to a CPU. */
aab03e05e8f7e2 Dario Faggioli 2013-11-28 2070 retval = sched_fork(clone_flags, p);
aab03e05e8f7e2 Dario Faggioli 2013-11-28 2071 if (retval)
aab03e05e8f7e2 Dario Faggioli 2013-11-28 2072 goto bad_fork_cleanup_policy;
6ab423e0eaca82 Peter Zijlstra 2009-05-25 2073
cdd6c482c9ff9c Ingo Molnar 2009-09-21 2074 retval = perf_event_init_task(p);
6ab423e0eaca82 Peter Zijlstra 2009-05-25 2075 if (retval)
6ab423e0eaca82 Peter Zijlstra 2009-05-25 2076 goto bad_fork_cleanup_policy;
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2077 retval = audit_alloc(p);
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2078 if (retval)
6c72e3501d0d62 Peter Zijlstra 2014-10-02 2079 goto bad_fork_cleanup_perf;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2080 /* copy all the process information */
ab602f79915939 Jack Miller 2014-08-08 2081 shm_init_task(p);
e4e55b47ed9ae2 Tetsuo Handa 2017-03-24 2082 retval = security_task_alloc(p, clone_flags);
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2083 if (retval)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2084 goto bad_fork_cleanup_audit;
e4e55b47ed9ae2 Tetsuo Handa 2017-03-24 2085 retval = copy_semundo(clone_flags, p);
e4e55b47ed9ae2 Tetsuo Handa 2017-03-24 2086 if (retval)
e4e55b47ed9ae2 Tetsuo Handa 2017-03-24 2087 goto bad_fork_cleanup_security;
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2088 retval = copy_files(clone_flags, p);
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2089 if (retval)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2090 goto bad_fork_cleanup_semundo;
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2091 retval = copy_fs(clone_flags, p);
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2092 if (retval)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2093 goto bad_fork_cleanup_files;
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2094 retval = copy_sighand(clone_flags, p);
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2095 if (retval)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2096 goto bad_fork_cleanup_fs;
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2097 retval = copy_signal(clone_flags, p);
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2098 if (retval)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2099 goto bad_fork_cleanup_sighand;
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2100 retval = copy_mm(clone_flags, p);
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2101 if (retval)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2102 goto bad_fork_cleanup_signal;
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2103 retval = copy_namespaces(clone_flags, p);
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2104 if (retval)
d84f4f992cbd76 David Howells 2008-11-14 2105 goto bad_fork_cleanup_mm;
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2106 retval = copy_io(clone_flags, p);
fb0a685cb95a02 Daniel Rebelo de Oliveira 2011-07-26 2107 if (retval)
fd0928df98b957 Jens Axboe 2008-01-24 2108 goto bad_fork_cleanup_namespaces;
7f192e3cd316ba Christian Brauner 2019-05-25 2109 retval = copy_thread_tls(clone_flags, args->stack, args->stack_size, p,
7f192e3cd316ba Christian Brauner 2019-05-25 2110 args->tls);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2111 if (retval)
fd0928df98b957 Jens Axboe 2008-01-24 2112 goto bad_fork_cleanup_io;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2113
afaef01c001537 Alexander Popov 2018-08-17 2114 stackleak_task_init(p);
afaef01c001537 Alexander Popov 2018-08-17 2115
425fb2b4bf5dde Pavel Emelyanov 2007-10-18 2116 if (pid != &init_struct_pid) {
49cb2fc42ce4b7 Adrian Reber 2019-11-15 2117 pid = alloc_pid(p->nsproxy->pid_ns_for_children, args->set_tid,
49cb2fc42ce4b7 Adrian Reber 2019-11-15 2118 args->set_tid_size);
35f71bc0a09a45 Michal Hocko 2015-04-16 2119 if (IS_ERR(pid)) {
35f71bc0a09a45 Michal Hocko 2015-04-16 2120 retval = PTR_ERR(pid);
0740aa5f637568 Jiri Slaby 2016-05-20 2121 goto bad_fork_cleanup_thread;
425fb2b4bf5dde Pavel Emelyanov 2007-10-18 2122 }
35f71bc0a09a45 Michal Hocko 2015-04-16 2123 }
425fb2b4bf5dde Pavel Emelyanov 2007-10-18 2124
b3e5838252665e Christian Brauner 2019-03-27 2125 /*
b3e5838252665e Christian Brauner 2019-03-27 2126 * This has to happen after we've potentially unshared the file
b3e5838252665e Christian Brauner 2019-03-27 2127 * descriptor table (so that the pidfd doesn't leak into the child
b3e5838252665e Christian Brauner 2019-03-27 2128 * if the fd table isn't shared).
b3e5838252665e Christian Brauner 2019-03-27 2129 */
b3e5838252665e Christian Brauner 2019-03-27 2130 if (clone_flags & CLONE_PIDFD) {
f661df61f0498a Christian Brauner 2020-01-13 2131 struct pidfd_struct *pidfd_struct;
f661df61f0498a Christian Brauner 2020-01-13 2132
f661df61f0498a Christian Brauner 2020-01-13 2133 pidfd_struct = pidfd_alloc(pid);
f661df61f0498a Christian Brauner 2020-01-13 2134 if (IS_ERR(pidfd_struct))
f661df61f0498a Christian Brauner 2020-01-13 2135 goto bad_fork_free_pid;
^^^^^^^^^^^^^^^^^^^^^^retval not set.
f661df61f0498a Christian Brauner 2020-01-13 2136
6fd2fe494b17bf Al Viro 2019-06-26 2137 retval = get_unused_fd_flags(O_RDWR | O_CLOEXEC);
f661df61f0498a Christian Brauner 2020-01-13 2138 if (retval < 0) {
f661df61f0498a Christian Brauner 2020-01-13 2139 pidfd_put(pidfd_struct);
b3e5838252665e Christian Brauner 2019-03-27 2140 goto bad_fork_free_pid;
f661df61f0498a Christian Brauner 2020-01-13 2141 }
b3e5838252665e Christian Brauner 2019-03-27 2142
b3e5838252665e Christian Brauner 2019-03-27 2143 pidfd = retval;
6fd2fe494b17bf Al Viro 2019-06-26 2144
f661df61f0498a Christian Brauner 2020-01-13 2145 pidfile = anon_inode_getfile("[pidfd]", &pidfd_fops,
f661df61f0498a Christian Brauner 2020-01-13 2146 pidfd_struct, O_RDWR | O_CLOEXEC);
6fd2fe494b17bf Al Viro 2019-06-26 2147 if (IS_ERR(pidfile)) {
6fd2fe494b17bf Al Viro 2019-06-26 2148 put_unused_fd(pidfd);
f661df61f0498a Christian Brauner 2020-01-13 2149 pidfd_put(pidfd_struct);
28dd29c06d0ded Christian Brauner 2019-07-01 2150 retval = PTR_ERR(pidfile);
6fd2fe494b17bf Al Viro 2019-06-26 2151 goto bad_fork_free_pid;
6fd2fe494b17bf Al Viro 2019-06-26 2152 }
6fd2fe494b17bf Al Viro 2019-06-26 2153
7f192e3cd316ba Christian Brauner 2019-05-25 2154 retval = put_user(pidfd, args->pidfd);
b3e5838252665e Christian Brauner 2019-03-27 2155 if (retval)
b3e5838252665e Christian Brauner 2019-03-27 2156 goto bad_fork_put_pidfd;
b3e5838252665e Christian Brauner 2019-03-27 2157 }
b3e5838252665e Christian Brauner 2019-03-27 2158
73c101011926c5 Jens Axboe 2011-03-08 2159 #ifdef CONFIG_BLOCK
73c101011926c5 Jens Axboe 2011-03-08 2160 p->plug = NULL;
73c101011926c5 Jens Axboe 2011-03-08 2161 #endif
ba31c1a4853899 Thomas Gleixner 2019-11-06 2162 futex_init_task(p);
ba31c1a4853899 Thomas Gleixner 2019-11-06 2163
f9a3879abf2f1a GOTO Masanori 2006-03-13 2164 /*
f9a3879abf2f1a GOTO Masanori 2006-03-13 2165 * sigaltstack should be cleared when sharing the same VM
f9a3879abf2f1a GOTO Masanori 2006-03-13 2166 */
f9a3879abf2f1a GOTO Masanori 2006-03-13 2167 if ((clone_flags & (CLONE_VM|CLONE_VFORK)) == CLONE_VM)
2a74213838104a Stas Sergeev 2016-04-14 2168 sas_ss_reset(p);
f9a3879abf2f1a GOTO Masanori 2006-03-13 2169
^1da177e4c3f41 Linus Torvalds 2005-04-16 2170 /*
6580807da14c42 Oleg Nesterov 2009-12-15 2171 * Syscall tracing and stepping should be turned off in the
6580807da14c42 Oleg Nesterov 2009-12-15 2172 * child regardless of CLONE_PTRACE.
^1da177e4c3f41 Linus Torvalds 2005-04-16 2173 */
6580807da14c42 Oleg Nesterov 2009-12-15 2174 user_disable_single_step(p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2175 clear_tsk_thread_flag(p, TIF_SYSCALL_TRACE);
ed75e8d58010fd Laurent Vivier 2005-09-03 2176 #ifdef TIF_SYSCALL_EMU
ed75e8d58010fd Laurent Vivier 2005-09-03 2177 clear_tsk_thread_flag(p, TIF_SYSCALL_EMU);
ed75e8d58010fd Laurent Vivier 2005-09-03 2178 #endif
e02c9b0d65a749 Lin Feng 2019-05-14 2179 clear_tsk_latency_tracing(p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2180
^1da177e4c3f41 Linus Torvalds 2005-04-16 2181 /* ok, now we should be set up.. */
18c830df771f2b Oleg Nesterov 2013-07-03 2182 p->pid = pid_nr(pid);
18c830df771f2b Oleg Nesterov 2013-07-03 2183 if (clone_flags & CLONE_THREAD) {
5f8aadd8b9966d Oleg Nesterov 2012-03-14 2184 p->exit_signal = -1;
18c830df771f2b Oleg Nesterov 2013-07-03 2185 p->group_leader = current->group_leader;
18c830df771f2b Oleg Nesterov 2013-07-03 2186 p->tgid = current->tgid;
18c830df771f2b Oleg Nesterov 2013-07-03 2187 } else {
18c830df771f2b Oleg Nesterov 2013-07-03 2188 if (clone_flags & CLONE_PARENT)
5f8aadd8b9966d Oleg Nesterov 2012-03-14 2189 p->exit_signal = current->group_leader->exit_signal;
5f8aadd8b9966d Oleg Nesterov 2012-03-14 2190 else
7f192e3cd316ba Christian Brauner 2019-05-25 2191 p->exit_signal = args->exit_signal;
18c830df771f2b Oleg Nesterov 2013-07-03 2192 p->group_leader = p;
18c830df771f2b Oleg Nesterov 2013-07-03 2193 p->tgid = p->pid;
18c830df771f2b Oleg Nesterov 2013-07-03 2194 }
5f8aadd8b9966d Oleg Nesterov 2012-03-14 2195
9d823e8f6b1b7b Wu Fengguang 2011-06-11 2196 p->nr_dirtied = 0;
9d823e8f6b1b7b Wu Fengguang 2011-06-11 2197 p->nr_dirtied_pause = 128 >> (PAGE_SHIFT - 10);
83712358ba0a14 Wu Fengguang 2011-06-11 2198 p->dirty_paused_when = 0;
9d823e8f6b1b7b Wu Fengguang 2011-06-11 2199
bb8cbbfee68518 Oleg Nesterov 2013-11-13 2200 p->pdeath_signal = 0;
47e65328a7b1cd Oleg Nesterov 2006-03-28 2201 INIT_LIST_HEAD(&p->thread_group);
158e1645e07f3e Al Viro 2012-06-27 2202 p->task_works = NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2203
780de9dd2720de Ingo Molnar 2017-02-02 2204 cgroup_threadgroup_change_begin(current);
7e47682ea555e7 Aleksa Sarai 2015-06-09 2205 /*
7e47682ea555e7 Aleksa Sarai 2015-06-09 2206 * Ensure that the cgroup subsystem policies allow the new process to be
7e47682ea555e7 Aleksa Sarai 2015-06-09 2207 * forked. It should be noted the the new process's css_set can be changed
7e47682ea555e7 Aleksa Sarai 2015-06-09 2208 * between here and cgroup_post_fork() if an organisation operation is in
7e47682ea555e7 Aleksa Sarai 2015-06-09 2209 * progress.
7e47682ea555e7 Aleksa Sarai 2015-06-09 2210 */
b53202e6308939 Oleg Nesterov 2015-12-03 2211 retval = cgroup_can_fork(p);
7e47682ea555e7 Aleksa Sarai 2015-06-09 2212 if (retval)
c3b7112df86b76 Christian Brauner 2019-05-10 2213 goto bad_fork_cgroup_threadgroup_change_end;
7e47682ea555e7 Aleksa Sarai 2015-06-09 2214
7b55851367136b David Herrmann 2019-01-08 2215 /*
7b55851367136b David Herrmann 2019-01-08 2216 * From this point on we must avoid any synchronous user-space
7b55851367136b David Herrmann 2019-01-08 2217 * communication until we take the tasklist-lock. In particular, we do
7b55851367136b David Herrmann 2019-01-08 2218 * not want user-space to be able to predict the process start-time by
7b55851367136b David Herrmann 2019-01-08 2219 * stalling fork(2) after we recorded the start_time but before it is
7b55851367136b David Herrmann 2019-01-08 2220 * visible to the system.
7b55851367136b David Herrmann 2019-01-08 2221 */
7b55851367136b David Herrmann 2019-01-08 2222
7b55851367136b David Herrmann 2019-01-08 2223 p->start_time = ktime_get_ns();
cf25e24db61cc9 Peter Zijlstra 2019-11-07 2224 p->start_boottime = ktime_get_boottime_ns();
7b55851367136b David Herrmann 2019-01-08 2225
18c830df771f2b Oleg Nesterov 2013-07-03 2226 /*
18c830df771f2b Oleg Nesterov 2013-07-03 2227 * Make it visible to the rest of the system, but dont wake it up yet.
18c830df771f2b Oleg Nesterov 2013-07-03 2228 * Need tasklist lock for parent etc handling!
18c830df771f2b Oleg Nesterov 2013-07-03 2229 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 2230 write_lock_irq(&tasklist_lock);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2231
^1da177e4c3f41 Linus Torvalds 2005-04-16 2232 /* CLONE_PARENT re-uses the old parent */
2d5516cbb9daf7 Oleg Nesterov 2009-03-02 2233 if (clone_flags & (CLONE_PARENT|CLONE_THREAD)) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2234 p->real_parent = current->real_parent;
2d5516cbb9daf7 Oleg Nesterov 2009-03-02 2235 p->parent_exec_id = current->parent_exec_id;
2d5516cbb9daf7 Oleg Nesterov 2009-03-02 2236 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2237 p->real_parent = current;
2d5516cbb9daf7 Oleg Nesterov 2009-03-02 2238 p->parent_exec_id = current->self_exec_id;
2d5516cbb9daf7 Oleg Nesterov 2009-03-02 2239 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2240
d83a7cb375eec2 Josh Poimboeuf 2017-02-13 2241 klp_copy_process(p);
d83a7cb375eec2 Josh Poimboeuf 2017-02-13 2242
^1da177e4c3f41 Linus Torvalds 2005-04-16 2243 spin_lock(¤t->sighand->siglock);
4a2c7a7837da1b Oleg Nesterov 2006-03-28 2244
dbd952127d11bb Kees Cook 2014-06-27 2245 /*
dbd952127d11bb Kees Cook 2014-06-27 2246 * Copy seccomp details explicitly here, in case they were changed
dbd952127d11bb Kees Cook 2014-06-27 2247 * before holding sighand lock.
dbd952127d11bb Kees Cook 2014-06-27 2248 */
dbd952127d11bb Kees Cook 2014-06-27 2249 copy_seccomp(p);
dbd952127d11bb Kees Cook 2014-06-27 2250
d7822b1e24f2df Mathieu Desnoyers 2018-06-02 2251 rseq_fork(p, clone_flags);
d7822b1e24f2df Mathieu Desnoyers 2018-06-02 2252
4ca1d3ee46130e Eric W. Biederman 2018-07-13 2253 /* Don't start children in a dying pid namespace */
e8cfbc245e2488 Gargi Sharma 2017-11-17 2254 if (unlikely(!(ns_of_pid(pid)->pid_allocated & PIDNS_ADDING))) {
3fd37226216620 Kirill Tkhai 2017-05-12 2255 retval = -ENOMEM;
3fd37226216620 Kirill Tkhai 2017-05-12 2256 goto bad_fork_cancel_cgroup;
3fd37226216620 Kirill Tkhai 2017-05-12 2257 }
4a2c7a7837da1b Oleg Nesterov 2006-03-28 2258
7673bf553b2732 Eric W. Biederman 2018-07-23 2259 /* Let kill terminate clone/fork in the middle */
7673bf553b2732 Eric W. Biederman 2018-07-23 2260 if (fatal_signal_pending(current)) {
7673bf553b2732 Eric W. Biederman 2018-07-23 2261 retval = -EINTR;
7673bf553b2732 Eric W. Biederman 2018-07-23 2262 goto bad_fork_cancel_cgroup;
7673bf553b2732 Eric W. Biederman 2018-07-23 2263 }
7673bf553b2732 Eric W. Biederman 2018-07-23 2264
6fd2fe494b17bf Al Viro 2019-06-26 2265 /* past the last point of failure */
6fd2fe494b17bf Al Viro 2019-06-26 2266 if (pidfile)
6fd2fe494b17bf Al Viro 2019-06-26 2267 fd_install(pidfd, pidfile);
4a2c7a7837da1b Oleg Nesterov 2006-03-28 2268
2c4704756cab7c Eric W. Biederman 2017-09-26 2269 init_task_pid_links(p);
73b9ebfe126a4a Oleg Nesterov 2006-03-28 2270 if (likely(p->pid)) {
4b9d33e6d83cc0 Tejun Heo 2011-06-17 2271 ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2272
8190773985141f Oleg Nesterov 2013-07-03 2273 init_task_pid(p, PIDTYPE_PID, pid);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2274 if (thread_group_leader(p)) {
6883f81aac6f44 Eric W. Biederman 2017-06-04 2275 init_task_pid(p, PIDTYPE_TGID, pid);
8190773985141f Oleg Nesterov 2013-07-03 2276 init_task_pid(p, PIDTYPE_PGID, task_pgrp(current));
8190773985141f Oleg Nesterov 2013-07-03 2277 init_task_pid(p, PIDTYPE_SID, task_session(current));
8190773985141f Oleg Nesterov 2013-07-03 2278
1c4042c29bd2e8 Eric W. Biederman 2010-07-12 2279 if (is_child_reaper(pid)) {
17cf22c33e1f1b Eric W. Biederman 2010-03-02 2280 ns_of_pid(pid)->child_reaper = p;
1c4042c29bd2e8 Eric W. Biederman 2010-07-12 2281 p->signal->flags |= SIGNAL_UNKILLABLE;
1c4042c29bd2e8 Eric W. Biederman 2010-07-12 2282 }
c3ad2c3b02e953 Eric W. Biederman 2018-07-23 2283 p->signal->shared_pending.signal = delayed.signal;
9c9f4ded90a59e Alan Cox 2008-10-13 2284 p->signal->tty = tty_kref_get(current->signal->tty);
749860ce242798 Pavel Tikhomirov 2017-01-30 2285 /*
749860ce242798 Pavel Tikhomirov 2017-01-30 2286 * Inherit has_child_subreaper flag under the same
749860ce242798 Pavel Tikhomirov 2017-01-30 2287 * tasklist_lock with adding child to the process tree
749860ce242798 Pavel Tikhomirov 2017-01-30 2288 * for propagate_has_child_subreaper optimization.
749860ce242798 Pavel Tikhomirov 2017-01-30 2289 */
749860ce242798 Pavel Tikhomirov 2017-01-30 2290 p->signal->has_child_subreaper = p->real_parent->signal->has_child_subreaper ||
749860ce242798 Pavel Tikhomirov 2017-01-30 2291 p->real_parent->signal->is_child_subreaper;
9cd80bbb07fcd6 Oleg Nesterov 2009-12-17 2292 list_add_tail(&p->sibling, &p->real_parent->children);
5e85d4abe3f43b Eric W. Biederman 2006-04-18 2293 list_add_tail_rcu(&p->tasks, &init_task.tasks);
6883f81aac6f44 Eric W. Biederman 2017-06-04 2294 attach_pid(p, PIDTYPE_TGID);
8190773985141f Oleg Nesterov 2013-07-03 2295 attach_pid(p, PIDTYPE_PGID);
8190773985141f Oleg Nesterov 2013-07-03 2296 attach_pid(p, PIDTYPE_SID);
909ea96468096b Christoph Lameter 2010-12-08 2297 __this_cpu_inc(process_counts);
80628ca06c5d42 Oleg Nesterov 2013-07-03 2298 } else {
80628ca06c5d42 Oleg Nesterov 2013-07-03 2299 current->signal->nr_threads++;
80628ca06c5d42 Oleg Nesterov 2013-07-03 2300 atomic_inc(¤t->signal->live);
60d4de3ff7f775 Elena Reshetova 2019-01-18 2301 refcount_inc(¤t->signal->sigcnt);
924de3b8c9410c Eric W. Biederman 2018-07-23 2302 task_join_group_stop(p);
80628ca06c5d42 Oleg Nesterov 2013-07-03 2303 list_add_tail_rcu(&p->thread_group,
80628ca06c5d42 Oleg Nesterov 2013-07-03 2304 &p->group_leader->thread_group);
0c740d0afc3bff Oleg Nesterov 2014-01-21 2305 list_add_tail_rcu(&p->thread_node,
0c740d0afc3bff Oleg Nesterov 2014-01-21 2306 &p->signal->thread_head);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2307 }
8190773985141f Oleg Nesterov 2013-07-03 2308 attach_pid(p, PIDTYPE_PID);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2309 nr_threads++;
73b9ebfe126a4a Oleg Nesterov 2006-03-28 2310 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2311 total_forks++;
c3ad2c3b02e953 Eric W. Biederman 2018-07-23 2312 hlist_del_init(&delayed.node);
3f17da699431ec Oleg Nesterov 2006-02-15 2313 spin_unlock(¤t->sighand->siglock);
4af4206be2bd19 Oleg Nesterov 2014-04-13 2314 syscall_tracepoint_update(p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2315 write_unlock_irq(&tasklist_lock);
4af4206be2bd19 Oleg Nesterov 2014-04-13 2316
c13cf856cbe16a Andrew Morton 2005-11-28 2317 proc_fork_connector(p);
b53202e6308939 Oleg Nesterov 2015-12-03 2318 cgroup_post_fork(p);
780de9dd2720de Ingo Molnar 2017-02-02 2319 cgroup_threadgroup_change_end(current);
cdd6c482c9ff9c Ingo Molnar 2009-09-21 2320 perf_event_fork(p);
43d2b113241d67 KAMEZAWA Hiroyuki 2012-01-10 2321
43d2b113241d67 KAMEZAWA Hiroyuki 2012-01-10 2322 trace_task_newtask(p, clone_flags);
3ab679661721b1 Oleg Nesterov 2013-10-16 2323 uprobe_copy_process(p, clone_flags);
43d2b113241d67 KAMEZAWA Hiroyuki 2012-01-10 2324
^1da177e4c3f41 Linus Torvalds 2005-04-16 2325 return p;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2326
7e47682ea555e7 Aleksa Sarai 2015-06-09 2327 bad_fork_cancel_cgroup:
3fd37226216620 Kirill Tkhai 2017-05-12 2328 spin_unlock(¤t->sighand->siglock);
3fd37226216620 Kirill Tkhai 2017-05-12 2329 write_unlock_irq(&tasklist_lock);
b53202e6308939 Oleg Nesterov 2015-12-03 2330 cgroup_cancel_fork(p);
c3b7112df86b76 Christian Brauner 2019-05-10 2331 bad_fork_cgroup_threadgroup_change_end:
c3b7112df86b76 Christian Brauner 2019-05-10 2332 cgroup_threadgroup_change_end(current);
b3e5838252665e Christian Brauner 2019-03-27 2333 bad_fork_put_pidfd:
6fd2fe494b17bf Al Viro 2019-06-26 2334 if (clone_flags & CLONE_PIDFD) {
6fd2fe494b17bf Al Viro 2019-06-26 2335 fput(pidfile);
6fd2fe494b17bf Al Viro 2019-06-26 2336 put_unused_fd(pidfd);
6fd2fe494b17bf Al Viro 2019-06-26 2337 }
425fb2b4bf5dde Pavel Emelyanov 2007-10-18 2338 bad_fork_free_pid:
425fb2b4bf5dde Pavel Emelyanov 2007-10-18 2339 if (pid != &init_struct_pid)
425fb2b4bf5dde Pavel Emelyanov 2007-10-18 2340 free_pid(pid);
0740aa5f637568 Jiri Slaby 2016-05-20 2341 bad_fork_cleanup_thread:
0740aa5f637568 Jiri Slaby 2016-05-20 2342 exit_thread(p);
fd0928df98b957 Jens Axboe 2008-01-24 2343 bad_fork_cleanup_io:
b69f2292063d2c Louis Rilling 2009-12-04 2344 if (p->io_context)
b69f2292063d2c Louis Rilling 2009-12-04 2345 exit_io_context(p);
ab516013ad9ca4 Serge E. Hallyn 2006-10-02 2346 bad_fork_cleanup_namespaces:
444f378b237a0f Linus Torvalds 2007-01-30 2347 exit_task_namespaces(p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2348 bad_fork_cleanup_mm:
c3f3ce049f7d97 Andrea Arcangeli 2019-05-14 2349 if (p->mm) {
c3f3ce049f7d97 Andrea Arcangeli 2019-05-14 2350 mm_clear_owner(p->mm, p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2351 mmput(p->mm);
c3f3ce049f7d97 Andrea Arcangeli 2019-05-14 2352 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2353 bad_fork_cleanup_signal:
4ab6c08336535f Oleg Nesterov 2009-08-26 2354 if (!(clone_flags & CLONE_THREAD))
1c5354de90c900 Mike Galbraith 2011-01-05 2355 free_signal_struct(p->signal);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2356 bad_fork_cleanup_sighand:
a7e5328a06a2be Oleg Nesterov 2006-03-28 2357 __cleanup_sighand(p->sighand);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2358 bad_fork_cleanup_fs:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2359 exit_fs(p); /* blocking */
^1da177e4c3f41 Linus Torvalds 2005-04-16 2360 bad_fork_cleanup_files:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2361 exit_files(p); /* blocking */
^1da177e4c3f41 Linus Torvalds 2005-04-16 2362 bad_fork_cleanup_semundo:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2363 exit_sem(p);
e4e55b47ed9ae2 Tetsuo Handa 2017-03-24 2364 bad_fork_cleanup_security:
e4e55b47ed9ae2 Tetsuo Handa 2017-03-24 2365 security_task_free(p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2366 bad_fork_cleanup_audit:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2367 audit_free(p);
6c72e3501d0d62 Peter Zijlstra 2014-10-02 2368 bad_fork_cleanup_perf:
cdd6c482c9ff9c Ingo Molnar 2009-09-21 2369 perf_event_free_task(p);
6c72e3501d0d62 Peter Zijlstra 2014-10-02 2370 bad_fork_cleanup_policy:
b09be676e0ff25 Byungchul Park 2017-08-07 2371 lockdep_free_task(p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2372 #ifdef CONFIG_NUMA
f0be3d32b05d3f Lee Schermerhorn 2008-04-28 2373 mpol_put(p->mempolicy);
e8604cb43690b7 Li Zefan 2014-03-28 2374 bad_fork_cleanup_threadgroup_lock:
^1da177e4c3f41 Linus Torvalds 2005-04-16 2375 #endif
35df17c57cecb0 Shailabh Nagar 2006-08-31 2376 delayacct_tsk_free(p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2377 bad_fork_cleanup_count:
d84f4f992cbd76 David Howells 2008-11-14 2378 atomic_dec(&p->cred->user->processes);
e0e817392b9acf David Howells 2009-09-02 2379 exit_creds(p);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2380 bad_fork_free:
405c0759712f57 Andy Lutomirski 2016-10-31 2381 p->state = TASK_DEAD;
68f24b08ee892d Andy Lutomirski 2016-09-15 2382 put_task_stack(p);
c3f3ce049f7d97 Andrea Arcangeli 2019-05-14 2383 delayed_free_task(p);
fe7d37d1fbf8ff Oleg Nesterov 2006-01-08 2384 fork_out:
c3ad2c3b02e953 Eric W. Biederman 2018-07-23 2385 spin_lock_irq(¤t->sighand->siglock);
c3ad2c3b02e953 Eric W. Biederman 2018-07-23 2386 hlist_del_init(&delayed.node);
c3ad2c3b02e953 Eric W. Biederman 2018-07-23 2387 spin_unlock_irq(¤t->sighand->siglock);
fe7d37d1fbf8ff Oleg Nesterov 2006-01-08 @2388 return ERR_PTR(retval);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2389 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2390 ---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation