When pprof symbolizes kernel addresses in vmlinux binary for a profile converted using https://github.com/google/perf_data_converter, the addresses need to be adjusted if kernel ASLR is in effect. So far the call to GetBase did not pass text segment info to GetBase which shortcircuited the code to merely return zero adjustment. This change fixes the call to GetBase to address that. The added test case is a simulation of what happens with vmlinux, but it should be pretty close. Including a vmlinux file into the test data does not appear practical due to the binary size. I verified that the test failed before the fix and passes after. Note that the fixed issue is specific to the kernel ASLR as user-mode ASRL-enabled binaries (i.e. built with -pie / -fpie) have ET_DYN type which takes a different code path in GetBase which did not have issues before this fix in practice.
|
|
||
215 |
|
215 |
|
216 |
|
216 |
|
217 |
|
217 |
|
218 |
|
|
|
|
218 |
|
|
219 |
|
219 |
|
220 |
|
220 |
|
221 |
|
221 |
|
|
|
||
201 |
|
201 |
|
202 |
|
202 |
|
203 |
|
203 |
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
|
|
204 |
|
|
|
205 |
|
|
|
206 |
|
|
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
|
226 |
|
|
214 |
|
227 |
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
|
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
220 |
|
235 |
|
|
236 |
|
|
221 |
|
237 |
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
|
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
|
245 |
|
|
|
246 |
|
|
|
247 |
|
|
|
248 |
|
|
|
249 |
|
|
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
238 |
|
255 |
|
239 |
|
256 |
|
240 |
|
257 |
|
|
|
||
259 |
|
259 |
|
260 |
|
260 |
|
261 |
|
261 |
|
|
262 |
|
|
|
263 |
|
|
|
264 |
|
|
|
265 |
|
|
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
|
275 |
|
|
|
276 |
|
|
|
277 |
|