rpms/valgrind/devel valgrind-3.2.1-cfa-set-loc.patch, NONE, 1.1 valgrind-3.2.1-openat.patch, NONE, 1.1 valgrind.spec, 1.40, 1.41

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Tue Sep 26 21:15:56 UTC 2006


Author: jakub

Update of /cvs/dist/rpms/valgrind/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv13281

Modified Files:
	valgrind.spec 
Added Files:
	valgrind-3.2.1-cfa-set-loc.patch valgrind-3.2.1-openat.patch 
Log Message:
3.2.1-2


valgrind-3.2.1-cfa-set-loc.patch:
 readdwarf.c |   53 +++++++++++++++++++++++++++++++++--------------------
 1 files changed, 33 insertions(+), 20 deletions(-)

--- NEW FILE valgrind-3.2.1-cfa-set-loc.patch ---
--- valgrind-3.2.1/coregrind/m_debuginfo/readdwarf.c.jj	2006-08-28 15:39:01.000000000 +0200
+++ valgrind-3.2.1/coregrind/m_debuginfo/readdwarf.c	2006-09-26 18:12:22.000000000 +0200
@@ -1489,6 +1489,9 @@ typedef
       Int  data_a_f;
       Addr initloc;
       Int  ra_reg;
+      UChar address_encoding;
+      UChar* ehframe;
+      Addr ehframe_addr;
       /* The rest of these fields can be modifed by
          run_CF_instruction. */
       /* The LOC entry */
@@ -1521,6 +1524,9 @@ static void initUnwindContext ( /*OUT*/U
    ctx->loc        = 0;
    ctx->cfa_reg    = 0;
    ctx->cfa_offset = 0;
+   ctx->address_encoding = 0;
+   ctx->ehframe    = 0;
+   ctx->ehframe_addr = 0;
    for (i = 0; i < N_CFI_REGS; i++) {
       ctx->reg[i].tag = RR_Undef;
       ctx->reg[i].coff = 0;
@@ -1730,15 +1736,6 @@ static ULong read_ULong ( UChar* data )
    return r;
 }
 
-static Addr read_Addr ( UChar* data )
-{
-#  if VG_WORDSIZE == 4
-   return read_UInt(data);
-#  else
-   return read_ULong(data);
-#  endif
-}
-
 static UChar read_UChar ( UChar* data )
 {
    return data[0];
@@ -1885,7 +1882,10 @@ static Int run_CF_instruction ( /*MOD*/U
       case DW_CFA_nop: 
          break;
       case DW_CFA_set_loc:
-         ctx->loc = read_Addr(&instr[i]) - ctx->initloc; i+= sizeof(Addr);
+         ctx->loc 
+            = read_encoded_Addr(&instr[i], ctx->address_encoding,
+                                &nleb, ctx->ehframe, ctx->ehframe_addr);
+         i += nleb;
          break;
       case DW_CFA_advance_loc1:
          delta = (UInt)read_UChar(&instr[i]); i+= sizeof(UChar);
@@ -2087,7 +2087,7 @@ static Int run_CF_instruction ( /*MOD*/U
 
 /* Show a CFI instruction, and also return its length. */
 
-static Int show_CF_instruction ( UChar* instr )
+static Int show_CF_instruction ( UnwindContext* ctx, UChar* instr )
 {
    UInt  delta;
    Int   off, reg, reg2, nleb, len;
@@ -2128,7 +2128,9 @@ static Int show_CF_instruction ( UChar* 
          break;
 
       case DW_CFA_set_loc:
-         loc = read_Addr(&instr[i]); i+= sizeof(Addr);
+         loc  = read_encoded_Addr(&instr[i], ctx->address_encoding,
+                                  &nleb, ctx->ehframe, ctx->ehframe_addr);
+         i += nleb;
          VG_(printf)("DW_CFA_set_loc(%p)\n", loc); 
          break;
 
@@ -2299,12 +2301,12 @@ static Int show_CF_instruction ( UChar* 
 }
 
 
-static void show_CF_instructions ( UChar* instrs, Int ilen )
+static void show_CF_instructions ( UnwindContext* ctx, UChar* instrs, Int ilen )
 {
    Int i = 0;
    while (True) {
       if (i >= ilen) break;
-      i += show_CF_instruction( &instrs[i] );
+      i += show_CF_instruction( ctx, &instrs[i] );
    }
 }
 
@@ -2326,7 +2328,7 @@ Bool run_CF_instructions ( struct _SegIn
    while (True) {
       loc_prev = ctx->loc;
       if (i >= ilen) break;
-      if (0) (void)show_CF_instruction( &instrs[i] );
+      if (0) (void)show_CF_instruction( ctx, &instrs[i] );
       j = run_CF_instruction( ctx, &instrs[i], restore_ctx );
       if (j == 0)
          return False; /* execution failed */
@@ -2611,9 +2613,17 @@ void ML_(read_callframe_info_dwarf2) 
 
          data += the_CIEs[this_CIE].ilen;
 
-         if (VG_(clo_trace_cfi)) 
-            show_CF_instructions(the_CIEs[this_CIE].instrs, 
+         if (VG_(clo_trace_cfi)) {
+	    UnwindContext ctx;
+
+	    initUnwindContext(&ctx);
+	    ctx.address_encoding = the_CIEs[this_CIE].address_encoding;
+	    ctx.ehframe  = ehframe;
+	    ctx.ehframe_addr = ehframe_addr;
+
+            show_CF_instructions(&ctx, the_CIEs[this_CIE].instrs, 
                                  the_CIEs[this_CIE].ilen);
+	 }
 
       } else {
 
@@ -2680,14 +2690,17 @@ void ML_(read_callframe_info_dwarf2) 
 
 	 data += fde_ilen;
 
-         if (VG_(clo_trace_cfi)) 
-            show_CF_instructions(fde_instrs, fde_ilen);
-
 	 initUnwindContext(&ctx);
          ctx.code_a_f = the_CIEs[cie].code_a_f;
          ctx.data_a_f = the_CIEs[cie].data_a_f;
          ctx.initloc  = fde_initloc;
          ctx.ra_reg   = the_CIEs[cie].ra_reg;
+         ctx.address_encoding = the_CIEs[cie].address_encoding;
+         ctx.ehframe  = ehframe;
+         ctx.ehframe_addr = ehframe_addr;
+
+         if (VG_(clo_trace_cfi)) 
+            show_CF_instructions(&ctx, fde_instrs, fde_ilen);
 
 	 initUnwindContext(&restore_ctx);
 

valgrind-3.2.1-openat.patch:
 coregrind/m_syswrap/syswrap-linux.c |   11 ++++++++---
 include/vki-linux.h                 |    2 ++
 2 files changed, 10 insertions(+), 3 deletions(-)

--- NEW FILE valgrind-3.2.1-openat.patch ---
Testcase:
#define _GNU_SOURCE
#include <fcntl.h>
#include <unistd.h>

int
main (void)
{
  int dfd = open ("/tmp", O_RDONLY);
  int fd1 = openat (dfd, "abc", O_RDONLY);
  int fd2 = openat (0x12345678, "/tmp/abc", O_RDONLY);
  int fd3 = openat (AT_FDCWD, "abc", O_RDONLY);
  /* This is the only one that should warn.  */
  int fd4 = openat (0x12345678, "abc", O_RDONLY);
  return 0;
}

--- valgrind-3.2.1/include/vki-linux.h.jj	2006-08-28 15:38:37.000000000 +0200
+++ valgrind-3.2.1/include/vki-linux.h	2006-09-26 18:29:00.000000000 +0200
@@ -1223,6 +1223,8 @@ struct vki_dirent {
 
 #define VKI_F_NOTIFY	(VKI_F_LINUX_SPECIFIC_BASE+2)
 
+#define VKI_AT_FDCWD	-100
+
 //----------------------------------------------------------------------
 // From linux-2.6.8.1/include/linux/sysctl.h
 //----------------------------------------------------------------------
--- valgrind-3.2.1/coregrind/m_syswrap/syswrap-linux.c.jj	2006-08-28 15:38:57.000000000 +0200
+++ valgrind-3.2.1/coregrind/m_syswrap/syswrap-linux.c	2006-09-26 18:42:04.000000000 +0200
@@ -2350,10 +2350,15 @@ PRE(sys_openat)
                     int, dfd, const char *, filename, int, flags);
    }
 
-   if (!ML_(fd_allowed)(ARG1, "openat", tid, False))
+   PRE_MEM_RASCIIZ( "openat(filename)", ARG2 );
+
+   /* For absolute filenames, dfd is ignored.  If dfd is AT_FDCWD,
+      filename is relative to cwd.  */   
+   if (ML_(safe_to_deref)( (void*)ARG2, 1 )
+       && *(Char *)ARG2 != '/'
+       && ARG1 != VKI_AT_FDCWD
+       && !ML_(fd_allowed)(ARG1, "openat", tid, False))
       SET_STATUS_Failure( VKI_EBADF );
-   else
-      PRE_MEM_RASCIIZ( "openat(filename)", ARG2 );
 
    /* Handle the case where the open is of /proc/self/cmdline or
       /proc/<pid>/cmdline, and just give it a copy of the fd for the


Index: valgrind.spec
===================================================================
RCS file: /cvs/dist/rpms/valgrind/devel/valgrind.spec,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- valgrind.spec	19 Sep 2006 11:48:24 -0000	1.40
+++ valgrind.spec	26 Sep 2006 21:15:53 -0000	1.41
@@ -1,10 +1,12 @@
 Summary: Tool for finding memory management bugs in programs
 Name: valgrind
 Version: 3.2.1
-Release: 1
+Release: 2
 Epoch: 1
 Source0: http://www.valgrind.org/downloads/valgrind-%{version}.tar.bz2
 Patch1: valgrind-3.2.0-makefile.patch
+Patch2: valgrind-3.2.1-openat.patch
+Patch3: valgrind-3.2.1-cfa-set-loc.patch
 License: GPL
 URL: http://www.valgrind.org/
 Group: Development/Debuggers
@@ -33,6 +35,8 @@
 %prep
 %setup -q
 %patch1 -p1
+%patch2 -p1
+%patch3 -p1
 
 %build
 %ifarch x86_64 ppc64
@@ -116,6 +120,10 @@
 %{_mandir}/man1/valgrind*
 
 %changelog
+* Tue Sep 26 2006 Jakub Jelinek <jakub at redhat.com> 3.2.1-2
+- fix openat handling (#208097)
+- fix DW_CFA_set_loc handling
+
 * Tue Sep 19 2006 Jakub Jelinek <jakub at redhat.com> 3.2.1-1
 - update to 3.2.1 bugfix release
   - SSE3 emulation fixes, reduce memcheck false positive rate,




More information about the fedora-cvs-commits mailing list