Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Feb 2021 22:08:12 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 253602] devel/glib20: Local patch to glib20 uses a broken and unstable fdwalk implementation
Message-ID:  <bug-253602-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D253602

            Bug ID: 253602
           Summary: devel/glib20: Local patch to glib20 uses a broken and
                    unstable fdwalk implementation
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: desktop@FreeBSD.org
          Reporter: jhb@FreeBSD.org
             Flags: maintainer-feedback?(desktop@FreeBSD.org)
          Assignee: desktop@FreeBSD.org

Created attachment 222539
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D222539&action=
=3Dedit
Patch to the port

Paul Saab found that devel/glib20 was failing to build in a poudriere jail =
on
one of his machines.  We tracked this down to the alloca() in our local pat=
ch
to add fdwalk2() failing and overflowing the stack.  The reason is that the
fdwalk2() implementation uses the kern.file sysctl which fetches a _global_
table of all open files across all processes, meaning that the amount of
required memory scales with the number of processes in the system.  fdwalk2=
()
should instead be using kinfo_getfile() from libutil which fetches only the
open files for the current process (which also uses malloc() to avoid stack
limit issues).  While here, I also noticed that fdwalk2() failed to propaga=
te
the callback's return value to the caller and instead always returns 0 since
*ret was never assigned a value.

The attached patch is untested, but should fix both of these issues.  I was=
n't
quite sure how to convince glib20's port to add libutil as an explicit
dependency (e.g. in LDFLAGS), so I'm hopeful a port maintainer can add that
missing bit and finish this the rest of the way.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-253602-7788>