pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/net/freeradius



Module Name:    pkgsrc
Committed By:   manu
Date:           Wed Dec 19 22:52:32 UTC 2018

Modified Files:
        pkgsrc/net/freeradius: distinfo
Added Files:
        pkgsrc/net/freeradius/patches: patch-src_lib_debug.c

Log Message:
Fix startup crash when running outside of gdb on BSD systems

On BSD systems, ptrace(PT_DETACH) uses a third argument for
resume address, with the magic value (void *)1 to resume where
process stopped. Specifying NULL there leads to a crash because
process resumes at address 0.

We introduce an OS-dependent _PTRACE_DETACH macro to specify
third argument as NULL on Linux and (void *)1 on other systems.
Always using (void *)1 could be another solution, since basic
tests suggests passing (void *)1 as third argument on Linux
does not cause harm.

>From upstream https://github.com/FreeRADIUS/freeradius-server/commit/1f8cd27b78c011826bc0744debb4ed60b3f0584a


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 pkgsrc/net/freeradius/distinfo
cvs rdiff -u -r0 -r1.1 pkgsrc/net/freeradius/patches/patch-src_lib_debug.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/net/freeradius/distinfo
diff -u pkgsrc/net/freeradius/distinfo:1.36 pkgsrc/net/freeradius/distinfo:1.37
--- pkgsrc/net/freeradius/distinfo:1.36 Tue Sep 25 12:16:36 2018
+++ pkgsrc/net/freeradius/distinfo      Wed Dec 19 22:52:32 2018
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.36 2018/09/25 12:16:36 jperkin Exp $
+$NetBSD: distinfo,v 1.37 2018/12/19 22:52:32 manu Exp $
 
 SHA1 (freeradius-server-3.0.17.tar.bz2) = a0d4372ee124cbee6b90a4463ff068afe70e06ca
 RMD160 (freeradius-server-3.0.17.tar.bz2) = c335fe2ef39ca2311ac85b2ec3d5941bbbb5e6e6
@@ -8,4 +8,5 @@ SHA1 (patch-ai) = e32ffd24b93e2cef2e72ef
 SHA1 (patch-configure.ac) = ffec1f851d23f560797c12eba5092f2940e4d662
 SHA1 (patch-main_command.c) = 1c79b29eb13df341906c710c8dd41860a27473dd
 SHA1 (patch-main_util.c) = b9cefdb9bc30df0906184e8c0bb883e5258767c3
+SHA1 (patch-src_lib_debug.c) = 7547fdd6abf1048cb1ca846900fc9e4d734f8b8a
 SHA1 (patch-src_lib_udpfromto.c) = 2457f0a7223b1f3ef86d0af020290b26380e6319

Added files:

Index: pkgsrc/net/freeradius/patches/patch-src_lib_debug.c
diff -u /dev/null pkgsrc/net/freeradius/patches/patch-src_lib_debug.c:1.1
--- /dev/null   Wed Dec 19 22:52:32 2018
+++ pkgsrc/net/freeradius/patches/patch-src_lib_debug.c Wed Dec 19 22:52:32 2018
@@ -0,0 +1,41 @@
+$NetBSD: patch-src_lib_debug.c,v 1.1 2018/12/19 22:52:32 manu Exp $
+
+Fix startup crash when running outside of gdb on BSD systems.
+
+From upstream https://github.com/FreeRADIUS/freeradius-server/commit/1f8cd27b78c011826bc0744debb4ed60b3f0584a
+
+--- src/lib//debug.c.orig      2018-12-16 03:31:31.909930476 +0100
++++ src/lib//debug.c   2018-12-19 10:05:49.848809433 +0100
+@@ -105,13 +105,21 @@
+ 
+ static TALLOC_CTX *talloc_null_ctx;
+ static TALLOC_CTX *talloc_autofree_ctx;
+ 
++/*
++ * On BSD systems, ptrace(PT_DETACH) uses a third argument for
++ * resume address, with the magic value (void *)1 to resume where
++ * process stopped. Specifying NULL there leads to a crash because
++ * process resumes at address 0.
++ */  
+ #ifdef HAVE_SYS_PTRACE_H
+ #  ifdef __linux__
+ #    define _PTRACE(_x, _y) ptrace(_x, _y, NULL, NULL)
++#    define _PTRACE_DETACH(_x) ptrace(PT_DETACH, _x, NULL, NULL)
+ #  else
+ #    define _PTRACE(_x, _y) ptrace(_x, _y, NULL, 0)
++#    define _PTRACE_DETACH(_x) ptrace(PT_DETACH, _x, (void *)1, NULL)
+ #  endif
+ 
+ #  ifdef HAVE_CAPABILITY_H
+ #    include <sys/capability.h>
+@@ -205,9 +213,9 @@
+                               fprintf(stderr, "Writing ptrace status to parent failed: %s", fr_syserror(errno));
+                       }
+ 
+                       /* Detach */
+-                      _PTRACE(PT_DETACH, ppid);
++                      _PTRACE_DETACH(ppid);
+                       exit(0);
+               }
+ 
+               ret = DEBUG_STATE_ATTACHED;



Home | Main Index | Thread Index | Old Index