Bug 287357 - Deprecated MALLOC_OPTIONS is used in some tests
Summary: Deprecated MALLOC_OPTIONS is used in some tests
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 14.2-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-06-07 12:57 UTC by Ivan Rozhuk
Modified: 2025-06-17 15:55 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Rozhuk 2025-06-07 12:57:42 UTC
MALLOC_OPTIONS was exist before FreeBSD 10, but still found in sources of stable/14

# grep -rsp "MALLOC_OPTIONS" /usr/src/
/usr/src/bin/sh/tests/execution/func1.0:MALLOC_OPTIONS=J ${SH} -c 'g() { g() { :; }; :; }; g' &&
/usr/src/bin/sh/tests/execution/func1.0:MALLOC_OPTIONS=J ${SH} -c 'g() { unset -f g; :; }; g'
/usr/src/contrib/bmake/unit-tests/Makefile:MAKE_TEST_ENV+=	MALLOC_OPTIONS="JA"	# for jemalloc 100
/usr/src/contrib/bmake/unit-tests/dep-colon-bug-cross-file.mk:# on NetBSD 8.0 x86_64 with MALLOC_OPTIONS=JA produces this or a similar
/usr/src/contrib/bmake/unit-tests/opt-file.mk:#	| MALLOC_OPTIONS="JA" \
/usr/src/contrib/netbsd-tests/usr.bin/diff/t_diff.sh:	atf_set "descr" "Test diff(1) with MALLOC_OPTIONS=V (cf. PR bin/26453)"
/usr/src/contrib/netbsd-tests/usr.bin/diff/t_diff.sh:		-x "env MALLOC_OPTIONS=V diff " \
/usr/src/contrib/netbsd-tests/usr.bin/diff/t_diff.sh:	atf_set "descr" "Test diff(1) with no MALLOC_OPTIONS=V"
/usr/src/crypto/openssh/regress/unittests/Makefile.inc:MALLOC_OPTIONS?=	CFGJRSUX
/usr/src/crypto/openssh/regress/unittests/Makefile.inc:TEST_ENV?=		MALLOC_OPTIONS=${MALLOC_OPTIONS}
/usr/src/crypto/openssh/regress/Makefile:TEST_ENV=      "MALLOC_OPTIONS=CFGJRSUX"
/usr/src/crypto/openssh/regress/connect-privsep.sh:if [ -z "$TEST_MALLOC_OPTIONS" ]; then
/usr/src/crypto/openssh/regress/connect-privsep.sh:	mopts=`echo $TEST_MALLOC_OPTIONS | sed 's/./& /g'`
/usr/src/crypto/openssh/regress/connect-privsep.sh:	env MALLOC_OPTIONS="$m" ${SSH} -F $OBJ/ssh_proxy 999.999.999.999 true
/usr/src/crypto/openssh/Makefile.in:		TEST_ENV=MALLOC_OPTIONS="@TEST_MALLOC_OPTIONS@" \
/usr/src/crypto/openssh/Makefile.in:		TEST_MALLOC_OPTIONS="@TEST_MALLOC_OPTIONS@" \
/usr/src/crypto/openssh/configure.ac:	TEST_MALLOC_OPTIONS="AFGJPRX"
/usr/src/crypto/openssh/configure.ac:	TEST_MALLOC_OPTIONS="AJRX"
/usr/src/crypto/openssh/configure.ac:	TEST_MALLOC_OPTIONS="AJRX"
/usr/src/crypto/openssh/configure.ac:	TEST_MALLOC_OPTIONS="SJRU"
/usr/src/crypto/openssh/configure.ac:AC_SUBST([TEST_MALLOC_OPTIONS], [$TEST_MALLOC_OPTIONS])
/usr/src/share/doc/papers/malloc/implementation.ms:.B MALLOC_OPTIONS
/usr/src/tools/regression/bpf/bpf_filter/Makefile:	@-env MALLOC_OPTIONS=J ${.CURDIR}/${TEST}
/usr/src/usr.bin/bmake/unit-tests/Makefile:MAKE_TEST_ENV+=	MALLOC_OPTIONS="JA"	# for jemalloc 100
Comment 1 Ed Maste freebsd_committer freebsd_triage 2025-06-17 15:32:43 UTC
contrib/ and crypto/ will need to be addressed via upstream projects (bmake, NetBSD's tests, OpenSSH)

- bin/sh/tests/execution/func1.0:MALLOC_OPTIONS=J ${SH} -c 'g() { g() { :; }; :; }; g' &&
- bin/sh/tests/execution/func1.0:MALLOC_OPTIONS=J ${SH} -c 'g() { unset -f g; :; }; g'
- tools/regression/bpf/bpf_filter/Makefile:       @-env MALLOC_OPTIONS=J ${.CURDIR}/${TEST}
These should become MALLOC_CONF=junk:true

- usr.bin/bmake/unit-tests/Makefile:MAKE_TEST_ENV+=       MALLOC_OPTIONS="JA"     # for jemalloc 100
MALLOC_CONF=junk:true,abort:true (but not clear why this is a bespoke bmake test, not in contrib/bmake)

- share/doc/papers/malloc/implementation.ms:.B MALLOC_OPTIONS
Old doc reference, proposed removing this old documentation in https://reviews.freebsd.org/D50908
Comment 2 commit-hook freebsd_committer freebsd_triage 2025-06-17 15:54:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=4f33d073003ccd91390709e14e5c1bf1f0c1c85c

commit 4f33d073003ccd91390709e14e5c1bf1f0c1c85c
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2025-06-17 15:33:33 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2025-06-17 15:52:17 +0000

    tests: Update for jemalloc's option parsing

    MALLOC_OPTIONS=J -> MALLOC_CONF=junk:true

    PR:             287357
    Reviewed by:    markj
    Event:          Kitchener-Waterloo Hackathon 202506
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D50910

 bin/sh/tests/execution/func1.0           | 4 ++--
 tools/regression/bpf/bpf_filter/Makefile | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
Comment 3 Ed Maste freebsd_committer freebsd_triage 2025-06-17 15:55:50 UTC
> usr.bin/bmake/unit-tests/Makefile

This one is a false positive, it has both env vars:
MAKE_TEST_ENV+= MALLOC_OPTIONS="JA"     # for jemalloc 100
MAKE_TEST_ENV+= MALLOC_CONF="junk:true" # for jemalloc 510

We could remove the MALLOC_OPTIONS="JA" setting but it doesn't cause any harm. The MALLOC_CONF should be junk:true,abort:true for consistency between the two, though.