@@ -1,9 +1,9 @@
-xsplice-build
+livepatch-build
=============
-xsplice-build is a tool for building xSplice patches from source code
+livepatch-build is a tool for building LivePatch patches from source code
patches. It takes as input, a Xen tree and a patch and outputs an
-`.xsplice` module containing containing the live patch.
+`.livepatch` module containing containing the live patch.
Quick start
-----------
@@ -15,14 +15,14 @@ $ cd ~/src/xen
$ git reset --hard
$ git clean -x -f -d
$ git checkout 346d4545569928b652c40c7815c1732676f8587c^
-$ cd ~/src/xsplice-build
+$ cd ~/src/livepatch-build
$ wget -q 'http://xenbits.xen.org/xsa/xsa106.patch'
-$ ./xsplice-build --xen-debug -s ~/src/xen -p xsa106.patch -o out
-Building xSplice patch: xsa106
+$ ./livepatch-build --xen-debug -s ~/src/xen -p xsa106.patch -o out
+Building LivePatch patch: xsa106
Xen directory: /home/ross/src/xen
-Patch file: /home/ross/src/xsplice-build/xsa106.patch
-Output directory: /home/ross/src/xsplice-build/out
+Patch file: /home/ross/src/livepatch-build/xsa106.patch
+Output directory: /home/ross/src/livepatch-build/out
================================================
Testing patch file...
@@ -32,10 +32,10 @@ Unapply patch and build with 4 CPU(s)...
Extracting new and modified ELF sections...
Processing xen/arch/x86/x86_emulate.o
Creating patch module...
-xsa106.xsplice created successfully
+xsa106.livepatch created successfully
-$ ls -lh out/xsa106.xsplice
--rw-rw-r--. 1 ross ross 418K Oct 12 12:02 out/xsa106.xsplice
+$ ls -lh out/xsa106.livepatch
+-rw-rw-r--. 1 ross ross 418K Oct 12 12:02 out/xsa106.livepatch
```
Project Status
@@ -43,7 +43,7 @@ Project Status
This is prototype code:
* There's no way to apply built patches
* Patches cannot be built for some source patches
- * The output format does not correspond to the latest xSplice design
+ * The output format does not correspond to the latest LivePatch design
With no source patch modifications, live patches can be built for every
XSA that applies to x86 back to XSA-90 except for XSA-97, XSA-111,
@@ -51,7 +51,7 @@ XSA-112, and XSA-114 (83% success rate).
License
-------
-xSplice is under the GPLv2 license.
+LivePatch is under the GPLv2 license.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
@@ -116,7 +116,7 @@ struct kpatch_elf {
#define PATCH_INSN_SIZE 5
-struct xsplice_patch_func {
+struct livepatch_patch_func {
char *name;
unsigned long new_addr;
unsigned long old_addr;
@@ -860,7 +860,7 @@ static void kpatch_mark_ignored_functions_same(struct kpatch_elf *kelf)
struct section *sec;
struct rela *rela;
- sec = find_section_by_name(&kelf->sections, ".xsplice.ignore.functions");
+ sec = find_section_by_name(&kelf->sections, ".livepatch.ignore.functions");
if (!sec)
return;
@@ -887,7 +887,7 @@ static void kpatch_mark_ignored_sections(struct kpatch_elf *kelf)
struct rela *rela;
char *name;
- sec = find_section_by_name(&kelf->sections, ".xsplice.ignore.sections");
+ sec = find_section_by_name(&kelf->sections, ".livepatch.ignore.sections");
if (!sec)
return;
@@ -1297,10 +1297,10 @@ static void kpatch_include_hook_elements(struct kpatch_elf *kelf)
/* include load/unload sections */
list_for_each_entry(sec, &kelf->sections, list) {
- if (!strcmp(sec->name, ".xsplice.hooks.load") ||
- !strcmp(sec->name, ".xsplice.hooks.unload") ||
- !strcmp(sec->name, ".rela.xsplice.hooks.load") ||
- !strcmp(sec->name, ".rela.xsplice.hooks.unload")) {
+ if (!strcmp(sec->name, ".livepatch.hooks.load") ||
+ !strcmp(sec->name, ".livepatch.hooks.unload") ||
+ !strcmp(sec->name, ".rela.livepatch.hooks.load") ||
+ !strcmp(sec->name, ".rela.livepatch.hooks.unload")) {
sec->include = 1;
if (is_rela_section(sec)) {
/* include hook dependencies */
@@ -1325,8 +1325,8 @@ static void kpatch_include_hook_elements(struct kpatch_elf *kelf)
* used by the kpatch_[load|unload]() macros.
*/
list_for_each_entry(sym, &kelf->symbols, list)
- if (!strcmp(sym->name, "xsplice_load_data") ||
- !strcmp(sym->name, "xsplice_unload_data"))
+ if (!strcmp(sym->name, "livepatch_load_data") ||
+ !strcmp(sym->name, "livepatch_unload_data"))
sym->include = 0;
}
@@ -1469,7 +1469,7 @@ static void kpatch_create_strings_elements(struct kpatch_elf *kelf)
/* allocate section resources */
ALLOC_LINK(sec, &kelf->sections);
- sec->name = ".xsplice.strings";
+ sec->name = ".livepatch.strings";
/* set data */
sec->data = malloc(sizeof(*sec->data));
@@ -1490,7 +1490,7 @@ static void kpatch_create_strings_elements(struct kpatch_elf *kelf)
sym->sym.st_info = GELF_ST_INFO(STB_LOCAL, STT_SECTION);
sym->type = STT_SECTION;
sym->bind = STB_LOCAL;
- sym->name = ".xsplice.strings";
+ sym->name = ".livepatch.strings";
}
static void kpatch_build_strings_section_data(struct kpatch_elf *kelf)
@@ -1500,7 +1500,7 @@ static void kpatch_build_strings_section_data(struct kpatch_elf *kelf)
int size;
char *strtab;
- sec = find_section_by_name(&kelf->sections, ".xsplice.strings");
+ sec = find_section_by_name(&kelf->sections, ".livepatch.strings");
if (!sec)
ERROR("can't find .kpatch.strings");
@@ -1560,7 +1560,7 @@ static char *mangle_local_symbol(char *filename, char *symname)
* Rename local symbols to the filename#symbol format used by Xen's "special"
* symbol table.
*/
-static void xsplice_rename_local_symbols(struct kpatch_elf *kelf, char *hint)
+static void livepatch_rename_local_symbols(struct kpatch_elf *kelf, char *hint)
{
struct symbol *sym;
@@ -1638,7 +1638,7 @@ static struct section *create_section_pair(struct kpatch_elf *kelf,
return sec;
}
-static void xsplice_create_patches_sections(struct kpatch_elf *kelf,
+static void livepatch_create_patches_sections(struct kpatch_elf *kelf,
struct lookup_table *table,
char *hint, int resolve)
{
@@ -1647,7 +1647,7 @@ static void xsplice_create_patches_sections(struct kpatch_elf *kelf,
struct symbol *sym, *strsym;
struct rela *rela;
struct lookup_result result;
- struct xsplice_patch_func *funcs;
+ struct livepatch_patch_func *funcs;
char *funcname;
/* count patched functions */
@@ -1657,14 +1657,14 @@ static void xsplice_create_patches_sections(struct kpatch_elf *kelf,
nr++;
/* create text/rela section pair */
- sec = create_section_pair(kelf, ".xsplice.funcs", sizeof(*funcs), nr);
+ sec = create_section_pair(kelf, ".livepatch.funcs", sizeof(*funcs), nr);
relasec = sec->rela;
funcs = sec->data->d_buf;
/* lookup strings symbol */
- strsym = find_symbol_by_name(&kelf->symbols, ".xsplice.strings");
+ strsym = find_symbol_by_name(&kelf->symbols, ".livepatch.strings");
if (!strsym)
- ERROR("can't find .xsplice.strings symbol");
+ ERROR("can't find .livepatch.strings symbol");
/* populate sections */
index = 0;
@@ -1713,7 +1713,7 @@ static void xsplice_create_patches_sections(struct kpatch_elf *kelf,
rela->addend = 0;
rela->offset = index * sizeof(*funcs);
rela->offset = index * sizeof(*funcs) +
- offsetof(struct xsplice_patch_func, new_addr);
+ offsetof(struct livepatch_patch_func, new_addr);
/*
* Add a relocation that will populate
@@ -1724,7 +1724,7 @@ static void xsplice_create_patches_sections(struct kpatch_elf *kelf,
rela->type = R_X86_64_64;
rela->addend = offset_of_string(&kelf->strings, funcname);
rela->offset = index * sizeof(*funcs) +
- offsetof(struct xsplice_patch_func, name);
+ offsetof(struct livepatch_patch_func, name);
index++;
}
@@ -1965,12 +1965,12 @@ int main(int argc, char *argv[])
log_debug("Create strings elements\n");
kpatch_create_strings_elements(kelf_out);
log_debug("Create patches sections\n");
- xsplice_create_patches_sections(kelf_out, lookup, hint,
+ livepatch_create_patches_sections(kelf_out, lookup, hint,
arguments.resolve);
kpatch_build_strings_section_data(kelf_out);
log_debug("Rename local symbols\n");
- xsplice_rename_local_symbols(kelf_out, hint);
+ livepatch_rename_local_symbols(kelf_out, hint);
/*
* At this point, the set of output sections and symbols is
similarity index 90%
rename from xsplice-build
rename to livepatch-build
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# xsplice build script
+# livepatch build script
#
# Copyright (C) 2014 Seth Jennings <sjenning@redhat.com>
# Copyright (C) 2013,2014 Josh Poimboeuf <jpoimboe@redhat.com>
@@ -19,7 +19,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-# This script takes a Xen tree, and a patch and outputs an xsplice
+# This script takes a Xen tree, and a patch and outputs an livepatch
# module intended to patch Xen at runtime.
# Large amounts of this script are taken from kpatch's kpatch-build
# script.
@@ -39,7 +39,7 @@ warn() {
die() {
if [[ -z $1 ]]; then
- msg="xSplice build failed"
+ msg="LivePatch build failed"
else
msg="$1"
fi
@@ -78,10 +78,10 @@ function build_special()
cd "${SRCDIR}" || die
# Capture .o files from the patched build
- export CROSS_COMPILE="${SCRIPTDIR}/xsplice-gcc "
- export XSPLICE_BUILD_DIR="$(pwd)/"
- export XSPLICE_CAPTURE_DIR="$OUTPUT/${name}"
- mkdir -p "$XSPLICE_CAPTURE_DIR"
+ export CROSS_COMPILE="${SCRIPTDIR}/livepatch-gcc "
+ export LIVEPATCH_BUILD_DIR="$(pwd)/"
+ export LIVEPATCH_CAPTURE_DIR="$OUTPUT/${name}"
+ mkdir -p "$LIVEPATCH_CAPTURE_DIR"
# Build with special GCC flags
cd "${SRCDIR}/xen" || die
@@ -89,8 +89,8 @@ function build_special()
make "-j$CPUS" debug="$XEN_DEBUG" &> "${OUTPUT}/build_${name}_compile.log" || die
sed -i 's/CFLAGS += -nostdinc -ffunction-sections -fdata-sections/CFLAGS += -nostdinc/' Rules.mk
- unset XSPLICE_BUILD_DIR
- unset XSPLICE_CAPTURE_DIR
+ unset LIVEPATCH_BUILD_DIR
+ unset LIVEPATCH_CAPTURE_DIR
}
function create_patch()
@@ -142,15 +142,15 @@ function create_patch()
echo "Creating patch module..."
if [ -z "$PRELINK" ]; then
- ld -r -o "${PATCHNAME}.xsplice" --build-id=sha1 $(find output -type f -name "*.o") || die
- chmod +x "${PATCHNAME}.xsplice"
+ ld -r -o "${PATCHNAME}.livepatch" --build-id=sha1 $(find output -type f -name "*.o") || die
+ chmod +x "${PATCHNAME}.livepatch"
else
ld -r -o output.o --build-id=sha1 $(find output -type f -name "*.o") || die
- "${SCRIPTDIR}"/prelink $debugopt output.o "${PATCHNAME}.xsplice" "$XENSYMS" &>> "${OUTPUT}/prelink.log" || die
+ "${SCRIPTDIR}"/prelink $debugopt output.o "${PATCHNAME}.livepatch" "$XENSYMS" &>> "${OUTPUT}/prelink.log" || die
fi
- objcopy --add-section .xsplice.depends=depends.bin "${PATCHNAME}.xsplice"
- objcopy --set-section-flags .xsplice.depends=alloc,readonly "${PATCHNAME}.xsplice"
+ objcopy --add-section .livepatch.depends=depends.bin "${PATCHNAME}.livepatch"
+ objcopy --set-section-flags .livepatch.depends=alloc,readonly "${PATCHNAME}.livepatch"
}
usage() {
@@ -247,7 +247,7 @@ OUTPUT="$(readlink -m -- "$outputarg")"
PATCHNAME=$(make_patch_name "${PATCHFILE}")
-echo "Building xSplice patch: ${PATCHNAME}"
+echo "Building LivePatch patch: ${PATCHNAME}"
echo
echo "Xen directory: ${SRCDIR}"
echo "Patch file: ${PATCHFILE}"
@@ -282,5 +282,5 @@ if [ "${SKIP}" != "diff" ]; then
cd "${OUTPUT}" || die
create_patch
- echo "${PATCHNAME}.xsplice created successfully"
+ echo "${PATCHNAME}.livepatch created successfully"
fi
similarity index 80%
rename from xsplice-gcc
rename to livepatch-gcc
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# xsplice build script
+# livepatch build script
#
# Copyright (C) 2015 Ross Lagerwall <ross.lagerwall@citrix.com>
#
@@ -39,9 +39,9 @@ if [[ "$TOOLCHAINCMD" = "gcc" ]] ; then
;;
*.o)
path="$(pwd)/$(dirname $obj)"
- dir="${path#$XSPLICE_BUILD_DIR}"
- if [ -n "$XSPLICE_CAPTURE_DIR" -a -d "$XSPLICE_CAPTURE_DIR" ]; then
- echo "$dir/$obj" >> "${XSPLICE_CAPTURE_DIR}/changed_objs"
+ dir="${path#$LIVEPATCH_BUILD_DIR}"
+ if [ -n "$LIVEPATCH_CAPTURE_DIR" -a -d "$LIVEPATCH_CAPTURE_DIR" ]; then
+ echo "$dir/$obj" >> "${LIVEPATCH_CAPTURE_DIR}/changed_objs"
keep=yes
fi
break
@@ -59,8 +59,8 @@ fi
ret="$?"
if [[ "$keep" = "yes" ]] ; then
- mkdir -p "$(dirname $XSPLICE_CAPTURE_DIR/$dir/$obj)"
- cp "$obj" "$XSPLICE_CAPTURE_DIR/$dir/$obj"
+ mkdir -p "$(dirname $LIVEPATCH_CAPTURE_DIR/$dir/$obj)"
+ cp "$obj" "$LIVEPATCH_CAPTURE_DIR/$dir/$obj"
fi
exit "$ret"
@@ -40,7 +40,7 @@ char *childobj;
enum loglevel loglevel = NORMAL;
/* Resolve symbols using xen-syms */
-void xsplice_resolve_symbols(struct kpatch_elf *kelf,
+void livepatch_resolve_symbols(struct kpatch_elf *kelf,
struct lookup_table *table)
{
struct symbol *sym;
@@ -157,7 +157,7 @@ int main(int argc, char *argv[])
lookup = lookup_open(arguments.args[2]);
log_debug("Resolve symbols\n");
- xsplice_resolve_symbols(kelf, lookup);
+ livepatch_resolve_symbols(kelf, lookup);
/*
* Update rela section headers and rebuild the rela section data
s/xsplice/livepatch/ s/XSPLICE/LIVEPATCH/ s/xSplice/LivePatch/ Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> --- README.md | 26 ++++++++++++------------- common.h | 2 +- create-diff-object.c | 42 ++++++++++++++++++++-------------------- xsplice-build => livepatch-build | 32 +++++++++++++++--------------- xsplice-gcc => livepatch-gcc | 12 ++++++------ prelink.c | 4 ++-- 6 files changed, 59 insertions(+), 59 deletions(-) rename xsplice-build => livepatch-build (90%) rename xsplice-gcc => livepatch-gcc (80%)