Skip to content
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

Drop support for FreeBSD 10 and 11 from std #89058

Open
asomers opened this issue Sep 17, 2021 · 52 comments
Open

Drop support for FreeBSD 10 and 11 from std #89058

asomers opened this issue Sep 17, 2021 · 52 comments
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. O-freebsd Operating system: FreeBSD T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@asomers
Copy link
Contributor

asomers commented Sep 17, 2021

Rust's standard library currently uses a FreeBSD 10 compatible ABI. But FreeBSD 10 went EoL on October 31, 2018. And now FreeBSD 11 will itself be EoL on September 30, 2021. Isn't it finally time to drop FreeBSD 10 support and update the standard library's ABI to FreeBSD 12, or at least 11?

@nagisa
Copy link
Member

nagisa commented Sep 18, 2021

Ultimately users of the platform are best positioned to answer this question. There are probably quite few casual users of FreeBSD developing rustc, so somebody who is actively involved in the FreeBSD community would likely be best positioned to provide some guidance here.

@asomers
Copy link
Contributor Author

asomers commented Sep 18, 2021

Well, I'm a FreeBSD developer. And I can tell you that we're very proud of our backwards-compatibility, but it doesn't require maintaining new tools for old OS versions. Instead, if a person must use FreeBSD 10, the best way to build new software for it would be to use a snapshot or fork of an old version of the Ports tree. That would include an older version of rustc, one that was known to work with FreeBSD 10. In fact, the ports tree itself quickly drops support for old OS versions (it's in the process of dropping support for 11 right now).

@cemeyer
Copy link

cemeyer commented Sep 22, 2021

I’m also a FreeBSD and Rust developer and would advocate dropping 10 support immediately, and 11 support in a few days, when it is officially EOL.

@delphij
Copy link

delphij commented Sep 22, 2021

I'm also a FreeBSD developer and I would second @cemeyer . FreeBSD 10 support should be gone as it's EoL'ed almost 3 years ago, and FreeBSD 11 support would be ended really soon too.

At FreeBSD we are committed to provide backward compatibility for applications compiled for older version of FreeBSD releases by maintaining stable system call interfaces; for C runtime we are providing versioned symbols, so legacy binaries would call the old interfaces, which are usually wrappers of new interfaces. While we are proud that we have provided compatibility shims which worked well for the old binaries, we generally encourage application developers to adopt newer API to take full advantage of the performance improvements and flexibility on newer FreeBSD releases.

@laffer1
Copy link

laffer1 commented Sep 22, 2021

Dropping FreeBSD 10 support is likely fine at this point. I think it's premature with 11, despite the upcoming EOL date.

@bsdimp
Copy link

bsdimp commented Sep 22, 2021

Dropping FreeBSD 10 is fine. There have been no security updates to it in over 3 years, so nobody with any kind of security concerns are still running it. FreeBSD 11 is about to be in the same boat. Unless there's some really compelling application stuck on FreeBSD 11 that can't recompile and redeploy to FreeBSD 12, it would be far more beneficial to update to FreeBSD 12's ABI. Old ABIs are generally only supported on a best-effort basis. Given how far out of date FreeBSD 10 at this point, that best effort decayed to zero long ago.

I believe that community survey has shown that people have completely moved on from FreeBSD 10.

@bapt
Copy link

bapt commented Sep 22, 2021

Following the freebsd EOL policy is perfectly fine. FreeBSD 10 support should be dropped now, FreeBSD 11 should be dropped by November 1rst.

@valpackett
Copy link
Contributor

12 is about the only real backwards-incompatible break (64-bit inodes) in a long long time. EoL of everything before that is a great event \o/ Rust definitely should start the move into the ino64 world soon (by the end of the year). IIRC the libc crate already has flags to use newer ABI, so they should become the default.

@dch
Copy link

dch commented Sep 22, 2021

as asomers points out, the FreeBSD ports tree (from which all the packages for end users are built), drops support at the same time. Users who don't stay current with a supported FreeBSD release, will stay on the last rust version that they installed, without a path for upgrade.

@dumbbell
Copy link
Contributor

I agree with the proposal too. It makes sense to drop support for FreeBSD 10 now and 11 once it reaches EOL.

@MikaelUrankar
Copy link
Contributor

Drop support for FreeBSD 10 and 11 please.

@asomers
Copy link
Contributor Author

asomers commented Sep 22, 2021

@mirabilos could you please explain your objection?

@emaste
Copy link

emaste commented Sep 22, 2021

There's a related discussion happening for Go now, although Go's avoidance of libc makes it interesting: golang/go#48164

