Commit 50a53b6
perf/amd/ibs: Prevent leaking sensitive data to userspace
Although IBS "swfilt" can prevent leaking samples with kernel RIP to the
userspace, there are few subtle cases where a 'data' address and/or a
'branch target' address can fall under kernel address range although RIP
is from userspace. Prevent leaking kernel 'data' addresses by discarding
such samples when {exclude_kernel=1,swfilt=1}.
IBS can now be invoked by unprivileged user with the introduction of
"swfilt". However, this creates a loophole in the interface where an
unprivileged user can get physical address of the userspace virtual
addresses through IBS register raw dump (PERF_SAMPLE_RAW). Prevent this
as well.
This upstream commit fixed the most obvious leak:
65a9926 perf/x86: Check data address for IBS software filter
Follow that up with a more complete fix.
Fixes: d29e744 ("perf/x86: Relax privilege filter restriction on AMD IBS")
Suggested-by: Matteo Rizzo <matteorizzo@google.com>
Co-developed-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20250321161251.1033-1-ravi.bangoria@amd.com1 parent 5c7474b commit 50a53b6
1 file changed
Lines changed: 78 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
941 | 941 | | |
942 | 942 | | |
943 | 943 | | |
| 944 | + | |
| 945 | + | |
944 | 946 | | |
945 | 947 | | |
946 | 948 | | |
| |||
1036 | 1038 | | |
1037 | 1039 | | |
1038 | 1040 | | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1039 | 1102 | | |
1040 | 1103 | | |
1041 | 1104 | | |
| |||
1048 | 1111 | | |
1049 | 1112 | | |
1050 | 1113 | | |
| 1114 | + | |
1051 | 1115 | | |
1052 | 1116 | | |
1053 | 1117 | | |
| |||
1102 | 1166 | | |
1103 | 1167 | | |
1104 | 1168 | | |
| 1169 | + | |
1105 | 1170 | | |
1106 | 1171 | | |
1107 | 1172 | | |
| |||
1128 | 1193 | | |
1129 | 1194 | | |
1130 | 1195 | | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
1134 | 1196 | | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
| 1197 | + | |
1138 | 1198 | | |
1139 | 1199 | | |
1140 | 1200 | | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
1141 | 1210 | | |
1142 | 1211 | | |
1143 | 1212 | | |
| |||
1149 | 1218 | | |
1150 | 1219 | | |
1151 | 1220 | | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
1152 | 1224 | | |
1153 | 1225 | | |
1154 | 1226 | | |
| |||
0 commit comments