pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/net/freeradius Fix startup crash when running outside ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/00c60ca0a3ef
branches: trunk
changeset: 316816:00c60ca0a3ef
user: manu <manu%pkgsrc.org@localhost>
date: Wed Dec 19 22:52:32 2018 +0000
description:
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
diffstat:
net/freeradius/distinfo | 3 +-
net/freeradius/patches/patch-src_lib_debug.c | 41 ++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletions(-)
diffs (60 lines):
diff -r 92979b3cd986 -r 00c60ca0a3ef net/freeradius/distinfo
--- a/net/freeradius/distinfo Wed Dec 19 22:22:59 2018 +0000
+++ b/net/freeradius/distinfo Wed Dec 19 22:52:32 2018 +0000
@@ -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-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
diff -r 92979b3cd986 -r 00c60ca0a3ef net/freeradius/patches/patch-src_lib_debug.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/net/freeradius/patches/patch-src_lib_debug.c Wed Dec 19 22:52:32 2018 +0000
@@ -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