Commit f65cb45c authored by Ingo Molnar's avatar Ingo Molnar

perfcounters: flush on setuid exec

Pavel Machek pointed out that performance counters should be flushed
when crossing protection domains on setuid execution.
Reported-by: default avatarPavel Machek <pavel@suse.cz>
Acked-by: default avatarPavel Machek <pavel@suse.cz>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 0cc0c027
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <linux/string.h> #include <linux/string.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/perf_counter.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/key.h> #include <linux/key.h>
...@@ -1017,6 +1018,13 @@ int flush_old_exec(struct linux_binprm * bprm) ...@@ -1017,6 +1018,13 @@ int flush_old_exec(struct linux_binprm * bprm)
set_dumpable(current->mm, suid_dumpable); set_dumpable(current->mm, suid_dumpable);
} }
/*
* Flush performance counters when crossing a
* security domain:
*/
if (!get_dumpable(current->mm))
perf_counter_exit_task(current);
/* An exec changes our domain. We are no longer part of the thread /* An exec changes our domain. We are no longer part of the thread
group */ group */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment