Xen-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Pawel Wieczorkiewicz <wipawel@amazon.de>
To: <xen-devel@lists.xen.org>, <xen-devel@lists.xenproject.org>
Cc: wipawel@amazon.com, "Wei Liu" <wl@xen.org>,
	"Ross Lagerwall" <ross.lagerwall@citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@oracle.com>,
	mpohlack@amazon.com, "Pawel Wieczorkiewicz" <wipawel@amazon.de>,
	"Jan Beulich" <jbeulich@suse.com>,
	"Roger Pau Monné" <roger.pau@citrix.com>
Subject: [Xen-devel] [PATCH 08/14] livepatch: always print XENLOG_ERR information
Date: Wed, 21 Aug 2019 08:19:25 +0000
Message-ID: <20190821081931.90887-9-wipawel@amazon.de> (raw)
In-Reply-To: <20190821081931.90887-1-wipawel@amazon.de>

A lot of legitimate error messages were hidden behind debug printk
only. Most of these messages can be triggered by loading a malformed
hotpatch payload and are priceless for understanding issues with such
payloads.
Thus, always display all relevant XENLOG_ERR messages.

Signed-off-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
Reviewed-by: Amit Shah <aams@amazon.de>
Reviewed-by: Martin Mazein <amazein@amazon.de>
Reviewed-by: Bjoern Doebel <doebel@amazon.de>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
---
 xen/arch/x86/livepatch.c | 16 ++++++++--------
 xen/common/livepatch.c   | 38 +++++++++++++++++++-------------------
 2 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/livepatch.c b/xen/arch/x86/livepatch.c
index 406eb910cc..436ee40fe1 100644
--- a/xen/arch/x86/livepatch.c
+++ b/xen/arch/x86/livepatch.c
@@ -126,7 +126,7 @@ int arch_livepatch_verify_elf(const struct livepatch_elf *elf)
          hdr->e_ident[EI_CLASS] != ELFCLASS64 ||
          hdr->e_ident[EI_DATA] != ELFDATA2LSB )
     {
-        dprintk(XENLOG_ERR, LIVEPATCH "%s: Unsupported ELF Machine type!\n",
+        printk(XENLOG_ERR LIVEPATCH "%s: Unsupported ELF Machine type!\n",
                 elf->name);
         return -EOPNOTSUPP;
     }
@@ -152,7 +152,7 @@ int arch_livepatch_perform_rel(struct livepatch_elf *elf,
                                const struct livepatch_elf_sec *base,
                                const struct livepatch_elf_sec *rela)
 {
-    dprintk(XENLOG_ERR, LIVEPATCH "%s: SHT_REL relocation unsupported\n",
+    printk(XENLOG_ERR LIVEPATCH "%s: SHT_REL relocation unsupported\n",
             elf->name);
     return -EOPNOTSUPP;
 }
@@ -172,19 +172,19 @@ int arch_livepatch_perform_rela(struct livepatch_elf *elf,
 
         if ( symndx == STN_UNDEF )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: Encountered STN_UNDEF\n",
+            printk(XENLOG_ERR LIVEPATCH "%s: Encountered STN_UNDEF\n",
                     elf->name);
             return -EOPNOTSUPP;
         }
         else if ( symndx >= elf->nsym )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: Relative relocation wants symbol@%u which is past end!\n",
+            printk(XENLOG_ERR LIVEPATCH "%s: Relative relocation wants symbol@%u which is past end!\n",
                     elf->name, symndx);
             return -EINVAL;
         }
         else if ( !elf->sym[symndx].sym )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: No symbol@%u\n",
+            printk(XENLOG_ERR LIVEPATCH "%s: No symbol@%u\n",
                     elf->name, symndx);
             return -EINVAL;
         }
