From: Petr Mladek <pmladek@suse.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
x86@kernel.org, linux-kernel@vger.kernel.org,
rostedt@goodmis.org, mhiramat@kernel.org, bristot@redhat.com,
jbaron@akamai.com, torvalds@linux-foundation.org,
tglx@linutronix.de, mingo@kernel.org, namit@vmware.com,
hpa@zytor.com, luto@kernel.org, ard.biesheuvel@linaro.org,
jeyu@kernel.org, live-patching@vger.kernel.org
Subject: Re: [PATCH v4 15/16] module: Move where we mark modules RO,X
Date: Fri, 25 Oct 2019 08:44:56 +0200 [thread overview]
Message-ID: <20191025064456.6jjrngm4m3mspaxw@pathway.suse.cz> (raw)
In-Reply-To: <20191024131634.GC4131@hirez.programming.kicks-ass.net>
On Thu 2019-10-24 15:16:34, Peter Zijlstra wrote:
> On Wed, Oct 23, 2019 at 12:00:25PM -0500, Josh Poimboeuf wrote:
>
> > > This then raises a number of questions:
> > >
> > > 1) why is that RELA (that obviously does not depend on any module)
> > > applied so late?
> >
> > Good question. The 'pv_ops' symbol is exported by the core kernel, so I
> > can't see any reason why we'd need to apply that rela late. In theory,
> > kpatch-build isn't supposed to convert that to a klp rela. Maybe
> > something went wrong in the patch creation code.
> >
> > I'm also questioning why we even need to apply the parainstructions
> > section late. Maybe we can remove that apply_paravirt() call
> > altogether, along with .klp.arch.parainstruction sections.
Hmm, the original bug report against livepatching was actually about
paravirt ops, see below.
> > I'll need to look into it...
>
> Right, that really should be able to run early. Esp. after commit
>
> 11e86dc7f274 ("x86/paravirt: Detect over-sized patching bugs in paravirt_patch_call()")
>
> paravirt patching is unconditional. We _never_ run with the indirect
> call except very early boot, but modules should have them patched way
> before their init section runs.
>
> We rely on this for spectre-v2 and friends.
Livepatching has the same requirement. The module code has to be fully
livepatched before the module gets actually used. It means before
mod->init() is called and before the module is moved into
MODULE_STATE_LIVE state.
> > > 3) Is there ever a possible module-dependent RELA to a paravirt /
> > > alternative site?
> >
> > Good question...
>
> > > Then for 3) we only have alternatives left, and I _think_ it unlikely to
> > > be the case, but I'll have to have a hard look at that.
> >
> > I'm not sure about alternatives, but maybe we can enforce such
> > limitations with tooling and/or kernel checks.
>
> Right, so on IRC you implied you might have some additional details on
> how alternatives were affected; did you manage to dig that up?
I am not sure what Josh had in mind. But the problem with livepatches,
paravort ops, and alternatives was described in the related patchset, see
https://lkml.kernel.org/r/1471481911-5003-1-git-send-email-jeyu@redhat.com
The original bug report is
https://lkml.kernel.org/r/20160329120518.GA21252@canonical.com
Best Regards,
Petr
next prev parent reply other threads:[~2019-10-25 6:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191018073525.768931536@infradead.org>
[not found] ` <20191018074634.801435443@infradead.org>
[not found] ` <20191021135312.jbbxsuipxldocdjk@treble>
[not found] ` <20191021141402.GI1817@hirez.programming.kicks-ass.net>
[not found] ` <20191023114835.GT1817@hirez.programming.kicks-ass.net>
2019-10-23 17:00 ` [PATCH v4 15/16] module: Move where we mark modules RO,X Josh Poimboeuf
2019-10-24 13:16 ` Peter Zijlstra
2019-10-25 6:44 ` Petr Mladek [this message]
2019-10-25 8:43 ` Peter Zijlstra
2019-10-25 10:06 ` Peter Zijlstra
2019-10-25 13:50 ` Josh Poimboeuf
2019-10-26 1:17 ` Josh Poimboeuf
2019-10-28 10:07 ` Peter Zijlstra
2019-10-28 10:43 ` Peter Zijlstra
2019-10-25 9:16 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191025064456.6jjrngm4m3mspaxw@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=ard.biesheuvel@linaro.org \
--cc=bristot@redhat.com \
--cc=hpa@zytor.com \
--cc=jbaron@akamai.com \
--cc=jeyu@kernel.org \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namit@vmware.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).