Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 82d0b80

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fix from Ingo Molnar: "One more fix for a recently discovered bug" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf: Disable monitoring on setuid processes for regular users
2 parents 98b6ed0 + 2976b10 commit 82d0b80

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

fs/exec.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,13 +1135,6 @@ void setup_new_exec(struct linux_binprm * bprm)
11351135
set_dumpable(current->mm, suid_dumpable);
11361136
}
11371137

1138-
/*
1139-
* Flush performance counters when crossing a
1140-
* security domain:
1141-
*/
1142-
if (!get_dumpable(current->mm))
1143-
perf_event_exit_task(current);
1144-
11451138
/* An exec changes our domain. We are no longer part of the thread
11461139
group */
11471140

@@ -1205,6 +1198,15 @@ void install_exec_creds(struct linux_binprm *bprm)
12051198

12061199
commit_creds(bprm->cred);
12071200
bprm->cred = NULL;
1201+
1202+
/*
1203+
* Disable monitoring for regular users
1204+
* when executing setuid binaries. Must
1205+
* wait until new credentials are committed
1206+
* by commit_creds() above
1207+
*/
1208+
if (get_dumpable(current->mm) != SUID_DUMP_USER)
1209+
perf_event_exit_task(current);
12081210
/*
12091211
* cred_guard_mutex must be held at least to this point to prevent
12101212
* ptrace_attach() from altering our determination of the task's

0 commit comments

Comments
 (0)