[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen staging] livepatch: always print XENLOG_ERR information



commit 4470efeae44fc1fe9ae4004408e175f8271fcda3
Author:     Pawel Wieczorkiewicz <wipawel@xxxxxxxxx>
AuthorDate: Wed Aug 14 12:23:05 2019 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Aug 19 18:24:04 2019 +0100

    livepatch: always print XENLOG_ERR information
    
    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@xxxxxxxxx>
    Reviewed-by: Amit Shah <aams@xxxxxxxxx>
    Reviewed-by: Martin Mazein <amazein@xxxxxxxxx>
    Reviewed-by: Bjoern Doebel <doebel@xxxxxxxxx>
    Reviewed-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
    [Fix indentation and double LIVEPATCH prefixes, drop gratuitous punctuation]
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/livepatch.c | 32 +++++++++++++-------------
 xen/common/livepatch.c   | 60 ++++++++++++++++++++++++------------------------
 2 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/xen/arch/x86/livepatch.c b/xen/arch/x86/livepatch.c
index 406eb910cc..c82cf53b9e 100644
--- a/xen/arch/x86/livepatch.c
+++ b/xen/arch/x86/livepatch.c
@@ -126,8 +126,8 @@ 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",
-                elf->name);
+        printk(XENLOG_ERR LIVEPATCH "%s: Unsupported ELF Machine type\n",
+               elf->name);
         return -EOPNOTSUPP;
     }
 
@@ -152,8 +152,8 @@ 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",
-            elf->name);
+    printk(XENLOG_ERR LIVEPATCH "%s: SHT_REL relocation unsupported\n",
+           elf->name);
     return -EOPNOTSUPP;
 }
 
@@ -172,20 +172,20 @@ int arch_livepatch_perform_rela(struct livepatch_elf *elf,
 
         if ( symndx == STN_UNDEF )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: Encountered STN_UNDEF\n",
-                    elf->name);
+            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",
-                    elf->name, symndx);
+            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",
-                    elf->name, symndx);
+            printk(XENLOG_ERR LIVEPATCH "%s: No symbol@%u\n",
+                   elf->name, symndx);
             return -EINVAL;
         }
 
@@ -222,15 +222,15 @@ 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",
-                        elf->name, i, rela->name, base->name);
+                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",
-                    elf->name, ELF64_R_TYPE(r->r_info));
+            printk(XENLOG_ERR LIVEPATCH "%s: Unhandled relocation %lu\n",
+                   elf->name, ELF64_R_TYPE(r->r_info));
             return -EOPNOTSUPP;
         }
     }
@@ -238,8 +238,8 @@ 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",
-            elf->name, base->name);
+    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 d6eaae6d3b..7caa30c202 100644
--- a/xen/common/livepatch.c
+++ b/xen/common/livepatch.c
@@ -251,8 +251,8 @@ 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",
-                    elf->name, f->name);
+            printk(XENLOG_ERR LIVEPATCH "%s: Could not resolve old address of 
%s\n",
+                   elf->name, f->name);
             return -ENOENT;
         }
     }
@@ -370,8 +370,8 @@ 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",
-                elf->name);
+        printk(XENLOG_ERR LIVEPATCH "%s: Could not allocate memory for 
payload\n",
+               elf->name);
         rc = -ENOMEM;
         goto out;
     }
@@ -468,8 +468,8 @@ 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",
-                elf->name, sec->sec->sh_size, sec->name, sz);
+        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;
     }
 
@@ -491,22 +491,22 @@ 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",
-                    elf->name, names[i]);
+            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",
-                    elf->name, names[i]);
+            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",
-                    elf->name, names[i]);
+            printk(XENLOG_ERR LIVEPATCH "%s: %s was seen more than once\n",
+                   elf->name, names[i]);
             return -EINVAL;
         }
     }
@@ -539,16 +539,16 @@ static int prepare_payload(struct payload *payload,
 
         if ( f->version != LIVEPATCH_PAYLOAD_VERSION )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: Wrong version (%u). Expected 
%d!\n",
-                    elf->name, f->version, LIVEPATCH_PAYLOAD_VERSION);
+            printk(XENLOG_ERR LIVEPATCH "%s: Wrong version (%u). Expected 
%d\n",
+                   elf->name, f->version, LIVEPATCH_PAYLOAD_VERSION);
             return -EOPNOTSUPP;
         }
 
         /* '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",
-                    elf->name);
+            printk(XENLOG_ERR LIVEPATCH "%s: Address or size fields are 
zero\n",
+                   elf->name);
             return -EINVAL;
         }
 
@@ -677,15 +677,15 @@ 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",
-                        elf->name, instr);
+                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",
-                elf->name);
+        printk(XENLOG_ERR LIVEPATCH "%s: We don't support alternative 
patching\n",
+               elf->name);
         return -EOPNOTSUPP;
 #endif
     }
@@ -707,8 +707,8 @@ 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);
+        printk(XENLOG_ERR LIVEPATCH "%s: We don't support .ex_table\n",
+               elf->name);
         return -EOPNOTSUPP;
 #endif
     }
@@ -816,8 +816,8 @@ 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",
-                        elf->name, symtab[i].name);
+                printk(XENLOG_ERR LIVEPATCH "%s: duplicate new symbol: %s\n",
+                       elf->name, symtab[i].name);
                 xfree(symtab);
                 xfree(strtab);
                 return -EEXIST;
@@ -1444,8 +1444,8 @@ 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",
-                LIVEPATCH, payload->name, name);
+        printk(XENLOG_ERR LIVEPATCH "%s: check against %s build-id failed\n",
+               payload->name, name);
         return -EINVAL;
     }
 
@@ -1504,8 +1504,8 @@ 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",
-                        LIVEPATCH, data->name, p->name);
+                printk(XENLOG_ERR LIVEPATCH "%s: can't unload. Top is %s\n",
+                       data->name, p->name);
                 rc = -EBUSY;
                 break;
             }
@@ -1525,8 +1525,8 @@ 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",
-                        LIVEPATCH, data->name);
+                printk(XENLOG_ERR LIVEPATCH "%s: can't revert as payload has 
.data. Please unload\n",
+                       data->name);
                 data->rc = -EINVAL;
                 break;
             }
--
generated by git-patchbot for /home/xen/git/xen.git#staging

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.