Bugzilla Automation <[email protected]> has asked freebsd-python (Nobody)
<[email protected]> for maintainer-feedback:
Bug 300269: www/py-bjoern: Fix segfault on import (exported _close/_read/_write
bind to libc)
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300269



--- Description ---
Importing bjoern crashes the interpreter with a segmentation fault (no
Python exception) on every Python and FreeBSD version, including the
current FreeBSD:14 package:

    $ python3.12 -c 'import bjoern'

bjoern/common.h defines exported global variables named _close, _read
and _write (built with -fcommon). FreeBSD's libc and libsys export
functions with those names (FBSDprivate_1.0), so rtld binds the
module's references to them, and _init_common() (common.c:37) then
writes into libsys' .text.

The patch wraps the globals in common.h in "#pragma GCC visibility
push(hidden)" / "pop", so they stay out of the dynamic symbol table and
resolve to the module's own copies. It does not rename anything or
change the code otherwise. PORTREVISION is bumped and the patch in
files/ gets a header saying what it does and its upstream status
(Description, Issue ID, Changeset, TODO).

Impact: no ports depend on it.

Tested:
- poudriere bulk on 15.1-RELEASE amd64 with
  DEFAULT_VERSIONS+=python=3.13: builds, and both modules import from
  the built package;
- poudriere bulk on 15.1-RELEASE amd64 with Python 3.12: builds; in a
  clean chroot bjoern imports without crashing and serves a WSGI
  request (HTTP/1.1 200 OK).

Upstream: 3.2.2 is the latest release, upstream has been inactive
since 2022-09, and the problem is not fixed there.

Reply via email to