** Description changed:
[Impact]
perf_allow_cpu() and perf_allow_tracepoint() are static inline in
<linux/perf_event.h> and reference sysctl_perf_event_paranoid and
security_perf_event_open(), neither of which is exported. Modules cannot reuse
the system-wide perf permission model and open-code partial copies instead.
drm/xe does this in its OA and EU-stall observation paths, open-coding a
CPU-event check that ignores kernel.perf_event_paranoid and the
- security_perf_event_open() LSM hook. On systems with Intel Xe graphics, xe
- observation honors neither.
+ security_perf_event_open() LSM hook.
[Fix]
- Patch 1 moves perf_allow_cpu/tracepoint() out of line into
kernel/events/core.c
- and exports them EXPORT_SYMBOL_GPL, with !CONFIG_PERF_EVENTS stubs. No
behavior
- change for existing callers. Patch 2 switches xe's OA and EU-stall paths to
- perf_allow_cpu() so they honor kernel.perf_event_paranoid and the LSM perf
hook;
- dev.xe.observation_paranoid stays as an escape hatch.
+ Move perf_allow_cpu() and perf_allow_tracepoint() out of line and export them
+ with EXPORT_SYMBOL_GPL (with !CONFIG_PERF_EVENTS stubs), following the
+ precedent of commit 5e9629d0ae97 for perf_allow_kernel(). Then convert drm/xe
+ OA and EU-stall paths to call perf_allow_cpu() so Xe observation honors
+ kernel.perf_event_paranoid and the LSM hook. dev.xe.observation_paranoid
+ remains as an escape hatch.
Upstream commits in linux-next/drm-next, targeting v7.3:
d32bf877c0c3 ("perf/core: out-of-line and export perf_allow_cpu/tracepoint()")
6680bf0cb726 ("drm/xe: gate observation streams with perf_allow_cpu()")
drm/xe is backported: this kernel lacks commit 41255b2f1e03, so a duplicate
int
ret declaration was dropped. perf/core is a clean cherry-pick.
Link:
https://lore.kernel.org/all/[email protected]/
[Test Plan]
- - Builds clean with CONFIG_PERF_EVENTS=y; CONFIG_PERF_EVENTS=n plus
- CONFIG_DRM_XE=m under COMPILE_TEST; and CONFIG_DRM_XE=m.
+ - Builds clean with CONFIG_DRM_XE=m and CONFIG_PERF_EVENTS enabled or
disabled.
- Boots with no dmesg regressions.
- - perf_allow_cpu() and perf_allow_tracepoint() appear as GPL-only exports in
- Module.symvers and /proc/kallsyms; both are absent without the patches.
+ - Module.symvers records perf_allow_cpu() and perf_allow_tracepoint() as
+ EXPORT_SYMBOL_GPL; both are present in /proc/kallsyms and absent without
+ the patches.
- A perf_event_paranoid sweep confirms unchanged perf_event_open()
allow/deny behavior.
[Where problems could occur]
- Patch 1 has identical behavior for existing callers. Patch 2 changes xe
- observation permissions only on Intel Xe systems; others are unaffected. Low
- risk.
+ Patch 1 preserves existing permission behavior. Patch 2 may allow or deny Xe
+ observation according to the system perf and LSM policies. Only Intel Xe
+ systems are affected. Low risk.
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2160654
Title:
Backport: complete perf_allow_* trio and use in drm/xe
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2160654/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs