From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xenproject.org, konrad@kernel.org,
ross.lagerwall@citrix.com, andrew.cooper3@citrix.com
Cc: Jan Beulich <jbeulich@suse.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH v6 2/6] livepatch: Add limit of 2MB to payload .bss sections.
Date: Fri, 16 Sep 2016 11:29:10 -0400 [thread overview]
Message-ID: <1474039754-25816-3-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1474039754-25816-1-git-send-email-konrad.wilk@oracle.com>
The initial patch: 11ff40fa7bb5fdcc69a58d0fec49c904ffca4793
"xen/xsplice: Hypervisor implementation of XEN_XSPLICE_op" caps the
size of the binary at 2MB. We follow that in capping the size
of the .BSSes to be at maximum 2MB.
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
v5: Initial submission. Came about from conversation about
"livepatch: Clear .bss when payload is reverted"
- Use only one sh_flags comparison instead of two.
- And check for the _right_ combination (WA).
v6: Remove the logging
Move the MB(2) to a #define in the header file.
Add the newline after the addition in livepatch_elf.c.
Added Reviewed-by from Ross.
---
xen/common/livepatch_elf.c | 4 ++++
xen/include/xen/livepatch.h | 2 ++
2 files changed, 6 insertions(+)
diff --git a/xen/common/livepatch_elf.c b/xen/common/livepatch_elf.c
index cda9b27..79c290e 100644
--- a/xen/common/livepatch_elf.c
+++ b/xen/common/livepatch_elf.c
@@ -86,6 +86,10 @@ static int elf_resolve_sections(struct livepatch_elf *elf, const void *data)
delta < sizeof(Elf_Ehdr) ? "at ELF header" : "is past end");
return -EINVAL;
}
+ else if ( (sec[i].sec->sh_flags & (SHF_WRITE | SHF_ALLOC)) &&
+ sec[i].sec->sh_type == SHT_NOBITS &&
+ sec[i].sec->sh_size > BSS_MAX_SIZE )
+ return -EINVAL;
sec[i].data = data + delta;
/* Name is populated in elf_resolve_section_names. */
diff --git a/xen/include/xen/livepatch.h b/xen/include/xen/livepatch.h
index 243e240..46b9fc2 100644
--- a/xen/include/xen/livepatch.h
+++ b/xen/include/xen/livepatch.h
@@ -30,6 +30,8 @@ struct xen_sysctl_livepatch_op;
#define ELF_LIVEPATCH_FUNC ".livepatch.funcs"
#define ELF_LIVEPATCH_DEPENDS ".livepatch.depends"
#define ELF_BUILD_ID_NOTE ".note.gnu.build-id"
+/* Arbitrary limit. */
+#define BSS_MAX_SIZE MB(2)
struct livepatch_symbol {
const char *name;
--
2.5.5
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-09-16 15:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 15:29 [PATCH v6] Livepatch fixes and general features for Xen4.8 Konrad Rzeszutek Wilk
2016-09-16 15:29 ` [PATCH v6 1/6] livepatch: Disallow applying after an revert Konrad Rzeszutek Wilk
2016-09-19 8:40 ` Jan Beulich
2016-09-21 12:47 ` Ross Lagerwall
2016-09-16 15:29 ` Konrad Rzeszutek Wilk [this message]
2016-09-19 8:43 ` [PATCH v6 2/6] livepatch: Add limit of 2MB to payload .bss sections Jan Beulich
2016-09-16 15:29 ` [PATCH v6 3/6] livepatch: NOP if func->new_addr is zero Konrad Rzeszutek Wilk
2016-09-19 8:59 ` Jan Beulich
2016-09-19 16:11 ` Konrad Rzeszutek Wilk
2016-09-19 16:31 ` Jan Beulich
2016-09-19 17:02 ` Konrad Rzeszutek Wilk
2016-09-19 20:44 ` Konrad Rzeszutek Wilk
2016-09-20 6:58 ` Jan Beulich
2016-09-19 9:21 ` Jan Beulich
2016-09-21 13:21 ` Ross Lagerwall
2016-09-16 15:29 ` [PATCH v6 4/6] livepach: Add .livepatch.hooks functions and test-case Konrad Rzeszutek Wilk
2016-09-16 15:29 ` [PATCH v6 5/6] livepatch/tests: Make .livepatch.depends be read-only Konrad Rzeszutek Wilk
2016-09-21 12:47 ` Ross Lagerwall
2016-09-16 15:29 ` [PATCH v6 6/6] livepatch/tests: Move the .name value to .rodata Konrad Rzeszutek Wilk
2016-09-19 9:06 ` Jan Beulich
2016-09-21 12:49 ` Ross Lagerwall
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=1474039754-25816-3-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=konrad@kernel.org \
--cc=ross.lagerwall@citrix.com \
--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).