Date: Tue, 7 Oct 2014 10:25:43 +0000 (UTC) From: Tijl Coosemans <tijl@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r370292 - in head/devel/gdb: . files Message-ID: <201410071025.s97APhDd096861@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tijl Date: Tue Oct 7 10:25:42 2014 New Revision: 370292 URL: https://svnweb.freebsd.org/changeset/ports/370292 QAT: https://qat.redports.org/buildarchive/r370292/ Log: - Fix a buffer overflow when copying a string - Use sysctl KERN_PROC_SIGTRAMP to retrieve the signal trampoline location for the native amd64 ABI. This fixes unwinding over the signal frame after trampoline was moved to the shared page. (https://svnweb.freebsd.org/changeset/base/258663) - Remove some gcc specific warning flags PR: 194190 Submitted by: luca.pizzamiglio@gmail.com (maintainer) Modified: head/devel/gdb/Makefile head/devel/gdb/files/fbsd-threads.c head/devel/gdb/files/patch-gdb-amd64fbsd-nat.c head/devel/gdb/files/patch-gdb-configure Modified: head/devel/gdb/Makefile ============================================================================== --- head/devel/gdb/Makefile Tue Oct 7 10:25:21 2014 (r370291) +++ head/devel/gdb/Makefile Tue Oct 7 10:25:42 2014 (r370292) @@ -3,7 +3,7 @@ PORTNAME= gdb PORTVERSION= 7.8 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= devel MASTER_SITES= GNU Modified: head/devel/gdb/files/fbsd-threads.c ============================================================================== --- head/devel/gdb/files/fbsd-threads.c Tue Oct 7 10:25:21 2014 (r370291) +++ head/devel/gdb/files/fbsd-threads.c Tue Oct 7 10:25:42 2014 (r370292) @@ -1188,9 +1188,9 @@ fbsd_find_lwp_name(long lwpid, struct pr } } - len = strlen(kipp->ki_ocomm); + len = strlen(kipp->ki_ocomm) + 1; lwpstr = xmalloc(len); - strcpy(lwpstr, kipp->ki_ocomm); + strncpy(lwpstr, kipp->ki_ocomm, len); info->lwp_name = lwpstr; break; } Modified: head/devel/gdb/files/patch-gdb-amd64fbsd-nat.c ============================================================================== --- head/devel/gdb/files/patch-gdb-amd64fbsd-nat.c Tue Oct 7 10:25:21 2014 (r370291) +++ head/devel/gdb/files/patch-gdb-amd64fbsd-nat.c Tue Oct 7 10:25:42 2014 (r370292) @@ -1,6 +1,6 @@ ---- gdb/amd64fbsd-nat.c.orig 2012-02-09 17:06:44.000000000 +0100 -+++ gdb/amd64fbsd-nat.c 2012-08-30 10:58:55.000000000 +0200 -@@ -21,11 +21,13 @@ +--- gdb/amd64fbsd-nat.c.orig 2014-06-11 18:34:41.000000000 +0200 ++++ gdb/amd64fbsd-nat.c 2014-09-24 18:27:50.618458853 +0200 +@@ -21,13 +21,17 @@ #include "inferior.h" #include "regcache.h" #include "target.h" @@ -13,8 +13,12 @@ +#include <sys/procfs.h> #include <sys/ptrace.h> #include <sys/sysctl.h> ++#include <sys/user.h> ++#include <sys/param.h> #include <machine/reg.h> -@@ -93,6 +95,46 @@ + + #include "fbsd-nat.h" +@@ -93,6 +97,46 @@ }; @@ -60,4 +64,41 @@ + /* Support for debugging kernel virtual memory images. */ - #include <sys/types.h> + #include <machine/pcb.h> +@@ -247,6 +291,10 @@ + + SC_RBP_OFFSET = offset; + ++// Newer versions of FreeBSD provide a better way to locate the signtramp ++#if ( __FreeBSD_version/100000 < 9 ) \ ++ || ( ( __FreeBSD_version/100000 == 9 ) && ( __FreeBSD_version < 902505 ) ) \ ++ || ( ( __FreeBSD_version/100000 == 10 ) && ( __FreeBSD_version < 1000700 ) ) + /* FreeBSD provides a kern.ps_strings sysctl that we can use to + locate the sigtramp. That way we can still recognize a sigtramp + if its location is changed in a new kernel. Of course this is +@@ -267,4 +315,25 @@ + amd64fbsd_sigtramp_end_addr = ps_strings; + } + } ++#else ++ /* FreeBSD provides a kern.proc.sigtramp sysctl that we can use to ++ locate the sigtramp. That way we can still recognize a sigtramp ++ if its location is changed in a new kernel. */ ++ { ++ int mib[4]; ++ struct kinfo_sigtramp kst; ++ size_t len; ++ ++ mib[0] = CTL_KERN; ++ mib[1] = KERN_PROC; ++ mib[2] = KERN_PROC_SIGTRAMP; ++ mib[3] = getpid(); ++ len = sizeof (kst); ++ if (sysctl (mib, sizeof(mib)/sizeof(mib[0]), &kst, &len, NULL, 0) == 0) ++ { ++ amd64fbsd_sigtramp_start_addr = kst.ksigtramp_start; ++ amd64fbsd_sigtramp_end_addr = kst.ksigtramp_end; ++ } ++ } ++#endif + } Modified: head/devel/gdb/files/patch-gdb-configure ============================================================================== --- head/devel/gdb/files/patch-gdb-configure Tue Oct 7 10:25:21 2014 (r370291) +++ head/devel/gdb/files/patch-gdb-configure Tue Oct 7 10:25:42 2014 (r370292) @@ -1,6 +1,6 @@ ---- gdb/configure.orig 2012-08-24 14:03:52.000000000 +0200 -+++ gdb/configure 2012-08-24 14:05:06.000000000 +0200 -@@ -10590,7 +10590,8 @@ +--- gdb/configure.orig 2014-07-29 14:37:42.000000000 +0200 ++++ gdb/configure 2014-10-01 14:21:14.902231511 +0200 +@@ -11485,7 +11485,8 @@ # See if <machine/reg.h> supports the %fs and %gs i386 segment registers. # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'. @@ -10,7 +10,7 @@ " if test "x$ac_cv_member_struct_reg_r_fs" = x""yes; then : -@@ -10600,7 +10601,8 @@ +@@ -11495,7 +11496,8 @@ fi @@ -20,3 +20,16 @@ " if test "x$ac_cv_member_struct_reg_r_gs" = x""yes; then : +@@ -13007,10 +13009,9 @@ + + build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \ + -Wpointer-sign \ +--Wno-unused -Wunused-value -Wunused-function \ ++-Wno-unused -Wunused-value \ + -Wno-switch -Wno-char-subscripts -Wmissing-prototypes \ +--Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \ +--Wold-style-declaration -Wold-style-definition" ++-Wdeclaration-after-statement -Wempty-body -Wold-style-definition" + + # Enable -Wno-format by default when using gcc on mingw since many + # GCC versions complain about %I64.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410071025.s97APhDd096861>