[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191024203306.GL4114@hirez.programming.kicks-ass.net>
Date: Thu, 24 Oct 2019 22:33:06 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org, rostedt@...dmis.org,
mhiramat@...nel.org, bristot@...hat.com, jbaron@...mai.com,
torvalds@...ux-foundation.org, tglx@...utronix.de,
mingo@...nel.org, namit@...are.com, hpa@...or.com, luto@...nel.org,
ard.biesheuvel@...aro.org, jeyu@...nel.org
Subject: Re: [PATCH v4 15/16] module: Move where we mark modules RO,X
On Thu, Oct 24, 2019 at 01:31:15PM -0500, Josh Poimboeuf wrote:
> How about something like this? Completely untested, but if you agree
> with this approach I could hack up kpatch-build to test it properly.
>
> diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
> index ab4a4606d19b..597bf32bc591 100644
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -239,6 +239,17 @@ static int klp_resolve_symbols(Elf_Shdr *relasec, struct module *pmod)
> if (ret)
> return ret;
>
> + /*
> + * Prevent module patches from using livepatch relas for
> + * vmlinux symbols. Presumably such symbols are exported and
> + * normal relas can instead be used at patch module loading
> + * time.
> + */
> + if (!vmlinux && core_kernel_text(addr)) {
> + pr_err("unsupported livepatch symbol\n");
> + return -EINVAL;
> + }
> +
> sym->st_value = addr;
> }
If that works, this is much simpler and therefore preferred.
Powered by blists - more mailing lists