-
-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FreeBSD] mold output sometimes doesn't work if stripped #456
Comments
Thank you for your report. Since it's not easy to set up an environment to reproduce the issue, do you mind if I ask you to help me debug this?
|
The 'Mapsize overflow' error comes from the image activator. Basically, for some binary, the total size of the segments to mmap is too large. Find the binary that causes the problem and put it somewhere so that I can take a look at it. |
mold exclusively uses mmap for all file IO, and it can handle multi-gibibyte input files and output files in a few seconds. This usage pattern may be unique. |
@rui314 I'll do what I can this end. It may be worth you testing a branch with thirdparty updating mimalloc to 2.0.6 to see if anything interesting comes up in CI for other platforms Also, I'm not sure yet that it's a crash, the error appears to be FreeBSD's elf handling just abort the load via:
I'll run mold under gdb/truss to see if I cant identify anything interesting, but @kostikbel should be able to provide some expert insight |
@kostikbel it's reproducible using devel/mold using devel/mimalloc (updated to 2.0.6) today) from ports |
I need a binary that causes the problem. It happens during execve(2) of the binary, due to some peculiarity in the binary format, which is rejected by the in-kernel image activator. It does not occurs during runtime, because runtime simply does not happen. |
Did you miss my #456 (comment) ? Install |
Can you provide direct link to download problematic "Mapsize overflow" error seems caused by too big ELF program header |
@koobs Did you link mold using mold? If so, the problem might not exist in mimalloc but in the mold executable that links the problematic mold executable. |
@rui I'll test both cases (linked with mold, without the issue) and with base lld, and upload binaries here |
mold 1.2 linked with mimalloc 2.0.6 linked with mold 1.2 linked with mold 1.2
File: mold.zip |
I can't reproduce with mold 1.2 linked with mimalloc 2.0.6 linked with lld File: mold-lld.zip |
This is the excerpt from the program headers dump:
I cut the output, the last pasted loadable segment is the obvious culprit, it's memsiz is nonsensical. |
@koobs I cannot reproduce it, so it must be a subtle bug. Can you share not only the executable but object files that you use to create that executable? You can simply zip the entire mold directory. |
Hi @rui314, I maintain the FreeBSD port
The executable
Please let me know if you need more information to get to the bottom of this. Thanks! |
Looks like the word after |
Sorry for lack of clarity on my part. The command-line I posted is the linking stage command-line and contains |
Do you mind if I ask you to build some other program with |
@rui314, ofcourse not. Although, I tried a simple hello world program, and wasn't able to reproduce it with that. Anyways, which one would you like me to try ? |
I set up a FreeBSD 13 machine on AWS, build mold using mold on it and stripped the resulting binary. The issue indeed occured. Here is a comparison of the unstripped and stripped binaries.
As you can see, strip messed up the INTERP segment. Isn't it an issue of FreeBSD's strip command? Nothing seems to be obviously wrong with the mold's output, and the output works if we do not strip it. |
I tried the test again with binutils' strip (
|
Hello, I have reworked on mold port in this patch. And I think I have been fix this issue in the recent commit. Please help me test on this issue to confirm their is no any other problem now! |
Sorry, I add you now. It is the first (or second?) time I work on port. I am not familiar with it. |
Summary
After upgrading the FreeBSD
devel/mimalloc
port version from2.0.5
to2.0.6
on a recent FreeBSD 14-CURRENT build, mold fails to run, outputting the following on invocation:This appears to be related to a recent freebsd base commit bf83941638 by @kostikbel at the end of last year via a review [1] that is not publicly available
Reproduction Environment / Details
Note
1.2
with mimalloc2.0.5
1.1.1
with mimalloc2.0.6
Steps to Reproduce
1.2
with mimalloc2.0.6
on FreeBSD CURRENTmold
commandReferences
[1] https://reviews.freebsd.org/D33359
The text was updated successfully, but these errors were encountered: