svn commit: r319887 - in head: contrib/llvm/tools/lld/ELF usr.bin/hexdump

Ed Maste emaste at FreeBSD.org
Tue Jun 13 01:05:56 UTC 2017


Author: emaste
Date: Tue Jun 13 01:05:55 2017
New Revision: 319887
URL: https://svnweb.freebsd.org/changeset/base/319887

Log:
  hexdump: actually enter capability mode on last file
  
  Reviewed by:	cem, Kyle Evans
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D10897

Modified:
  head/contrib/llvm/tools/lld/ELF/InputSection.cpp
  head/usr.bin/hexdump/display.c

Modified: head/contrib/llvm/tools/lld/ELF/InputSection.cpp
==============================================================================
--- head/contrib/llvm/tools/lld/ELF/InputSection.cpp	Tue Jun 13 00:42:23 2017	(r319886)
+++ head/contrib/llvm/tools/lld/ELF/InputSection.cpp	Tue Jun 13 01:05:55 2017	(r319887)
@@ -255,7 +255,7 @@ static uint32_t getARMUndefinedRelativeWeakVA(uint32_t
                                               uint32_t P) {
   switch (Type) {
   case R_ARM_THM_JUMP11:
-    return P + 2;
+    return P + 2 + A;
   case R_ARM_CALL:
   case R_ARM_JUMP24:
   case R_ARM_PC24:
@@ -263,12 +263,12 @@ static uint32_t getARMUndefinedRelativeWeakVA(uint32_t
   case R_ARM_PREL31:
   case R_ARM_THM_JUMP19:
   case R_ARM_THM_JUMP24:
-    return P + 4;
+    return P + 4 + A;
   case R_ARM_THM_CALL:
     // We don't want an interworking BLX to ARM
-    return P + 5;
+    return P + 5 + A;
   default:
-    return A;
+    return P + A;
   }
 }
 
@@ -279,9 +279,9 @@ static uint64_t getAArch64UndefinedRelativeWeakVA(uint
   case R_AARCH64_CONDBR19:
   case R_AARCH64_JUMP26:
   case R_AARCH64_TSTBR14:
-    return P + 4;
+    return P + 4 + A;
   default:
-    return A;
+    return P + A;
   }
 }
 

Modified: head/usr.bin/hexdump/display.c
==============================================================================
--- head/usr.bin/hexdump/display.c	Tue Jun 13 00:42:23 2017	(r319886)
+++ head/usr.bin/hexdump/display.c	Tue Jun 13 01:05:55 2017	(r319887)
@@ -361,12 +361,12 @@ next(char **argv)
 
 		if (caph_limit_stream(fileno(stdin), CAPH_READ) < 0)
 			err(1, "unable to restrict %s",
-			    statok ? _argv[-1] : "stdin");
+			    statok ? *_argv : "stdin");
 
 		/*
 		 * We've opened our last input file; enter capsicum sandbox.
 		 */
-		if (*_argv == NULL) {
+		if (statok == 0 || *(_argv + 1) == NULL) {
 			if (cap_enter() < 0 && errno != ENOSYS)
 				err(1, "unable to enter capability mode");
 		}


More information about the svn-src-head mailing list