@@ -222,14 +222,14 @@ int arch_livepatch_perform_rela(struct livepatch_elf *elf,
             *(int32_t *)dest = val;
             if ( (int64_t)val != *(int32_t *)dest )
             {
-                dprintk(XENLOG_ERR, LIVEPATCH "%s: Overflow in relocation %u in %s for %s!\n",
+                printk(XENLOG_ERR LIVEPATCH "%s: Overflow in relocation %u in %s for %s!\n",
                         elf->name, i, rela->name, base->name);
                 return -EOVERFLOW;
             }
             break;
 
         default:
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: Unhandled relocation %lu\n",
+            printk(XENLOG_ERR LIVEPATCH "%s: Unhandled relocation %lu\n",
                     elf->name, ELF64_R_TYPE(r->r_info));
             return -EOPNOTSUPP;
         }
@@ -238,7 +238,7 @@ int arch_livepatch_perform_rela(struct livepatch_elf *elf,
     return 0;
 
  bad_offset:
-    dprintk(XENLOG_ERR, LIVEPATCH "%s: Relative relocation offset is past %s section!\n",
+    printk(XENLOG_ERR LIVEPATCH "%s: Relative relocation offset is past %s section!\n",
             elf->name, base->name);
     return -EINVAL;
 }
diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
index c4a107d91c..585ec9819a 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -217,7 +217,7 @@ static int resolve_old_address(struct livepatch_func *f,
         f->old_addr = (void *)livepatch_symbols_lookup_by_name(f->name);
         if ( !f->old_addr )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: Could not resolve old address of %s\n",
+            printk(XENLOG_ERR LIVEPATCH "%s: Could not resolve old address of %s\n",
                     elf->name, f->name);
             return -ENOENT;
         }
@@ -336,7 +336,7 @@ static int move_payload(struct payload *payload, struct livepatch_elf *elf)
     text_buf = vmalloc_xen(size * PAGE_SIZE);
     if ( !text_buf )
     {
-        dprintk(XENLOG_ERR, LIVEPATCH "%s: Could not allocate memory for payload!\n",
+        printk(XENLOG_ERR LIVEPATCH "%s: Could not allocate memory for payload!\n",
                 elf->name);
         rc = -ENOMEM;
         goto out;
@@ -434,7 +434,7 @@ static bool section_ok(const struct livepatch_elf *elf,
 
     if ( sec->sec->sh_size % sz )
     {
-        dprintk(XENLOG_ERR, LIVEPATCH "%s: Wrong size %"PRIuElfWord" of %s (must be multiple of %zu)\n",
+        printk(XENLOG_ERR LIVEPATCH "%s: Wrong size %"PRIuElfWord" of %s (must be multiple of %zu)\n",
                 elf->name, sec->sec->sh_size, sec->name, sz);
         return false;
     }
@@ -456,7 +456,7 @@ static int check_xen_build_id(const struct payload *payload)
         return rc;
 
     if ( payload->xen_dep.len != len || memcmp(id, payload->xen_dep.p, len) ) {
-        dprintk(XENLOG_ERR, "%s%s: check against hypervisor build-id failed!\n",
+        printk(XENLOG_ERR LIVEPATCH "%s%s: check against hypervisor build-id failed!\n",
                 LIVEPATCH, payload->name);
         return -EINVAL;
     }
@@ -479,21 +479,21 @@ static int check_special_sections(const struct livepatch_elf *elf)
         sec = livepatch_elf_sec_by_name(elf, names[i]);
         if ( !sec )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: %s is missing!\n",
+            printk(XENLOG_ERR LIVEPATCH "%s: %s is missing!\n",
                     elf->name, names[i]);
             return -EINVAL;
         }
 
         if ( !sec->sec->sh_size )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: %s is empty!\n",
+            printk(XENLOG_ERR LIVEPATCH "%s: %s is empty!\n",
                     elf->name, names[i]);
             return -EINVAL;
         }
 
         if ( test_and_set_bit(i, found) )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: %s was seen more than once!\n",
+            printk(XENLOG_ERR LIVEPATCH "%s: %s was seen more than once!\n",
                     elf->name, names[i]);
             return -EINVAL;
         }
@@ -529,21 +529,21 @@ static int check_patching_sections(const struct livepatch_elf *elf)
         sec = livepatch_elf_sec_by_name(elf, names[i]);
         if ( !sec )
         {
-            dprintk(XENLOG_INFO, LIVEPATCH "%s: %s is missing!\n",
+            dprintk(XENLOG_DEBUG, LIVEPATCH "%s: %s is missing!\n",
                     elf->name, names[i]);
             continue; /* This section is optional */
         }
 
         if ( !sec->sec->sh_size )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: %s is empty!\n",
+            printk(XENLOG_ERR LIVEPATCH "%s: %s is empty!\n",
                     elf->name, names[i]);
             return -EINVAL;
         }
 
         if ( test_and_set_bit(i, found) )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: %s was seen more than once!\n",
+            printk(XENLOG_ERR LIVEPATCH "%s: %s was seen more than once!\n",
                     elf->name, names[i]);
             return -EINVAL;
         }
@@ -615,7 +615,7 @@ static int prepare_payload(struct payload *payload,
 
             if ( f->version != LIVEPATCH_PAYLOAD_VERSION )
             {
-                dprintk(XENLOG_ERR, LIVEPATCH "%s: Wrong version (%u). Expected %d!\n",
+                printk(XENLOG_ERR LIVEPATCH "%s: Wrong version (%u). Expected %d!\n",
                         elf->name, f->version, LIVEPATCH_PAYLOAD_VERSION);
                 return -EOPNOTSUPP;
             }
@@ -623,7 +623,7 @@ static int prepare_payload(struct payload *payload,
             /* 'old_addr', 'new_addr', 'new_size' can all be zero. */
             if ( !f->old_size )
             {
-                dprintk(XENLOG_ERR, LIVEPATCH "%s: Address or size fields are zero!\n",
+                printk(XENLOG_ERR LIVEPATCH "%s: Address or size fields are zero!\n",
                         elf->name);
                 return -EINVAL;
             }
@@ -762,14 +762,14 @@ static int prepare_payload(struct payload *payload,
             if ( (instr < region->start && instr >= region->end) ||
                  (replacement < region->start && replacement >= region->end) )
             {
-                dprintk(XENLOG_ERR, LIVEPATCH "%s Alt patching outside payload: %p!\n",
+                printk(XENLOG_ERR LIVEPATCH "%s Alt patching outside payload: %p!\n",
                         elf->name, instr);
                 return -EINVAL;
             }
         }
         apply_alternatives(start, end);
 #else
-        dprintk(XENLOG_ERR, LIVEPATCH "%s: We don't support alternative patching!\n",
+        printk(XENLOG_ERR LIVEPATCH "%s: We don't support alternative patching!\n",
                 elf->name);
         return -EOPNOTSUPP;
 #endif
@@ -792,7 +792,7 @@ 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",
+        printk(XENLOG_ERR LIVEPATCH "%s: We don't support .ex_table!\n",
                 elf->name);
         return -EOPNOTSUPP;
 #endif
@@ -901,7 +901,7 @@ static int build_symbol_table(struct payload *payload,
             if ( symbols_lookup_by_name(symtab[i].name) ||
                  livepatch_symbols_lookup_by_name(symtab[i].name) )
             {
-                dprintk(XENLOG_ERR, LIVEPATCH "%s: duplicate new symbol: %s\n",
+                printk(XENLOG_ERR LIVEPATCH "%s: duplicate new symbol: %s\n",
                         elf->name, symtab[i].name);
                 xfree(symtab);
                 xfree(strtab);
@@ -1652,7 +1652,7 @@ static int build_id_dep(struct payload *payload, bool_t internal)
     if ( payload->dep.len != len ||
          memcmp(id, payload->dep.p, len) )
     {
-        dprintk(XENLOG_ERR, "%s%s: check against %s build-id failed!\n",
+        printk(XENLOG_ERR LIVEPATCH "%s%s: check against %s build-id failed!\n",
                 LIVEPATCH, payload->name, name);
         return -EINVAL;
     }
@@ -1712,7 +1712,7 @@ static int livepatch_action(struct xen_sysctl_livepatch_action *action)
             /* We should be the last applied one. */
             if ( p != data )
             {
-                dprintk(XENLOG_ERR, "%s%s: can't unload. Top is %s!\n",
+                printk(XENLOG_ERR LIVEPATCH "%s%s: can't unload. Top is %s!\n",
                         LIVEPATCH, data->name, p->name);
                 rc = -EBUSY;
                 break;
@@ -1748,7 +1748,7 @@ static int livepatch_action(struct xen_sysctl_livepatch_action *action)
              */
             if ( data->reverted && !data->safe_to_reapply )
             {
-                dprintk(XENLOG_ERR, "%s%s: can't revert as payload has .data. Please unload!\n",
+                printk(XENLOG_ERR LIVEPATCH "%s%s: can't revert as payload has .data. Please unload!\n",
                         LIVEPATCH, data->name);
                 data->rc = -EINVAL;
                 break;
-- 
2.16.5




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Ralf Herbrich
Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B
Sitz: Berlin
Ust-ID: DE 289 237 879




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply index

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21  8:19 [Xen-devel] [PATCH 00/14] livepatch: new features and fixes Pawel Wieczorkiewicz
2019-08-21  8:19 ` [Xen-devel] [PATCH 01/14] livepatch: Always check hypervisor build ID upon hotpatch upload Pawel Wieczorkiewicz
2019-08-21 18:16   ` Konrad Rzeszutek Wilk
2019-08-21  8:19 ` [Xen-devel] [PATCH 02/14] livepatch: Allow to override inter-modules buildid dependency Pawel Wieczorkiewicz
2019-08-21  8:19 ` [Xen-devel] [PATCH 03/14] python: Add XC binding for Xen build ID Pawel Wieczorkiewicz
2019-08-21  8:19 ` [Xen-devel] [PATCH 04/14] livepatch: Export payload structure via livepatch_payload.h Pawel Wieczorkiewicz
2019-08-21  8:19 ` [Xen-devel] [PATCH 05/14] livepatch: Implement pre-|post- apply|revert hooks Pawel Wieczorkiewicz
2019-08-21  8:19 ` [Xen-devel] [PATCH 06/14] livepatch: Add support for apply|revert action replacement hooks Pawel Wieczorkiewicz
2019-08-21 18:31   ` Konrad Rzeszutek Wilk
2019-08-21 19:06     ` Wieczorkiewicz, Pawel
2019-08-26 14:30       ` Konrad Rzeszutek Wilk
2019-08-21  8:19 ` [Xen-devel] [PATCH 07/14] livepatch: Do not enforce ELF_LIVEPATCH_FUNC section presence Pawel Wieczorkiewicz
2019-08-21  8:19 ` Pawel Wieczorkiewicz [this message]
2019-08-21  8:19 ` [Xen-devel] [PATCH 09/14] livepatch: Add per-function applied/reverted state tracking marker Pawel Wieczorkiewicz
2019-08-21 18:28   ` Konrad Rzeszutek Wilk
2019-08-21 19:00     ` Wieczorkiewicz, Pawel
2019-08-21 21:34   ` Julien Grall
2019-08-22  7:44     ` Wieczorkiewicz, Pawel
2019-08-22 10:07       ` Julien Grall
2019-08-22 10:20         ` Wieczorkiewicz, Pawel
2019-08-22 10:43           ` Julien Grall
2019-08-22 11:15             ` Wieczorkiewicz, Pawel
2019-08-22 15:02               ` Julien Grall
2019-08-22 10:29   ` Julien Grall
2019-08-22 11:02     ` Wieczorkiewicz, Pawel
2019-08-22 15:30       ` Julien Grall
2019-08-22 15:42         ` Wieczorkiewicz, Pawel
2019-08-21  8:19 ` [Xen-devel] [PATCH 10/14] livepatch: Add support for inline asm hotpatching expectations Pawel Wieczorkiewicz
2019-08-21 18:30   ` Konrad Rzeszutek Wilk
2019-08-21 19:02     ` Wieczorkiewicz, Pawel
2019-08-22 10:31   ` Julien Grall
2019-08-22 11:03     ` Wieczorkiewicz, Pawel
2019-08-21  8:19 ` [Xen-devel] [PATCH 11/14] livepatch: Add support for modules .modinfo section metadata Pawel Wieczorkiewicz
2019-08-21  8:19 ` [Xen-devel] [PATCH 12/14] livepatch: Handle arbitrary size names with the list operation Pawel Wieczorkiewicz
2019-08-21  8:19 ` [Xen-devel] [PATCH 13/14] livepatch: Add metadata runtime retrieval mechanism Pawel Wieczorkiewicz
2019-08-21  8:19 ` [Xen-devel] [PATCH 14/14] livepatch: Add python bindings for livepatch operations Pawel Wieczorkiewicz
2019-08-22 21:55   ` Marek Marczykowski-Górecki
2019-08-27  8:46 ` [Xen-devel] [PATCH v2 00/12] livepatch: new features and fixes Pawel Wieczorkiewicz
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 01/12] livepatch: Always check hypervisor build ID upon hotpatch upload Pawel Wieczorkiewicz
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 02/12] livepatch: Allow to override inter-modules buildid dependency Pawel Wieczorkiewicz
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 03/12] livepatch: Export payload structure via livepatch_payload.h Pawel Wieczorkiewicz
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 04/12] livepatch: Implement pre-|post- apply|revert hooks Pawel Wieczorkiewicz
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 05/12] livepatch: Add support for apply|revert action replacement hooks Pawel Wieczorkiewicz
2019-08-27 16:58     ` Konrad Rzeszutek Wilk
2019-08-28  7:37       ` Wieczorkiewicz, Pawel
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 06/12] livepatch: Do not enforce ELF_LIVEPATCH_FUNC section presence Pawel Wieczorkiewicz
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 07/12] livepatch: Add per-function applied/reverted state tracking marker Pawel Wieczorkiewicz
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 08/12] livepatch: Add support for inline asm hotpatching expectations Pawel Wieczorkiewicz
2019-08-29 14:34     ` Konrad Rzeszutek Wilk
2019-08-29 15:29       ` Wieczorkiewicz, Pawel
2019-08-29 15:58     ` Konrad Rzeszutek Wilk
2019-08-29 16:16       ` Wieczorkiewicz, Pawel
2019-08-29 17:49         ` Konrad Rzeszutek Wilk
2019-08-29 19:07           ` Wieczorkiewicz, Pawel
2019-08-29 20:48             ` Konrad Rzeszutek Wilk
2019-09-05 18:05     ` Konrad Rzeszutek Wilk
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 09/12] livepatch: Add support for modules .modinfo section metadata Pawel Wieczorkiewicz
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 10/12] livepatch: Handle arbitrary size names with the list operation Pawel Wieczorkiewicz
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 11/12] livepatch: Add metadata runtime retrieval mechanism Pawel Wieczorkiewicz
2019-08-29 20:48     ` Konrad Rzeszutek Wilk
2019-08-27  8:46   ` [Xen-devel] [PATCH v2 12/12] livepatch: Add python bindings for livepatch operations Pawel Wieczorkiewicz
2019-08-28 13:21     ` Marek Marczykowski-Górecki
2019-08-29 19:23   ` [Xen-devel] [PATCH v2 00/12] livepatch: new features and fixes Konrad Rzeszutek Wilk
2019-09-05 19:13   ` Konrad Rzeszutek Wilk
2019-09-06 22:52     ` Julien Grall
2019-09-06 22:42   ` Julien Grall

Reply instructions:

You may reply publically 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=20190821081931.90887-9-wipawel@amazon.de \
    --to=wipawel@amazon.de \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=mpohlack@amazon.com \
    --cc=roger.pau@citrix.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=wipawel@amazon.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xen.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

Xen-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/xen-devel/0 xen-devel/git/0.git
	git clone --mirror https://lore.kernel.org/xen-devel/1 xen-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 xen-devel xen-devel/ https://lore.kernel.org/xen-devel \
		xen-devel@lists.xenproject.org xen-devel@lists.xen.org
	public-inbox-index xen-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.xenproject.lists.xen-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git