I agree with dropping FreeBSD 10 support immediately and also agree with moving to 12.x the minimum supported version. However, the official EOL is just over a week from the time I'm writing this comment and I would suggest waiting a short time after that, to allow time for a heads-up on FreeBSD mailing lists or elsewhere.

There are a number of companies and others building products and projects on top of FreeBSD who for better or worse continue to use older, unsupported versions. While it is not reasonable (or possible) to accommodate this case long-term, I'd generally like to avoid forcing them into an urgent and unplanned need to upgrade.

@allanjude
Copy link

Specifically, getting to to at least the 12 ABI gets rust onto the good side of the changes to support 64-bit inodes and longer filesystem mountpoints.

@bdrewery
Copy link
Contributor

bdrewery commented Sep 23, 2021

TLDR, Yes, but just removing everything will cause problems on 12+. Builders need to be updated to 12 first. A lot of these symbols are from 7.0 and were used to support 12...
Edit: Thanks @asomers for #89083 which does that. Most of this is moot then but I'll leave it in case someone wants to understand the full picture here as I linked some of the problems I'm aware of, and the problem is not what it seems.

The issue here is far more complex than it seems and discussed more at rust-lang/libc#570.
This post is long because the premise here is (unintentionally) misleading to those who are not aware of the details. There are symbols bound to versions from FreeBSD 7.0 when symbol versioning was introduced, and from FreeBSD 8 for fstatat(2). There may be some from 10 or 11 somewhere too. If we only drop all of these then Rust will no longer work on FreeBSD 12+.

Isn't it finally time to drop FreeBSD 10 support and update the standard library's ABI to FreeBSD 12

  • This only makes sense if the official Rust, and crate, builders are 12, and rustup and git builds on FreeBSD continue to work without external hacks.

It appears the builders are still targeting 11.

But FreeBSD 10 went EoL on October 31, 2018. And now FreeBSD 11 will itself be EoL on September 30, 2021.

