rpms/ltrace/devel ltrace-ppc32fc5.patch, NONE, 1.1 .cvsignore, 1.7, 1.8 ltrace-opd.patch, 1.1, 1.2 ltrace.spec, 1.36, 1.37 sources, 1.7, 1.8 ltrace-demangle.patch, 1.1, NONE ltrace-e_entry.patch, 1.2, NONE ltrace-opt_x.patch, 1.2, NONE ltrace-testsuite.patch, 1.5, NONE ltrace_0.3.36-2.diff.gz, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Jul 14 12:02:48 UTC 2006


Author: pmachata

Update of /cvs/dist/rpms/ltrace/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv2810

Modified Files:
	.cvsignore ltrace-opd.patch ltrace.spec sources 
Added Files:
	ltrace-ppc32fc5.patch 
Removed Files:
	ltrace-demangle.patch ltrace-e_entry.patch ltrace-opt_x.patch 
	ltrace-testsuite.patch ltrace_0.3.36-2.diff.gz 
Log Message:
- adding upstream (svn) version.  It contains most of patches that we
  already use, and has support for secure PLTs.


ltrace-ppc32fc5.patch:
 breakpoints.c                  |    5 ++---
 elf.c                          |    6 +++---
 output.c                       |    1 -
 process_event.c                |    9 ++++++---
 sysdeps/linux-gnu/breakpoint.c |    6 ++++++
 sysdeps/linux-gnu/ppc/arch.h   |    4 +---
 sysdeps/linux-gnu/ppc/plt.c    |    8 ++++++--
 sysdeps/linux-gnu/ppc/regs.c   |   11 +++++++++--
 8 files changed, 33 insertions(+), 17 deletions(-)

--- NEW FILE ltrace-ppc32fc5.patch ---
Index: output.c
===================================================================
--- output.c	(revision 45)
+++ output.c	(working copy)
@@ -170,7 +170,6 @@ void output_left(enum tof type, struct p
 	}
 	if (current_proc) {
 		fprintf(output, " <unfinished ...>\n");
-		current_proc = 0;
 		current_column = 0;
 	}
 	current_proc = proc;
Index: elf.c
===================================================================
--- elf.c	(revision 45)
+++ elf.c	(working copy)
@@ -403,7 +403,7 @@ struct library_symbol *read_elf(struct p
 			add_library_symbol(addr, name, &library_symbols,
 					   (PLTS_ARE_EXECUTABLE(lte)
 					   ?  LS_TOPLT_EXEC : LS_TOPLT_POINT),
-					   ELF64_ST_BIND(sym.st_info) != 0);
+					   ELF64_ST_BIND(sym.st_info) == STB_WEAK);
 			if (!lib_tail)
 				lib_tail = &(library_symbols->next);
 		}
@@ -415,7 +415,7 @@ struct library_symbol *read_elf(struct p
                    already there. */
 		main_cheat = (struct opt_x_t *)malloc(sizeof(struct opt_x_t));
 		if (main_cheat == NULL)
-			error(EXIT_FAILURE, 0, "Couldn allocate memory");
+			error(EXIT_FAILURE, 0, "Couldn't allocate memory");
 		main_cheat->next = opt_x;
 		main_cheat->found = 0;
 		main_cheat->name = PLTs_initialized_by_here;
@@ -464,7 +464,7 @@ struct library_symbol *read_elf(struct p
 			if (strcmp(xptr->name, PLTs_initialized_by_here) == 0) {
 				if (lte->ehdr.e_entry) {
 					add_library_symbol (
-						elf_plt2addr (lte, (void*)(long)
+						opd2addr (lte, (void*)(long)
 							lte->ehdr.e_entry),
 						PLTs_initialized_by_here,
 						lib_tail, 1, 0);
Index: sysdeps/linux-gnu/breakpoint.c
===================================================================
--- sysdeps/linux-gnu/breakpoint.c	(revision 45)
+++ sysdeps/linux-gnu/breakpoint.c	(working copy)
@@ -9,6 +9,8 @@
 #include "output.h"
 #include "debug.h"
 
+#include <errno.h>
+
 static unsigned char break_insn[] = BREAKPOINT_VALUE;
 
 #ifdef ARCH_HAVE_ENABLE_BREAKPOINT
@@ -28,6 +30,10 @@ void enable_breakpoint(pid_t pid, struct
 		long a =
 		    ptrace(PTRACE_PEEKTEXT, pid, sbp->addr + i * sizeof(long),
 			   0);
+		if (a == -1 && errno) {
+			perror ("ptrace");
+			return;
+		}
 		for (j = 0;
 		     j < sizeof(long)
 		     && i * sizeof(long) + j < BREAKPOINT_LENGTH; j++) {
Index: sysdeps/linux-gnu/ppc/plt.c
===================================================================
--- sysdeps/linux-gnu/ppc/plt.c	(revision 45)
+++ sysdeps/linux-gnu/ppc/plt.c	(working copy)
@@ -1,4 +1,5 @@
 #include <gelf.h>
+#include <errno.h>
 #include "ltrace.h"
 #include "elf.h"
 #include "debug.h"
@@ -15,8 +16,7 @@ void *sym2addr(struct process *proc, str
 	long addr = sym->enter_addr;
 	long pt_ret;
 
-	debug(3, 0);
-
+	debug(2, "sym2addr: sym=%s, pid=%d, enter_addr=%p", sym->name, proc->pid, addr);
 	if (sym->plt_type != LS_TOPLT_POINT) {
 		return addr;
 	}
@@ -46,6 +46,10 @@ void *sym2addr(struct process *proc, str
 	// break-point right in the PLT.
 
 	pt_ret = ptrace(PTRACE_PEEKTEXT, proc->pid, addr, 0);
+	if (pt_ret == -1 && errno) {
+		perror ("ptrace");
+		return 0;
+	}
 
 	if (proc->mask_32bit) {
 		// Assume big-endian.
Index: sysdeps/linux-gnu/ppc/regs.c
===================================================================
--- sysdeps/linux-gnu/ppc/regs.c	(revision 45)
+++ sysdeps/linux-gnu/ppc/regs.c	(working copy)
@@ -5,8 +5,10 @@
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <asm/ptrace.h>
+#include <errno.h>
 
 #include "ltrace.h"
+#include "debug.h"
 
 #if (!defined(PTRACE_PEEKUSER) && defined(PTRACE_PEEKUSR))
 # define PTRACE_PEEKUSER PTRACE_PEEKUSR
@@ -35,6 +37,11 @@ void *get_stack_pointer(struct process *
 
 void *get_return_addr(struct process *proc, void *stack_pointer)
 {
-	return (void *)ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long) * PT_LNK,
-			      0);
+	long p = ptrace(PTRACE_PEEKUSER, proc->pid, sizeof(long) * PT_LNK, NULL);
+	if (p == -1 && errno) {
+		perror ("ptrace");
+		return NULL;
+	}
+	debug (3, "pid=%d ret=%p", proc->pid, p);
+	return (void*)p;
 }
Index: sysdeps/linux-gnu/ppc/arch.h
===================================================================
--- sysdeps/linux-gnu/ppc/arch.h	(revision 45)
+++ sysdeps/linux-gnu/ppc/arch.h	(working copy)
@@ -7,6 +7,7 @@
 #ifdef __powerpc64__ // Says 'ltrace' is 64 bits, says nothing about target.
 #define LT_ELFCLASS2	ELFCLASS64
 #define LT_ELF_MACHINE2	EM_PPC64
+#endif
 
 #define PLT_REINITALISATION_BP    "_start"
 
@@ -16,6 +17,3 @@
 #if (PPC_NOP_LENGTH != BREAKPOINT_LENGTH)
 #error "Length of the breakpoint value not equal to the length of a nop instruction"
 #endif
-
-
-#endif
Index: process_event.c
===================================================================
--- process_event.c	(revision 45)
+++ process_event.c	(working copy)
@@ -263,7 +263,7 @@ static void process_breakpoint(struct ev
 	struct breakpoint *sbp, *nxtbp;
 
 	debug(2, "event: breakpoint (%p)", event->e_un.brk_addr);
-	if ((sbp = event->proc->breakpoint_being_enabled) != 0) {
+	if ((sbp = event->proc->breakpoint_being_enabled) != NULL) {
 #ifdef __powerpc__
 		char nop_inst[] = PPC_NOP;
                 if (memcmp(sbp->orig_value, nop_inst, PPC_NOP_LENGTH) == 0) {
@@ -344,8 +344,11 @@ static void process_breakpoint(struct ev
 		event->proc->stack_pointer = get_stack_pointer(event->proc);
 		event->proc->return_addr =
 		    get_return_addr(event->proc, event->proc->stack_pointer);
-		output_left(LT_TOF_FUNCTION, event->proc, sbp->libsym->name);
-		callstack_push_symfunc(event->proc, sbp->libsym);
+		if (!sbp->libsym->is_weak || event->proc->return_addr == NULL) {
+			debug (2, "libsym name=%s", sbp->libsym->name);
+			output_left(LT_TOF_FUNCTION, event->proc, sbp->libsym->name);
+			callstack_push_symfunc(event->proc, sbp->libsym);
+		}
 #ifdef PLT_REINITALISATION_BP
 		if (event->proc->need_to_reinitialize_breakpoints
 		    && (strcmp(sbp->libsym->name, PLTs_initialized_by_here) ==
Index: breakpoints.c
===================================================================
--- breakpoints.c	(revision 45)
+++ breakpoints.c	(working copy)
@@ -28,6 +28,7 @@ insert_breakpoint(struct process *proc, 
 		  struct library_symbol *libsym)
 {
 	struct breakpoint *sbp;
+	debug(1, "insert_breakpoint(symbol=%s, addr=%p)", libsym?libsym->name:"(nil)", addr);
 
 	if (!proc->breakpoints) {
 		proc->breakpoints =
@@ -165,11 +166,9 @@ void breakpoints_init(struct process *pr
 	} else {
 		proc->list_of_symbols = NULL;
 	}
-	sym = proc->list_of_symbols;
-	while (sym) {
+	for (sym = proc->list_of_symbols; sym; sym = sym->next) {
 		/* proc->pid==0 delays enabling. */
 		insert_breakpoint(proc, sym2addr(proc, sym), sym);
-		sym = sym->next;
 	}
 	proc->callstack_depth = 0;
 	proc->breakpoints_enabled = -1;


Index: .cvsignore
===================================================================
RCS file: /cvs/dist/rpms/ltrace/devel/.cvsignore,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- .cvsignore	7 Apr 2006 12:47:45 -0000	1.7
+++ .cvsignore	14 Jul 2006 12:02:36 -0000	1.8
@@ -1 +1 @@
-ltrace_0.4.orig.tar.gz
+ltrace-0.5.tar.gz

ltrace-opd.patch:
 elf.c |    6 ++++++
 1 files changed, 6 insertions(+)

Index: ltrace-opd.patch
===================================================================
RCS file: /cvs/dist/rpms/ltrace/devel/ltrace-opd.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ltrace-opd.patch	24 Apr 2006 10:24:21 -0000	1.1
+++ ltrace-opd.patch	14 Jul 2006 12:02:36 -0000	1.2
@@ -1,24 +1,6 @@
 diff -BburpdN ltrace-0.4/elf.c ltrace-0.4-opd/elf.c
 --- ltrace-0.4/elf.c	2006-04-24 12:08:51.000000000 +0200
 +++ ltrace-0.4-opd/elf.c	2006-04-24 12:16:28.000000000 +0200
-@@ -23,7 +23,7 @@ static void add_library_symbol(GElf_Addr
- 			       struct library_symbol **library_symbolspp,
- 			       int use_elf_plt2addr, int is_weak);
- static int in_load_libraries(const char *name, struct ltelf *lte);
--static GElf_Addr elf_plt2addr(struct ltelf *ltc, void *addr);
-+static GElf_Addr elf_opd2addr(struct ltelf *ltc, void *addr);
- 
- extern char *PLTs_initialized_by_here;
- 
-@@ -328,7 +328,7 @@ static int in_load_libraries(const char 
- 	return 0;
- }
- 
--static GElf_Addr elf_plt2addr(struct ltelf *lte, void *addr)
-+static GElf_Addr elf_opd2addr(struct ltelf *lte, void *addr)
- {
- 	long base;
- 	long offset;
 @@ -337,12 +337,18 @@ static GElf_Addr elf_plt2addr(struct lte
  	if (!lte->opd)
  		return (GElf_Addr) addr;
@@ -38,12 +20,3 @@
  	return ret_val;
  }
  
-@@ -438,7 +444,7 @@ struct library_symbol *read_elf(struct p
- 			if (xptr->name && strcmp(xptr->name, name) == 0) {
- 				/* FIXME: Should be able to use &library_symbols as above.  But
- 				   when you do, none of the real library symbols cause breaks. */
--				add_library_symbol(elf_plt2addr
-+				add_library_symbol(elf_opd2addr
- 						   (lte, (void *)addr), name,
- 						   lib_tail, 1, 0);
- 				xptr->found = 1;


Index: ltrace.spec
===================================================================
RCS file: /cvs/dist/rpms/ltrace/devel/ltrace.spec,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- ltrace.spec	12 Jul 2006 07:15:05 -0000	1.36
+++ ltrace.spec	14 Jul 2006 12:02:37 -0000	1.37
@@ -1,16 +1,13 @@
 Summary: Tracks runtime library calls from dynamically linked executables.
 Name: ltrace
-Version: 0.4
-Release: 1.7.1
-Source: ftp://ftp.debian.org/debian/pool/main/l/ltrace/ltrace_%{version}.orig.tar.gz
-Patch0: ltrace-opt_x.patch
-Patch1: ltrace-testsuite.patch
+Version: 0.5
+Release: 1.0.45svn
+Source: ltrace-0.5.tar.gz
 Patch2: ltrace-opd.patch
-Patch3: ltrace-demangle.patch
-Patch4: ltrace-e_entry.patch
+Patch3: ltrace-ppc32fc5.patch
 License: GPL
 Group: Development/Debuggers
-ExclusiveArch: %{ix86} x86_64 ia64 ppc64 s390 s390x alpha sparc
+ExclusiveArch: %{ix86} x86_64 ia64 ppc ppc64 s390 s390x alpha sparc
 Prefix: %{_prefix}
 Buildroot: %{_tmppath}/%{name}-root
 BuildRequires: elfutils-libelf-devel dejagnu
@@ -27,11 +24,8 @@
 
 %prep
 %setup -q
-%patch0 -p0
-%patch1 -p0
 %patch2 -p1
-%patch3 -p2
-%patch4 -p1
+%patch3 -p0
 sed -i -e 's/-o root -g root//' Makefile.in
 
 %build
@@ -58,6 +52,10 @@
 %config /etc/ltrace.conf
 
 %changelog
+* Fri Jul 14 2006 Petr Machata <pmachata at redhat.com> - 0.5-1.0.45svn
+- adding upstream (svn) version.  It contains most of patches that we
+  already use, and has support for secure PLTs.
+
 * Wed Jul 12 2006 Jesse Keating <jkeating at redhat.com> - 0.4-1.7.1
 - rebuild
 


Index: sources
===================================================================
RCS file: /cvs/dist/rpms/ltrace/devel/sources,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- sources	7 Apr 2006 12:47:45 -0000	1.7
+++ sources	14 Jul 2006 12:02:37 -0000	1.8
@@ -1 +1 @@
-8dbadad76ee360c2ed2caa915f5b1c8e  ltrace_0.4.orig.tar.gz
+9b96a0056e9ba88a54e938973bf83025  ltrace-0.5.tar.gz


--- ltrace-demangle.patch DELETED ---


--- ltrace-e_entry.patch DELETED ---


--- ltrace-opt_x.patch DELETED ---


--- ltrace-testsuite.patch DELETED ---


--- ltrace_0.3.36-2.diff.gz DELETED ---




More information about the fedora-cvs-commits mailing list