Skip to content

Merge jemalloc 5.3.0 - #2755

Merged
bsdjhb merged 16 commits into
CTSRD-CHERI:devfrom
bsdjhb:jemalloc_merge
Nov 11, 2026
Merged

bsdjhb merged 16 commits into
CTSRD-CHERI:devfrom
bsdjhb:jemalloc_merge

Conversation

@bsdjhb

@bsdjhb bsdjhb commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

PR for CI

bsdimp and others added 16 commits February 5, 2025 16:08
Remove generated files. Starting in 5.3.0 these will be regenerated
after the subtree merge. I've not re-done the subtree merge with this
version since all I did was delete. I've also not tagged this.

Sponsored by:		Netflix
Import jemalloc 5.3.0.

This import changes how manage the jemalloc vendor branch (which was
just started anyway). Starting with 5.3.0, we import a clean tree from
the upstream github, removing all the old files that are no longer
upstream, or that we've kept around for some reason. We do this because
we merge from this raw version of jemalloc into the FreeBSD
contrib/jemalloc, then we run autogen stuff, generate all the generated
.h files with gmake, then finally remove much of the generated files in
contrib/jemalloc using an update script.

Sponsored by:		Netflix
Add back more of the release for jemalloc for easier imports
that can be audited for stray changes simply.

However, trim out tests and msvc project files since they are
easy and account for over half the size of the distro.

No functional change.

Sponsored by:		Netflix
Add the xml source to the FreeBSD changes to the jemalloc.3.

No functional change.

Sponsored by:		Netflix
jemalloc_preample.h is generated, and FreeBSD has made some changes
which we update using configure, etc on version updates.

No functional change.

Sponsored by:		Netflix
Gate the namespace dance on this define. This allows us to bootstrap new
versions of jemalloc more easily. One of the steps of import is building
to find what symbols need to be private. When we do that, we don't want
to do this dance.

No functional change.

Sponsored by:		Netflix
…pace

When we're not doing the private namespace remap, we don't need to do
this pragma. This is needed for the bootstrapping path when we import a
new version of jemalloc.

No functional change.

Sponsored by:		Netflix
This brings in a merge from jemalloc 5.3.0. It's almost fully scripted, except:
	Three conflicts resolved by hand:
	include/jemalloc/internal/test_hooks.h	Use the new name
	src/extent.c				Use the new code
	src/jemalloc.c				Use the new code since je_realloc has moved

The script is recorded in FREEBSD-upgrade. The old script did svn
commands that were basically a rebase of our changes. This update has a
series of diff reduction changes before this.

Note: I'd planned on fixing the above three conflicts with commits, but
ran out of time when I did this work in January. I got discouraged when
jemalloc was EOL'd and didn't pick this back up. I did the above by hand
to get this into FreeBSD 15.0

This work is a repeat of the work by Minsoo Choo who did all these
changes and created a pull request. Given the importance of jemalloc, I
audited these changes by redoing them in this series of commits (and
with the script that was checked in). I did this to confince myself and
anybody else in doubt that there was no supply chain attack. The diffs
between this series of commits and Minsoo's work are minor (though the
version skew makes adds some noise). Interested parties can independent
audit each step, I hope. I've listed Minsoo as a co-author since without
his pull request to test again, this wouldn't have been possible.

Thanks to brooks@ for help with getting the jemalloc 3 ABI compat
symbols right.

Co-authored-by: Minsoo Choo <minsoochoo0122@proton.me>
Pull Request: freebsd/freebsd-src#1337
Sponsored by: Netflix
Add back more of the release for jemalloc for easier imports
that can be audited for stray changes simply.

However, trim out tests and msvc project files since they are
easy and account for over half the size of the distro.

No functional change.

Sponsored by:		Netflix
Add the xml source to the FreeBSD changes to the jemalloc.3.

No functional change.

Sponsored by:		Netflix
jemalloc_preample.h is generated, and FreeBSD has made some changes
which we update using configure, etc on version updates.

No functional change.

Sponsored by:		Netflix
Gate the namespace dance on this define. This allows us to bootstrap new
versions of jemalloc more easily. One of the steps of import is building
to find what symbols need to be private. When we do that, we don't want
to do this dance.

No functional change.

Sponsored by:		Netflix
…pace

When we're not doing the private namespace remap, we don't need to do
this pragma. This is needed for the bootstrapping path when we import a
new version of jemalloc.

No functional change.

Sponsored by:		Netflix
This brings in a merge from jemalloc 5.3.0. It's almost fully scripted, except:
	Three conflicts resolved by hand:
	include/jemalloc/internal/test_hooks.h	Use the new name
	src/extent.c				Use the new code
	src/jemalloc.c				Use the new code since je_realloc has moved

The script is recorded in FREEBSD-upgrade. The old script did svn
commands that were basically a rebase of our changes. This update has a
series of diff reduction changes before this.

Note: I'd planned on fixing the above three conflicts with commits, but
ran out of time when I did this work in January. I got discouraged when
jemalloc was EOL'd and didn't pick this back up. I did the above by hand
to get this into FreeBSD 15.0

This work is a repeat of the work by Minsoo Choo who did all these
changes and created a pull request. Given the importance of jemalloc, I
audited these changes by redoing them in this series of commits (and
with the script that was checked in). I did this to confince myself and
anybody else in doubt that there was no supply chain attack. The diffs
between this series of commits and Minsoo's work are minor (though the
version skew makes adds some noise). Interested parties can independent
audit each step, I hope. I've listed Minsoo as a co-author since without
his pull request to test again, this wouldn't have been possible.

Thanks to brooks@ for help with getting the jemalloc 3 ABI compat
symbols right.

Co-authored-by: Minsoo Choo <minsoochoo0122@proton.me>
Pull Request: freebsd/freebsd-src#1337
Sponsored by: Netflix
@bsdjhb
bsdjhb merged commit aeb66ce into CTSRD-CHERI:dev Nov 11, 2026
26 of 30 checks passed
@bsdjhb
bsdjhb deleted the jemalloc_merge branch November 11, 2026 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants