From owner-freebsd-ports@FreeBSD.ORG Mon Aug 13 23:19:07 2012 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A315106564A; Mon, 13 Aug 2012 23:19:07 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qc0-f182.google.com (mail-qc0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id E92518FC08; Mon, 13 Aug 2012 23:19:06 +0000 (UTC) Received: by qcsg15 with SMTP id g15so3442521qcs.13 for ; Mon, 13 Aug 2012 16:19:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; bh=gaAtxr1mfh3guNtQ2b5E1IzwZoPT/wLEH+s+ycJSObA=; b=I1d450w8moqOMscriVzMUNRY5tKzppuhcJ42Msfon3mr6UJBpUiYEW/R0mErx6pxyO 5Ba3wOetxy+b+xG6DuVBN7cEUPxbacwN2TUUuG3vh9bpG2QOZP8jIHJG3n/MgCXWyJ3Q bExL6Ge2Kl9iVokzzcSAvGcDotz4JiFr0vKOZ/JBVooK1HmX5V1vZvzDqRtOYMMRvScB Z5kOeCU8+o/whmvoAPMTbiTan9HQsSBodrI2APXa1UCeNceVarBdxTwjdIQFGE3bJCZI Qz+nT+7E6fzm+dlkKbiauwDGiqGcbuXcfmnzkRyyF4BCbyEPQWYgoKuKwlZbmbBve7we 7zzA== Received: by 10.229.137.140 with SMTP id w12mr7687009qct.8.1344899940034; Mon, 13 Aug 2012 16:19:00 -0700 (PDT) Received: from kan.dyndns.org (c-24-63-226-98.hsd1.ma.comcast.net. [24.63.226.98]) by mx.google.com with ESMTPS id c5sm1312491qao.22.2012.08.13.16.18.58 (version=SSLv3 cipher=OTHER); Mon, 13 Aug 2012 16:18:58 -0700 (PDT) Date: Mon, 13 Aug 2012 19:18:52 -0400 From: Alexander Kabaev To: Juergen Lock Message-ID: <20120813191852.1daed223@kan.dyndns.org> In-Reply-To: <20120813215212.GA72798@triton8.kn-bremen.de> References: <20120812143124.GA21414@triton8.kn-bremen.de> <5027E2EA.2070508@gwdg.de> <20120812171133.GA26625@triton8.kn-bremen.de> <5027E471.1020800@gwdg.de> <5028022B.3020005@gwdg.de> <20120812231210.GA35081@triton8.kn-bremen.de> <20120813024135.3501fcee@kan.dyndns.org> <20120813201242.5108f145@ernst.jennejohn.org> <20120813215212.GA72798@triton8.kn-bremen.de> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.6; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/yt9HDrw2DBQtoVJR3VGWHu3"; protocol="application/pgp-signature" Cc: freebsd-multimedia@FreeBSD.org, Rainer Hurling , freebsd-ports@FreeBSD.org, Gary Jennejohn Subject: Re: Another vlc 2.0.3 update (new ffmpeg! :) X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Aug 2012 23:19:07 -0000 --Sig_/yt9HDrw2DBQtoVJR3VGWHu3 Content-Type: multipart/mixed; boundary="MP_/9mQ1t0s1jcj1C7K5p0G.9PV" --MP_/9mQ1t0s1jcj1C7K5p0G.9PV Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Mon, 13 Aug 2012 23:52:12 +0200 Juergen Lock wrote: > On Mon, Aug 13, 2012 at 08:12:42PM +0200, Gary Jennejohn wrote: > > On Mon, 13 Aug 2012 02:41:35 -0400 > > Alexander Kabaev wrote: > >=20 > > [snip lots of gdb trace] > >=20 > > > Please check the use of _SC_GETPW_R_SIZE_MAX in vlcpulse.c. This > > > constant is unsupported, so the module tries to allocate a stack > > > buffer with negative size, smashing the stack dead. > > >=20 > >=20 > > Seems like a good idea, but I replaced the rather sloppy > > buf[sysctl(_SC_GETPW_R_SIZE_MAX)]; > > with > > buf[2048]; > > and vlc still core dumps when trying to generate plugins.dat. >=20 > Yeah that seems to be a different issue (rtld). > Juergen Please try this patch. --=20 Alexander Kabaev --MP_/9mQ1t0s1jcj1C7K5p0G.9PV Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=rtld-defer-nodelete.diff diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 95358aa..6f6ac70 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -1743,6 +1743,27 @@ init_dag(Obj_Entry *root) root->dag_inited =3D true; } =20 +static void +process_nodelete(Obj_Entry *root) +{ + const Objlist_Entry *elm; + + /* + * Walk over object DAG and process every dependent object + * that is marked as DF_1_NODELETE. They need to grow own + * dag, which should then be ref-ed separately. + */ + STAILQ_FOREACH(elm, &root->dagmembers, link) { + if (elm->obj !=3D NULL && elm->obj->z_nodelete && + !elm->obj->ref_nodel) { + dbg("obj %s nodelete", elm->obj->path); + init_dag(elm->obj); + ref_dag(elm->obj); + elm->obj->ref_nodel =3D true; + } + } + root->dag_inited =3D true; +} /* * Initialize the dynamic linker. The argument is the address at which * the dynamic linker has been mapped into memory. The primary task of @@ -1932,12 +1953,6 @@ process_needed(Obj_Entry *obj, Needed_Entry *needed,= int flags) flags & ~RTLD_LO_NOLOAD); if (obj1 =3D=3D NULL && !ld_tracing && (flags & RTLD_LO_FILTEES) =3D=3D 0) return (-1); - if (obj1 !=3D NULL && obj1->z_nodelete && !obj1->ref_nodel) { - dbg("obj %s nodelete", obj1->path); - init_dag(obj1); - ref_dag(obj1); - obj1->ref_nodel =3D true; - } } return (0); } @@ -2833,8 +2848,12 @@ dlopen_object(const char *name, int fd, Obj_Entry *r= efobj, int lo_flags, /* Make list of init functions to call. */ initlist_add_objects(obj, &obj->next, &initlist); } + /* + * Process all no_delete objects here, given them own + * DAGs to prevent their dependencies from being unloaded. + */ + process_nodelete(obj); } else { - /* * Bump the reference counts for objects on this DAG. If * this is the first dlopen() call for the object that was --MP_/9mQ1t0s1jcj1C7K5p0G.9PV-- --Sig_/yt9HDrw2DBQtoVJR3VGWHu3 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iD8DBQFQKYthQ6z1jMm+XZYRAnIYAJ45YI4/99OyBPiriOVesCHgH1ETCgCfeEkr YIY9G/AHwpxDMkECk/3W0og= =obK2 -----END PGP SIGNATURE----- --Sig_/yt9HDrw2DBQtoVJR3VGWHu3--