[llvm] [Bolt] Fix address translation for KASLR kernel (PR #114261)

Maksim Panchenko via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 22:22:25 PST 2024


maksfb wrote:

> When I worked on this patch, I had a question on why HasFixedLoadAddress is needed. To me, ASLR (KASLR), or not, should use one code path. Non-ASLR (to me) is a trivial case of ASLR -- at least from parsing and reading perf file point of view. I was thinking about removing this field. But this field also used to control some optimizations. So I leave it there. It seems to me the only upside of using FixedLoadAddress is to avoid address adjustments -- but that should be very cheap. Is my understanding correct? Thanks

One example where we use `HasFixedLoadAddress` flag is in the user-space to generate slightly different EH tables for PIEs (i.e. when flag is set to `false`) as we cannot use absolute addressing. I imagine it could be similar for `vmlinux` where KASLR-capable kernel requires all addressing to be position-independent and thus some metadata cannot be absolute addresses. Most of the metadata BOLT detects uses relative addressing with the exception of one field in `.parainstructions`. The latter is no longer used on modern kernels, but it will be good to know if an older kernel is KASLR-capable and reject processing `.parainstructions` for it.


https://github.com/llvm/llvm-project/pull/114261


More information about the llvm-commits mailing list