Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0f0836b7 authored by Linus Torvalds's avatar Linus Torvalds
Browse files


Pull livepatching updates from Jiri Kosina:

 - RO/NX attribute fixes for patch module relocations from Josh
   Poimboeuf.  As part of this effort, module.c has been cleaned up as
   well and livepatching is piggy-backing on this cleanup.  Rusty is OK
   with this whole lot going through livepatching tree.

 - symbol disambiguation support from Chris J Arges.  That series is
   also

        Reviewed-by: default avatarMiroslav Benes <mbenes@suse.cz>

   but this came in only after I've alredy pushed out.  Didn't want to
   rebase because of that, hence I am mentioning it here.

 - symbol lookup fix from Miroslav Benes

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching:
  livepatch: Cleanup module page permission changes
  module: keep percpu symbols in module's symtab
  module: clean up RO/NX handling.
  module: use a structure to encapsulate layout.
  gcov: use within_module() helper.
  module: Use the same logic for setting and unsetting RO/NX
  livepatch: function,sympos scheme in livepatch sysfs directory
  livepatch: add sympos as disambiguator field to klp_reloc
  livepatch: add old_sympos as disambiguator field to klp_func
parents c2848f2e b56b36ee
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -33,7 +33,7 @@ Description:
		The object directory contains subdirectories for each function
		The object directory contains subdirectories for each function
		that is patched within the object.
		that is patched within the object.


What:		/sys/kernel/livepatch/<patch>/<object>/<function>
What:		/sys/kernel/livepatch/<patch>/<object>/<function,sympos>
Date:		Nov 2014
Date:		Nov 2014
KernelVersion:	3.19.0
KernelVersion:	3.19.0
Contact:	live-patching@vger.kernel.org
Contact:	live-patching@vger.kernel.org
@@ -41,4 +41,8 @@ Description:
		The function directory contains attributes regarding the
		The function directory contains attributes regarding the
		properties and state of the patched function.
		properties and state of the patched function.


		The directory name contains the patched function name and a
		sympos number corresponding to the nth occurrence of the symbol
		name in kallsyms for the patched object.

		There are currently no such attributes.
		There are currently no such attributes.
+1 −1
Original line number Original line Diff line number Diff line
@@ -160,7 +160,7 @@ apply_relocate_add(Elf64_Shdr *sechdrs, const char *strtab,


	/* The small sections were sorted to the end of the segment.
	/* The small sections were sorted to the end of the segment.
	   The following should definitely cover them.  */
	   The following should definitely cover them.  */
	gp = (u64)me->module_core + me->core_size - 0x8000;
	gp = (u64)me->core_layout.base + me->core_layout.size - 0x8000;
	got = sechdrs[me->arch.gotsecindex].sh_addr;
	got = sechdrs[me->arch.gotsecindex].sh_addr;


	for (i = 0; i < n; i++) {
	for (i = 0; i < n; i++) {
+2 −2
Original line number Original line Diff line number Diff line
@@ -385,8 +385,8 @@ void *unwind_add_table(struct module *module, const void *table_start,
		return NULL;
		return NULL;


	init_unwind_table(table, module->name,
	init_unwind_table(table, module->name,
			  module->module_core, module->core_size,
			  module->core_layout.base, module->core_layout.size,
			  module->module_init, module->init_size,
			  module->init_layout.base, module->init_layout.size,
			  table_start, table_size,
			  table_start, table_size,
			  NULL, 0);
			  NULL, 0);


+1 −1
Original line number Original line Diff line number Diff line
@@ -32,7 +32,7 @@ struct plt_entries {


static bool in_init(const struct module *mod, u32 addr)
static bool in_init(const struct module *mod, u32 addr)
{
{
	return addr - (u32)mod->module_init < mod->init_size;
	return addr - (u32)mod->init_layout.base < mod->init_layout.size;
}
}


u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val)
u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val)
+6 −6
Original line number Original line Diff line number Diff line
@@ -118,9 +118,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
	 * Increase core size to make room for GOT and set start
	 * Increase core size to make room for GOT and set start
	 * offset for GOT.
	 * offset for GOT.
	 */
	 */
	module->core_size = ALIGN(module->core_size, 4);
	module->core_layout.size = ALIGN(module->core_layout.size, 4);
	module->arch.got_offset = module->core_size;
	module->arch.got_offset = module->core_layout.size;
	module->core_size += module->arch.got_size;
	module->core_layout.size += module->arch.got_size;


	return 0;
	return 0;


@@ -177,7 +177,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
			if (!info->got_initialized) {
			if (!info->got_initialized) {
				Elf32_Addr *gotent;
				Elf32_Addr *gotent;


				gotent = (module->module_core
				gotent = (module->core_layout.base
					  + module->arch.got_offset
					  + module->arch.got_offset
					  + info->got_offset);
					  + info->got_offset);
				*gotent = relocation;
				*gotent = relocation;
@@ -255,8 +255,8 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
			 */
			 */
			pr_debug("GOTPC: PC=0x%x, got_offset=0x%lx, core=0x%p\n",
			pr_debug("GOTPC: PC=0x%x, got_offset=0x%lx, core=0x%p\n",
				 relocation, module->arch.got_offset,
				 relocation, module->arch.got_offset,
				 module->module_core);
				 module->core_layout.base);
			relocation -= ((unsigned long)module->module_core
			relocation -= ((unsigned long)module->core_layout.base
				       + module->arch.got_offset);
				       + module->arch.got_offset);
			*location = relocation;
			*location = relocation;
			break;
			break;
Loading