Skip to contentSkip to conversation

livepatch: always print XENLOG_ERR information (ARM, ELF)

PATCH In review Pawel Wieczorkiewicz 4 participants 4 messages Aug 21, 2019 – Sep 13, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 livepatch: always print XENLOG_ERR information (ARM, ELF)

This complements [1] commit for ARM and livepatch_elf files.

[1] 4470efeae4 livepatch: always print XENLOG_ERR information

---
 xen/arch/arm/arm32/livepatch.c |  28 +++++------
 xen/arch/arm/arm64/livepatch.c |  28 +++++------
 xen/common/livepatch_elf.c     | 104 ++++++++++++++++++++---------------------
 3 files changed, 80 insertions(+), 80 deletions(-)
xen/arch/arm/arm32/livepatch.c +14 -14
index 41378a54ae..5a06467008 100644
@@ -84,15 +84,15 @@ int arch_livepatch_verify_elf(const struct livepatch_elf *elf)
     if ( hdr->e_machine != EM_ARM ||
          hdr->e_ident[EI_CLASS] != ELFCLASS32 )
     {
-        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;
     }
 
     if ( (hdr->e_flags & EF_ARM_EABI_MASK) != EF_ARM_EABI_VER5 )
     {
-        dprintk(XENLOG_ERR, LIVEPATCH "%s: Unsupported ELF EABI(%x)!\n",
-                elf->name, hdr->e_flags);
+        printk(XENLOG_ERR LIVEPATCH "%s: Unsupported ELF EABI(%x)\n",
+               elf->name, hdr->e_flags);
         return -EOPNOTSUPP;
     }
 
@@ -256,20 +256,20 @@ int arch_livepatch_perform(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 symbol wants symbol@%u which is past end!\n",
-                    elf->name, symndx);
+            printk(XENLOG_ERR LIVEPATCH "%s: Relative symbol 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 relative symbol@%u\n",
-                    elf->name, symndx);
+            printk(XENLOG_ERR LIVEPATCH "%s: No relative symbol@%u\n",
+                   elf->name, symndx);
             return -EINVAL;
         }
 
@@ -279,13 +279,13 @@ int arch_livepatch_perform(struct livepatch_elf *elf,
         switch ( rc )
         {
         case -EOVERFLOW:
-            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);
             break;
 
         case -EOPNOTSUPP:
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: Unhandled relocation #%x\n",
-                    elf->name, type);
+            printk(XENLOG_ERR LIVEPATCH "%s: Unhandled relocation #%x\n",
+                   elf->name, type);
             break;
         }
 
xen/arch/arm/arm64/livepatch.c +14 -14
index 5c75779284..6ec8dc60f0 100644
@@ -71,8 +71,8 @@ int arch_livepatch_verify_elf(const struct livepatch_elf *elf)
     if ( hdr->e_machine != EM_AARCH64 ||
          hdr->e_ident[EI_CLASS] != ELFCLASS64 )
     {
-        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;
     }
 
@@ -254,20 +254,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 relative symbol@%u\n",
-                    elf->name, symndx);
+            printk(XENLOG_ERR LIVEPATCH "%s: No relative symbol@%u\n",
+                   elf->name, symndx);
             return -EINVAL;
         }
 
@@ -465,23 +465,23 @@ int arch_livepatch_perform_rela(struct livepatch_elf *elf,
             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;
         }
 
         if ( overflow_check && ovf == -EOVERFLOW )
         {
-            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 ovf;
         }
     }
     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;
 }
 
xen/common/livepatch_elf.c +52 -52

267 lines not on this page · raw message

