]> xenbits.xensource.com Git - people/andrewcoop/xen.git/commit
xen/livepatch: drop load_addr Elf section field
authorRoger Pau Monné <roger.pau@citrix.com>
Thu, 26 Sep 2024 10:14:27 +0000 (12:14 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 26 Sep 2024 13:18:03 +0000 (14:18 +0100)
commit8c81423038f17f6cbc853dd35d69d50a4458f764
tree7826fe96173a5c702c8d72ed97f66c29aa69665c
parent3a28da8f4dafa906ec13b8d0533046584d897bca
xen/livepatch: drop load_addr Elf section field

The Elf loading logic will initially use the `data` section field to stash a
pointer to the temporary loaded data (from the buffer allocated in
livepatch_upload(), which is later relocated and the new pointer stashed in
`load_addr`.

Remove this dual field usage and use an `addr` uniformly.  Initially data will
point to the temporary buffer, until relocation happens, at which point the
pointer will be updated to the relocated address.

This avoids leaving a dangling pointer in the `data` field once the temporary
buffer is freed by livepatch_upload().

Note the `addr` field cannot retain the const attribute from the previous
`data`field, as there's logic that performs manipulations against the loaded
sections, like applying relocations or sorting the exception table.

No functional change intended.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Michal Orzel <michal.orzel@amd.com>
xen/arch/arm/arm32/livepatch.c
xen/arch/arm/arm64/livepatch.c
xen/arch/x86/livepatch.c
xen/common/livepatch.c
xen/common/livepatch_elf.c
xen/include/xen/livepatch_elf.h