From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: xen-devel@lists.xenproject.org, konrad@kernel.org,
ross.lagerwall@citrix.com
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <jbeulich@suse.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH v3 4/9] livepatch: Sync cache of build-id before using it first time.
Date: Sun, 14 Aug 2016 17:52:21 -0400 [thread overview]
Message-ID: <1471211546-2235-5-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1471211546-2235-1-git-send-email-konrad.wilk@oracle.com>
We don't print at bootup time the build-id. The reason is
that xen_build_init and livepatch_init are both __initcall
type routines. This meant that when livepatch_init called
xen_build_id, it would return -ENODATA as build_id_len was
not setup yet (b/c xen_build_init would be called later).
We fix this by calling xen_build_init in livepatch_init which
allows us to print the build-id of the hypervisor.
We also keep xen_build_init as __initcall because build-id
can be built without livepatching being enabled (so
no livepatch_init being called).
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
v2: Move xen_build_init in version.h instead of livepatch.h
---
xen/common/livepatch.c | 1 +
xen/common/version.c | 6 +++++-
xen/include/xen/version.h | 1 +
3 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index 17427b1..28a400f 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -1566,6 +1566,7 @@ static int __init livepatch_init(void)
const void *binary_id;
unsigned int len;
+ xen_build_init();
if ( !xen_build_id(&binary_id, &len) )
printk(XENLOG_INFO LIVEPATCH ": build-id: %*phN\n", len, binary_id);
diff --git a/xen/common/version.c b/xen/common/version.c
index 0f96849..4114664 100644
--- a/xen/common/version.c
+++ b/xen/common/version.c
@@ -117,11 +117,15 @@ int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,
return 0;
}
-static int __init xen_build_init(void)
+int __init xen_build_init(void)
{
const Elf_Note *n = __note_gnu_build_id_start;
unsigned int sz;
+ /* We may have been called already. */
+ if ( build_id_len )
+ return 0;
+
/* --build-id invoked with wrong parameters. */
if ( __note_gnu_build_id_end <= &n[0] )
return -ENODATA;
diff --git a/xen/include/xen/version.h b/xen/include/xen/version.h
index 97c247a..7a4b371 100644
--- a/xen/include/xen/version.h
+++ b/xen/include/xen/version.h
@@ -21,6 +21,7 @@ int xen_build_id(const void **p, unsigned int *len);
#ifdef BUILD_ID
int xen_build_id_check(const Elf_Note *n, unsigned int n_sz,
const void **p, unsigned int *len);
+int xen_build_init(void);
#endif
#endif /* __XEN_VERSION_H__ */
--
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-08-14 21:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-14 21:52 [PATCH v3] Livepatch fixes and features for v4.8 Konrad Rzeszutek Wilk
2016-08-14 21:52 ` [PATCH v3 1/9] livepatch: Clear .bss when payload is reverted Konrad Rzeszutek Wilk
2016-08-15 10:27 ` Jan Beulich
2016-08-15 14:29 ` Konrad Rzeszutek Wilk
2016-08-15 15:10 ` Jan Beulich
2016-08-19 8:37 ` Ross Lagerwall
2016-08-19 8:42 ` Jan Beulich
2016-08-14 21:52 ` [PATCH v3 2/9] livepatch: Deal with payloads without any .text Konrad Rzeszutek Wilk
2016-08-15 10:28 ` Jan Beulich
2016-08-19 9:31 ` Ross Lagerwall
2016-08-14 21:52 ` [PATCH v3 3/9] version/livepatch: Move xen_build_id_check to version.h Konrad Rzeszutek Wilk
2016-08-15 10:35 ` Jan Beulich
2016-08-19 9:29 ` Ross Lagerwall
2016-08-14 21:52 ` Konrad Rzeszutek Wilk [this message]
2016-08-15 10:38 ` [PATCH v3 4/9] livepatch: Sync cache of build-id before using it first time Jan Beulich
2016-08-15 10:46 ` Andrew Cooper
2016-08-15 14:33 ` Konrad Rzeszutek Wilk
2016-08-14 21:52 ` [PATCH v3 5/9] livepatch: Move code from prepare_payload to own routine Konrad Rzeszutek Wilk
2016-08-15 10:41 ` Jan Beulich
2016-08-19 9:37 ` Ross Lagerwall
2016-08-14 21:52 ` [PATCH v3 6/9] livepatch: Add parsing for the symbol+0x<offset>/<len> Konrad Rzeszutek Wilk
2016-08-15 10:53 ` Jan Beulich
2016-08-15 14:35 ` Konrad Rzeszutek Wilk
2016-08-15 15:12 ` Jan Beulich
2016-08-15 15:21 ` Konrad Rzeszutek Wilk
2016-08-14 21:52 ` [PATCH v3 7/9] livepatch: NOP if func->new_[addr, size] is zero Konrad Rzeszutek Wilk
2016-08-15 10:59 ` Jan Beulich
2016-08-15 14:38 ` Konrad Rzeszutek Wilk
2016-08-14 21:52 ` [PATCH v3 8/9] symbols: Generate an xen-sym.map Konrad Rzeszutek Wilk
2016-08-15 11:02 ` Jan Beulich
2016-08-14 21:52 ` [PATCH v3 9/9] livepach: Add .livepatch.hooks functions and test-case Konrad Rzeszutek Wilk
2016-08-15 11:15 ` Jan Beulich
2016-08-15 14:46 ` Konrad Rzeszutek Wilk
2016-08-15 15:17 ` Jan Beulich
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=1471211546-2235-5-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).