"10 (or 11) being EOL" is not very relevant here as noted about the use of 7.0 and 8.0 symbol versions. The reasoning for this (rust-lang/libc#937, rust-lang/libc#936 rust-lang/libc#721) was never about 10 or 11. From what I recall it was because the Rust builder (on FreeBSD 10) was generating unversioned symbol usage that broke on 12 with ABI changes there. Rust only knows about the target OS and arch, not release. So the "10/11" compat was for 12. FreeBSD ports had hacks to generate a "working" rust binary but as soon as a crate was used that touched any of the structs from that PR it would blow up. [1] [2] [3] [4]. Using rustup or building rust from git, or using the bootstrap, also would not work as they lacked the patches we were carrying.

Rust's standard library currently uses a FreeBSD 10 compatible ABI

I agree the symbols targetted currently are for "10" (some are 7+) (from libc basically bundling FreeBSD 11 headers), but as far as I know the majority of symbols are used unversioned which is why the problem was present in the first place. That is, I believe that at that time if we purposely bound every symbol to the version of the symbol for that prototype that was copied into the libc header then on 12 it would not have been crashing (unless using an external C library). (Maybe that's a simple compromise regarding #570 but I haven't thought deeply on it.)

Rust should not have any blanket policy of dropping compat/versioned symbols for "EOL" releases - they may be there for a reason that has nothing to do with the specific version. FreeBSD has symbols from 7 and earlier that are still used today and may be bound to at some point. I just want to be sure this is clear as I suspect some of the votes here from fellow FreeBSD devs may be policy votes, rather than informed technical votes. Changing what version is targeted is fine regarding EOL, but symbols are a more nuanced discussion.

Having said all of that, allowing interoperability between rust and external libraries using FreeBSD's current ABI is important and the reasoning for this compat is not there anymore assuming the official Rust builders are upgraded to 12. But someone needs to consider every piece involved in the ecosystem here before rushing a change in because of a date change. 11 being EOL has little to no effect on anything for Rust beyond interoperability.

We really need rust-lang/libc#570 dealt with to have a target containing the FreeBSD release (with proper header sysroots for cross builds or continued FFI use) or libc flags or special crates or whatever. Either way the real problem is the need for investment to solve and maintain the solution, and how that would need to be mimiced for other platforms to be consistent.

@asomers
Copy link
Contributor Author

asomers commented Sep 23, 2021

@bdrewery, there is already a PR to update the builders: #89083 . That should take care of rustup. And regarding the symbol versions, let me summarize for the benefit of everybody new to this saga:

As we discussed elsewhere, FreeBSD uses ELF symbol versioning, allowing it to occasionally modify libc functions like readdir and stat in a way that is backwards compatible at both the source and binary level. But Rust uses FFI. That's nice for cross-compiling, but it forces Rust to lock its libc to one particular FreeBSD version. For whatever reason, Rust chose 11. The problem with 12+ that bdrewery mentioned is that prior to FreeBSD 12, Rust was linking to symbols such as stat with the default link name "stat". But FreeBSD 12 changed the signature of stat and renamed the old function "stat@FBSD_1.0". That meant that Rust's libc was briefly trying to use FreeBSD 11's stat signature with FreeBSD 12's stat function. Fixing the problem was a matter of specifying the correct link name, as shown in the PRs linked above.

So dropping FreeBSD 10 and 11 support will require removing the FreeBSD 11 link names as well as updating the structure definitions. Most of the new structure definitions are already in libc. The rest can be added quickly.

@valpackett
Copy link
Contributor

FreeBSD 12 changed the signature of stat and renamed the old function "stat@FBSD_1.0"

nitpick: to be clear, 12 introduced the @FBSD_1.5 versions, but the old ones were always (okay, since 7.0) @FBSD_1.0. The "renaming" effect is virtual, just a consequence of unversioned symbols pointing to the latest version.

Rust should not have any blanket policy of dropping compat/versioned symbols for "EOL" releases

I don't think anyone has ever suggested going back to unversioned symbols?

Perhaps this issue should've been called "Update FreeBSD support to use 64-bit inodes, available since FreeBSD 12".

@emaste
Copy link

emaste commented Sep 24, 2021

Indeed - the old version in 11.x is stat@FBSD_1.0, and anything linked for FreeBSD 11.x should reference that. You can examine the symbol table of an 11.x binary to see this, e.g.

ref11-amd64% readelf -s /usr/bin//stat | grep -w stat
    13: 0000000000000000    17 FUNC    GLOBAL DEFAULT  UND stat@FBSD_1.0 (2)

the majority of symbols are used unversioned

To be clear, is this now fixed and all references are to the versioned symbols?

@asomers
Copy link
Contributor Author

asomers commented Sep 24, 2021

To be clear, is this now fixed and all references are to the versioned symbols?

All references in Rust's libc library to symbols that have multiple versions in FreeBSD 11 or later are versioned. References to symbols with a single version, or symbols that haven't had a new version since 11, are unversioned.

@valpackett
Copy link
Contributor

One bonus reason to hurry the transition: the default configuration for riscv64 currently does not enable COMPAT_* flags, so no pre-ino64 ABI there. The riscv64 port is running into this.

@bdrewery
Copy link
Contributor

bdrewery commented Jun 9, 2022

What's the holdup here? Does someone just need to submit a PR? I pushed in a lot of this compat to get things working but am not a fan of it.

@nikic
Copy link
Contributor

nikic commented Jun 20, 2022

FYI #97944 landed, which switches CI to build rustc for FreeBSD 12 rather than 11. (Not entirely sure how that relates to this issue, but it seemed relevant to mention.)

@asomers
Copy link
Contributor Author

asomers commented Jun 20, 2022

Now that rustc is using FreeBSD 12 in CI, the next step is top drop FreeBSD 10 support from libc. We'll have to rebuild rustc to test that change, but no other crates. After that's done we can separately drop FreeBSD 11 support. That might require a little more testing.

@m-ou-se m-ou-se added the I-libs-nominated Nominated for discussion during a libs team meeting. label Oct 11, 2022
@m-ou-se m-ou-se added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 26, 2022
@m-ou-se m-ou-se changed the title Drop support for FreeBSD 10 from std Drop support for FreeBSD 10 and 11 from std Oct 26, 2022
@mjguzik
Copy link
Contributor

mjguzik commented Feb 4, 2023

welp, sigh

Linux support tries to work around stuff by handling ENOSYS at runtime, but we can't do that on FreeBSD due to SIGSYS.

While I'm not fond of this, how about pessimizing binary startup with fetching kern.osreldate. Then io::copy (and possibly many others) can branch on it. Does not solve binary compat, but it is always something. I guess for an initial version I can pessimize it just for code using the copy routine.

EDIT: good news, there is osreldate in the auxv vector, so no need to make any syscalls.

@asomers
Copy link
Contributor Author

asomers commented Feb 4, 2023

Actually, the situation is both better and worse than that. Linux can optimistically attempt copy_file_range and check for ENOSYS because it makes a direct syscall. With FreeBSD, we need to link to libc.so, so we'll get a link-time failure if you invoke the program on a system without copy_file_range. OTOH, if the link succeeds, then there's virtually no chance that the kernel support won't be present, so we don't need to check for ENOSYS. That's why I think that a dlsym-based approach would work. But since it's unrelated to dropping 10 and 11 support, maybe you should open a separate issue?

@bsdimp
Copy link

bsdimp commented Feb 4, 2023

how about pessimizing binary startup with fetching kern.osreldate.

getosreleasedate() will grab this information from the ELF AUX vector w/o a trip into the kernel for any kernel revision that's relevant for this discussion.

@mjguzik
Copy link
Contributor

mjguzik commented Feb 4, 2023

how about pessimizing binary startup with fetching kern.osreldate.

getosreleasedate() will grab this information from the ELF AUX vector w/o a trip into the kernel for any kernel revision that's relevant for this discussion.

that's what i wrote:

there is osreldate in the auxv vector, so no need to make any syscalls.

anyhow i'll be posting a new PR few days from now

@rfcbot rfcbot added the final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. label Feb 13, 2023
@rfcbot
Copy link

rfcbot commented Feb 13, 2023

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot removed the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Feb 13, 2023
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Feb 23, 2023
@rfcbot
Copy link

rfcbot commented Feb 23, 2023

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

This will be merged soon.

@emaste
Copy link

emaste commented May 2, 2024

Should this issue be closed now?

@RalfJung
Copy link
Member

Outside of CI, there's nothing that will ever set the freebsd13 flag in a libc build.

That's not true any more, this is now set by the build script. That doesn't work well for cross-builds but at least when building libc on freebsd, it picks the freebsd API matching the current OS.

Should this issue be closed now?

libc still has support for freebad10 and 11 (and even defaults to 11 when the version can't be detected). But maybe that should be a separate issue? Not sure.

@asomers
Copy link
Contributor Author

asomers commented May 26, 2024

That's not true any more, this is now set by the build script. That doesn't work well for cross-builds but at least when building libc on freebsd, it picks the freebsd API matching the current OS.

Where does it do that? In the main branch, libc's build script still sets freebsd11 unless libc_ci is set.

@RalfJung
Copy link
Member

Ah, I missed the if libc_ci match guards. Though strangely under rustc_dep_of_std it will use freebsd12 if which_freebsd returns Some and freebsd11 otherwise...

@tgross35
Copy link
Contributor

tgross35 commented Aug 17, 2024

Could somebody familiar with this target (@asomers perhaps) create a platform doc page listing the supported version? Just the template here https://github.com/rust-lang/rust/tree/0f26ee4fd95a1c046582dfb18892f520788e2c2c/src/doc/rustc/src/platform-support and linking the targets to it here https://github.com/rust-lang/rust/blob/0f26ee4fd95a1c046582dfb18892f520788e2c2c/src/doc/rustc/src/platform-support.md. It currently isn't very easy to find supported versions, this is usually a good place for it.

Of note - FreeBSD's wiki seems to list 11.4+ supports Rust, I am not sure how that interacts with what is here https://wiki.freebsd.org/Rust.

@clausecker
Copy link

@tgross35 The oldest FreeBSD release we currently support is 13.3. See this page for details. Is this the information you are looking for?

@tgross35
Copy link
Contributor

Do you mean 13.3 is the oldest FreeBSD release that FreeBSD supports, or that is the oldest FreeBSD that rustc is expected to build on? I assumed rustc is somewhere around 12 based on #114521. I was just asking for that (and any other relevant information for building on FreeBSD) to be put into some platform docs so it's a bit easier to find.

@clausecker
Copy link

@tgross35 The former. As for the latter, I do not have information on that.

@emaste
Copy link

emaste commented Oct 19, 2024

Could somebody familiar with this target create a platform doc page listing the supported version

Supported FreeBSD releases are listed at https://www.freebsd.org/security/#sup

Looking at the existing we have:
x86_64-unknown-freebsd - Rust tier 2 w/ host tools
i686-unknown-freebsd - Rust tier 2 w/o host tools
aarch64-unknown-freebsd - Rust tier 3 (same for all following)
armv6-unknown-freebsd
armv7-unknown-freebsd
powerpc64-unknown-freebsd
powerpc64le-unknown-freebsd
powerpc-unknown-freebsd
riscv64gc-unknown-freebsd

We also have support for powerpcspe, and 32- and 64-bit big- and little-endian MIPS. MIPS is only supported through 13.x.

x86_64 (aka amd64) and aarch64 are the two Tier-1 architectures for us.

I agree that based on #114521 the minimum FreeBSD version supported by rustc should be 12.x. There's nothing standing in the way of increasing this to 13.x, if someone has a reason to do so.

I'm not yet sufficiently familiar with Rust to populate the doc pages; I'll see if I can work with @asomers to do so (or find someone else).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. O-freebsd Operating system: FreeBSD T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests