Re: RFC: removing reloc and module notify code from livepatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 13, 2015 at 05:40:35PM -0500, Josh Poimboeuf wrote:
> Also, it's late and this is still a half-formed thought, but...  in the
> case of building livepatch modules using kbuild (rather than a more
> heavyweight tool like kpatch-build) I think it might also make it
> possible to have a C macro which allows you to specify unexported symbol
> addresses directly from the patch code source.  That could be a big win
> for the kbuild approach to building patch modules.  Need to think about
> that some more.

Ok, I think this could work out *really* nicely...

Something like:

	struct klp_symbol __section(__klp_symbols) symbols[] = {
		{
			.objname	= NULL,
			.sym		= "saved_command_line",
			.addr		= 0xffffffff81ebc008,
		},
	};

	extern char *saved_command_line;

	static int cmdline_proc_show__patched(struct seq_file *m, void *v)
	{
		seq_printf(m, "%s patched=1\n", saved_command_line);
		return 0;
	}

Then, as Jessica suggested, the module simplify_symbols() code could
call klp_resolve_symbol() for the SHN_UNDEF saved_command_line symbol.

klp_resolve_symbol() would read saved_command_line's address from the
__klp_symbols section and verify that it matches kallsyms.  Then the
module code would relocate it normally in apply_relocations().

IMO this would take away one of the biggest reasons why we need a big
complex patch generation tool like kpatch-build.

-- 
Josh
--
To unsubscribe from this list: send the line "unsubscribe live-patching" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux