From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: sstabellini@kernel.org, ross.lagerwall@citrix.com,
Andrew Cooper <andrew.cooper3@citrix.com>,
Doug Goldstein <cardoe@cardoe.com>,
julien.grall@arm.com, xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 07/20] arm/x86: Add ALTERNATIVE and HAS_EX_TABLE
Date: Tue, 6 Sep 2016 16:36:40 -0400 [thread overview]
Message-ID: <20160906203640.GB7062@char.us.oracle.com> (raw)
In-Reply-To: <57BF23270200007800109194@prv-mh.provo.novell.com>
On Thu, Aug 25, 2016 at 08:56:07AM -0600, Jan Beulich wrote:
> >>> On 25.08.16 at 15:58, <andrew.cooper3@citrix.com> wrote:
> > On 25/08/16 14:37, Konrad Rzeszutek Wilk wrote:
> >
> >> x86 implements all of them by default - and we just
> >> add two extra CONFIG_ variables to be declared in autoconf.h.
> >>
> >> ARM 64 only has alternative while ARM 32 has none of them.
> >>
> >> And while at it change the livepatch common code that
> >> would benefit from this.
> >>
> >> Suggested-by: Julien Grall <julien.grall@arm.com>
> >> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> >
> > Surely livepatch should select alternatives ?
>
> DYM depend on? It clearly shouldn't select them, as whether
> they're present is determined by arch code.
And I am not sure if there is a need for Kconfig LIVEPATCH
entry to depend on it?
Especially as the common/livepatch.c has #ifef CONFIG_ALTERNATIVE
(and also CONFIG_HAS_EX_TABLE) - added by this patch - to deal with
architectures that do not have support them.
Ssuch as ARM 32 or ARM64 without errata support built-in.
I spun out an seperate patch that would thrown an -EOPNOTSUPP
if these sections are part of the payload and the hypervisor
was built without the support, like this:
(This is to be on top of the patch discussed - or if folks
prefer I can squash it in).
From 3a4953dd0f7d2411e5d638a82bfe57c0e16a22b3 Mon Sep 17 00:00:00 2001
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Date: Tue, 6 Sep 2016 16:28:23 -0400
Subject: [PATCH] livepatch: Reject payloads with .alternative or .ex_table if
support is not built-in.
ARM 64 can be built without alternative support (without the
errata support) - and it would sad if the payload loaded
had .alternative section but we did not support parsing it.
As this could lead to sad results instead of ignoring this
lets error out during loading.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Julien Grall <julien.grall@arm.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
v3: New submission.
---
xen/common/livepatch.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 73d4edb..342a5ec 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -685,10 +685,10 @@ static int prepare_payload(struct payload *payload,
sizeof(*region->frame[i].bugs);
}
-#ifdef CONFIG_HAS_ALTERNATIVE
sec = livepatch_elf_sec_by_name(elf, ".altinstructions");
if ( sec )
{
+#ifdef CONFIG_HAS_ALTERNATIVE
struct alt_instr *a, *start, *end;
if ( sec->sec->sh_size % sizeof(*a) )
@@ -715,13 +715,17 @@ static int prepare_payload(struct payload *payload,
}
}
apply_alternatives(start, end);
- }
+#else
+ dprintk(XENLOG_ERR, LIVEPATCH "%s: We don't support alternative patching!\n",
+ elf->name);
+ return -EOPNOTSUPP;
#endif
+ }
-#ifdef CONFIG_HAS_EX_TABLE
sec = livepatch_elf_sec_by_name(elf, ".ex_table");
if ( sec )
{
+#ifdef CONFIG_HAS_EX_TABLE
struct exception_table_entry *s, *e;
if ( !sec->sec->sh_size ||
@@ -740,8 +744,12 @@ static int prepare_payload(struct payload *payload,
region->ex = s;
region->ex_end = e;
- }
+#else
+ dprintk(XENLOG_ERR, LIVEPATCH "%s: We don't support .ex_table!\n",
+ elf->name);
+ return -EOPNOTSUPP;
#endif
+ }
return 0;
}
--
2.4.11
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-09-06 20:36 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 13:37 [PATCH v2] Livepatch for ARM 64 and 32 Konrad Rzeszutek Wilk
2016-08-25 13:37 ` [PATCH v2 01/20] livepatch: Bubble up sanity checks on Elf relocs Konrad Rzeszutek Wilk
2016-08-25 14:48 ` Jan Beulich
2016-09-06 17:13 ` Konrad Rzeszutek Wilk
2016-08-25 13:37 ` [PATCH v2 02/20] x86/arm: Make 'make debug' work properly Konrad Rzeszutek Wilk
2016-08-25 13:37 ` [PATCH v2 03/20] x86/arm64: Expose the ALT_[ORIG|REPL]_PTR macros to header files Konrad Rzeszutek Wilk
2016-08-31 15:43 ` Julien Grall
2016-08-25 13:37 ` [PATCH v2 04/20] alternatives: x86 rename and change parameters on ARM Konrad Rzeszutek Wilk
2016-08-25 13:55 ` Andrew Cooper
2016-08-31 15:44 ` Julien Grall
2016-08-25 13:37 ` [PATCH v2 05/20] arm64/alternatives: Make it possible to patch outside of hypervisor Konrad Rzeszutek Wilk
2016-08-31 15:54 ` Julien Grall
2016-08-25 13:37 ` [PATCH v2 06/20] arm/alternative: Use _start instead of _stext Konrad Rzeszutek Wilk
2016-08-25 13:37 ` [PATCH v2 07/20] arm/x86: Add ALTERNATIVE and HAS_EX_TABLE Konrad Rzeszutek Wilk
2016-08-25 13:58 ` Andrew Cooper
2016-08-25 14:02 ` Julien Grall
2016-08-25 14:09 ` Andrew Cooper
2016-08-25 14:56 ` Jan Beulich
2016-09-06 20:36 ` Konrad Rzeszutek Wilk [this message]
2016-09-06 20:40 ` Konrad Rzeszutek Wilk
2016-08-25 14:54 ` Jan Beulich
2016-09-06 20:16 ` Konrad Rzeszutek Wilk
2016-09-07 8:17 ` Jan Beulich
2016-08-25 13:37 ` [PATCH v2 08/20] x86: change modify_xen_mappings to return error Konrad Rzeszutek Wilk
2016-08-25 13:53 ` Andrew Cooper
2016-08-25 13:37 ` [PATCH v2 09/20] arm/mm: Introduce modify_xen_mappings Konrad Rzeszutek Wilk
2016-09-01 13:04 ` Julien Grall
2016-08-25 13:37 ` [PATCH v2 10/20] arm64/insn: introduce aarch64_insn_gen_{nop|branch_imm}() helper functions Konrad Rzeszutek Wilk
2016-09-01 13:10 ` Julien Grall
2016-08-25 13:37 ` [PATCH v2 11/20] arm/arm64: Update comment about VA layout Konrad Rzeszutek Wilk
2016-09-01 13:11 ` Julien Grall
2016-08-25 13:37 ` [PATCH v2 12/20] x86, arm: Change arch_livepatch_quiesce() decleration Konrad Rzeszutek Wilk
2016-08-25 13:59 ` Andrew Cooper
2016-09-01 13:13 ` Julien Grall
2016-08-25 13:37 ` [PATCH v2 13/20] livepatch: Initial ARM64 support Konrad Rzeszutek Wilk
2016-08-25 15:02 ` Jan Beulich
2016-09-07 2:58 ` Konrad Rzeszutek Wilk
2016-09-01 14:16 ` Julien Grall
2016-09-07 0:31 ` Konrad Rzeszutek Wilk
2016-09-07 3:33 ` Konrad Rzeszutek Wilk
2016-09-07 10:43 ` Julien Grall
2016-09-07 15:20 ` Konrad Rzeszutek Wilk
2016-09-07 10:41 ` Julien Grall
2016-08-25 13:37 ` [PATCH v2 14/20] livepatch: ARM 32|64: Ignore mapping symbols: $[d, a, x, t] Konrad Rzeszutek Wilk
2016-08-25 14:03 ` Andrew Cooper
2016-09-01 14:48 ` Julien Grall
2016-09-06 18:57 ` Konrad Rzeszutek Wilk
2016-08-25 13:37 ` [PATCH v2 15/20] livepatch: Move test-cases to common Konrad Rzeszutek Wilk
2016-08-25 15:05 ` Jan Beulich
2016-09-06 17:16 ` Konrad Rzeszutek Wilk
2016-09-07 8:28 ` Jan Beulich
2016-09-06 17:17 ` Konrad Rzeszutek Wilk
2016-08-25 13:37 ` [PATCH v2 16/20] livepatch: tests: Make them compile under ARM64 Konrad Rzeszutek Wilk
2016-08-25 13:37 ` [PATCH v2 17/20] xen/arm32: Add an helper to invalidate all instruction caches Konrad Rzeszutek Wilk
2016-08-25 13:37 ` [PATCH v2 18/20] xen/arm32/livepatch: Add BPICALLIS to " Konrad Rzeszutek Wilk
2016-09-01 15:13 ` Julien Grall
2016-09-01 20:23 ` Konrad Rzeszutek Wilk
2016-09-06 19:39 ` Konrad Rzeszutek Wilk
2016-08-25 13:37 ` [PATCH v2 19/20] livepatch/elf: Adjust section aligment to word Konrad Rzeszutek Wilk
2016-08-25 15:11 ` Jan Beulich
2016-09-01 15:27 ` Julien Grall
2016-09-06 21:18 ` Konrad Rzeszutek Wilk
2016-09-07 8:24 ` Jan Beulich
2016-08-25 13:37 ` [PATCH v2 20/20] livepatch: ARM32 support Konrad Rzeszutek Wilk
2016-09-08 10:34 ` Konrad Rzeszutek Wilk
2016-08-31 14:49 ` [PATCH v2] Livepatch for ARM 64 and 32 Julien Grall
2016-08-31 15:06 ` Konrad Rzeszutek Wilk
2016-08-31 15:09 ` Julien Grall
2016-08-31 15:24 ` Andrew Cooper
2016-08-31 15:40 ` Julien Grall
2016-08-31 15:54 ` Jan Beulich
2016-09-07 4:05 ` Konrad Rzeszutek Wilk
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=20160906203640.GB7062@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=cardoe@cardoe.com \
--cc=julien.grall@arm.com \
--cc=ross.lagerwall@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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).