diff mbox series

[RFC,07/10] x86/unwind: Unwind orc at module writable address

Message ID 20201120202426.18009-8-rick.p.edgecombe@intel.com (mailing list archive)
State New, archived
Headers show
Series New permission vmalloc interface | expand

Commit Message

Edgecombe, Rick P Nov. 20, 2020, 8:24 p.m. UTC
Since modules can have a separate writable address during loading,
do the orc unwind at the writable address.

Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
---
 arch/x86/kernel/unwind_orc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index 73f800100066..41f9022a10cc 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -238,8 +238,8 @@  static int orc_sort_cmp(const void *_a, const void *_b)
 void unwind_module_init(struct module *mod, void *_orc_ip, size_t orc_ip_size,
 			void *_orc, size_t orc_size)
 {
-	int *orc_ip = _orc_ip;
-	struct orc_entry *orc = _orc;
+	int *orc_ip = module_adjust_writable_addr(_orc_ip);
+	struct orc_entry *orc = module_adjust_writable_addr(_orc);
 	unsigned int num_entries = orc_ip_size / sizeof(int);
 
 	WARN_ON_ONCE(orc_ip_size % sizeof(int) != 0 ||
@@ -257,8 +257,8 @@  void unwind_module_init(struct module *mod, void *_orc_ip, size_t orc_ip_size,
 	sort(orc_ip, num_entries, sizeof(int), orc_sort_cmp, orc_sort_swap);
 	mutex_unlock(&sort_mutex);
 
-	mod->arch.orc_unwind_ip = orc_ip;
-	mod->arch.orc_unwind = orc;
+	mod->arch.orc_unwind_ip = _orc_ip;
+	mod->arch.orc_unwind = _orc;
 	mod->arch.num_orcs = num_entries;
 }
 #endif