Re: module: save load_info for livepatch modules

From: Miroslav Benes
Date: Fri Nov 13 2015 - 07:46:39 EST

On Fri, 13 Nov 2015, Miroslav Benes wrote:

> As for load_info, I don't have a strong opinion whether to keep it for all
> modules or for livepatch modules only.

I have. We cannot keep it, even for livepatch modules...

In info->hdr there is a temporary copy of the whole module (see
init_module syscall and the first parts of load_module). In load_module
a final struct module * is created with parts of info->hdr copied (I'll
get to that later). So if we saved info->hdr for later purposes we would
just have two copies of the same module in the memory. The original one
with !SHF_ALLOC sections and everything in vmalloc area, and the new
final copy with SHF_ALLOC sections only. This is not good.

If this is correct (and I think it is after some staring into the code) we
need to do something different. We should build the info we need for
delayed relocations from the final copy (or refactor the existing
module code).

The second problem... dynrela sections need to be marked with SHF_ALLOC
flag, right? Perhaps it would be better not to do it and copy also
SHF_RELA_LIVEPATCH sections. It is equivalent but not hidden somewhere
else (in userspace "kpatch-build" tool).

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at