summaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorMarco Elver <elver@google.com>2021-04-08 12:35:58 +0200
committerPeter Zijlstra <peterz@infradead.org>2021-04-16 16:32:40 +0200
commit2b26f0aa004995f49f7b6f4100dd0e4c39a9ed5f (patch)
tree27077a92806b93fffb58a3eaf0fad81cbf2e42c9 /kernel/fork.c
parentperf: Apply PERF_EVENT_IOC_MODIFY_ATTRIBUTES to children (diff)
downloadlinux-2b26f0aa004995f49f7b6f4100dd0e4c39a9ed5f.tar.xz
linux-2b26f0aa004995f49f7b6f4100dd0e4c39a9ed5f.zip
perf: Support only inheriting events if cloned with CLONE_THREAD
Adds bit perf_event_attr::inherit_thread, to restricting inheriting events only if the child was cloned with CLONE_THREAD. This option supports the case where an event is supposed to be process-wide only (including subthreads), but should not propagate beyond the current process's shared environment. Suggested-by: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Marco Elver <elver@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/lkml/YBvj6eJR%2FDY2TsEB@hirez.programming.kicks-ass.net/
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 0acc8ed1076b..3728a645771c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -2078,7 +2078,7 @@ static __latent_entropy struct task_struct *copy_process(
if (retval)
goto bad_fork_cleanup_policy;
- retval = perf_event_init_task(p);
+ retval = perf_event_init_task(p, clone_flags);
if (retval)
goto bad_fork_cleanup_policy;
retval = audit_alloc(p);