Commit 4716023
perf/core: Avoid put_page() when GUP fails
PEBS PERF_SAMPLE_PHYS_ADDR events use perf_virt_to_phys() to convert PMU
sampled virtual addresses to physical using get_user_page_fast_only()
and page_to_phys().
Some get_user_page_fast_only() error cases return false, indicating no
page reference, but still initialize the output page pointer with an
unreferenced page. In these error cases perf_virt_to_phys() calls
put_page(). This causes page reference count underflow, which can lead
to unintentional page sharing.
Fix perf_virt_to_phys() to only put_page() if get_user_page_fast_only()
returns a referenced page.
Fixes: fc7ce9c ("perf/core, x86: Add PERF_SAMPLE_PHYS_ADDR")
Signed-off-by: Greg Thelen <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]1 parent 5863702 commit 4716023
1 file changed
+5
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7154 | 7154 | | |
7155 | 7155 | | |
7156 | 7156 | | |
7157 | | - | |
7158 | 7157 | | |
7159 | 7158 | | |
7160 | 7159 | | |
| |||
7173 | 7172 | | |
7174 | 7173 | | |
7175 | 7174 | | |
| 7175 | + | |
| 7176 | + | |
7176 | 7177 | | |
7177 | | - | |
| 7178 | + | |
7178 | 7179 | | |
| 7180 | + | |
| 7181 | + | |
7179 | 7182 | | |
7180 | 7183 | | |
7181 | | - | |
7182 | | - | |
7183 | | - | |
7184 | 7184 | | |
7185 | 7185 | | |
7186 | 7186 | | |
| |||
0 commit comments