Signature · 20 lines
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
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 23 lines · Pawel Wieczorkiewicz
xen/common/livepatch_elf.c +3 -3
index dd8b47a1fa..18b9684aeb 100644
@@ -55,7 +55,7 @@ static int elf_resolve_sections(struct livepatch_elf *elf, const void *data)
     sec = xzalloc_array(struct livepatch_elf_sec, elf->hdr->e_shnum);
     if ( !sec )
     {
-        dprintk(XENLOG_ERR, LIVEPATCH"%s: Could not allocate memory for section table!\n",
+        printk(XENLOG_ERR LIVEPATCH"%s: Could not allocate memory for section table\n",
                elf->name);
         return -ENOMEM;
     }
@@ -81,22 +81,22 @@ static int elf_resolve_sections(struct livepatch_elf *elf, const void *data)
              (sec[i].sec->sh_type != SHT_NOBITS && /* Skip SHT_NOBITS */
               (delta > elf->len || (delta + sec[i].sec->sh_size > elf->len))) )
         {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: Section [%u] data %s of payload!\n",
-                    elf->name, i,
+            printk(XENLOG_ERR LIVEPATCH "%s: Section [%u] data %s of payload\n",
+                   elf->name, i,
                     delta < sizeof(Elf_Ehdr) ? "at ELF header" : "is past end");

xen/common/livepatch_elf.c int livepatch_elf_resolve_symbols(struct livepatch_elf *elf) · line 334

Quoted 8 lines
xen/common/livepatch_elf.c +1 -1
@@ -328,7 +328,7 @@ int livepatch_elf_resolve_symbols(struct livepatch_elf *elf)
 
             if ( rc )
             {
-                dprintk(XENLOG_ERR, LIVEPATCH "%s: Out of bounds symbol section %#x\n",
+                printk(XENLOG_ERR LIVEPATCH "%s: Out of bounds symbol section %#x\n",
                         elf->name, idx);
                 break;
             }

These three hunks have minor indentation/spacing issues.  All can be fixed up on commit.

Everything else LGTM.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

Acked-by
#2 lore raw

Hi,

Quoted 25 lines · Andrew Cooper
Quoted 24 lines · Pawel Wieczorkiewicz
xen/common/livepatch_elf.c +3 -3
index dd8b47a1fa..18b9684aeb 100644
@@ -55,7 +55,7 @@ static int elf_resolve_sections(struct livepatch_elf *elf, const void *data)
      sec = xzalloc_array(struct livepatch_elf_sec, elf->hdr->e_shnum);
      if ( !sec )
      {
-        dprintk(XENLOG_ERR, LIVEPATCH"%s: Could not allocate memory for section table!\n",
+        printk(XENLOG_ERR LIVEPATCH"%s: Could not allocate memory for section table\n",
                 elf->name);
          return -ENOMEM;
      }
@@ -81,22 +81,22 @@ static int elf_resolve_sections(struct livepatch_elf *elf, const void *data)
               (sec[i].sec->sh_type != SHT_NOBITS && /* Skip SHT_NOBITS */
                (delta > elf->len || (delta + sec[i].sec->sh_size > elf->len))) )
          {
-            dprintk(XENLOG_ERR, LIVEPATCH "%s: Section [%u] data %s of payload!\n",
-                    elf->name, i,
+            printk(XENLOG_ERR LIVEPATCH "%s: Section [%u] data %s of payload\n",
+                   elf->name, i,
                      delta < sizeof(Elf_Ehdr) ? "at ELF header" : "is past end");
@@ -328,7 +328,7 @@ int livepatch_elf_resolve_symbols(struct livepatch_elf *elf)
 
Quoted 10 lines

xen/common/livepatch_elf.c int livepatch_elf_resolve_symbols(struct livepatch_elf *elf) · line 334

Quoted 7 lines
xen/common/livepatch_elf.c +1 -1
              if ( rc )
              {
-                dprintk(XENLOG_ERR, LIVEPATCH "%s: Out of bounds symbol section %#x\n",
+                printk(XENLOG_ERR LIVEPATCH "%s: Out of bounds symbol section %#x\n",
                          elf->name, idx);
                  break;
              }

These three hunks have minor indentation/spacing issues.  All can be fixed up on commit.

Even if this some of the code is under arch/arm, this still need an ack from Konrad/Ross.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#3 lore raw
In reply to Pawel Wieczorkiewicz
Quoted 11 lines · Pawel Wieczorkiewicz

This complements [1] commit for ARM and livepatch_elf files.

[1] 4470efeae4 livepatch: always print XENLOG_ERR information

---
  xen/arch/arm/arm32/livepatch.c |  28 +++++------
  xen/arch/arm/arm64/livepatch.c |  28 +++++------
  xen/common/livepatch_elf.c     | 104 ++++++++++++++++++++---------------------
  3 files changed, 80 insertions(+), 80 deletions(-)

With Andrew's suggested whitespace changes:

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel