Page MenuHomeFreeBSD

lang/rust: Add COMPAT_FREEBSD11 canary
ClosedPublic

Authored by tobik on Jan 9 2020, 6:27 AM.

Details

Reviewers
jbeich
mikael
Group Reviewers
rust
O5: Ports Framework(Owns No Changed Paths)
portmgr
Commits
rP522968: lang/rust: Add COMPAT_FREEBSD11 canary
Summary

Abort build early when the kernel does not have it. Prevent regular bug reports that deal with this.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 28562
Build 26609: arc lint + arc unit

Event Timeline

tobik created this revision.Jan 9 2020, 6:27 AM
mikael added a comment.Jan 9 2020, 7:30 AM

It seems some sysctl are not present if COMPAT_FREEBSD11 is missing: https://github.com/libstatgrab/libstatgrab/issues/103, why not checking if sysctl vm.stats.vm.v_cache_count suceeds (I haven't tried if it works to be honest)?

Anyway, the issue is not limited to rust. People can have the problem doing the following:

pkg add rust
make -C /usr/ports/www/firefox

The check should probably be duplicated in every consumers (cargo.mk, bsd.gecko.mk...)

tobik updated this revision to Diff 66536.Jan 9 2020, 7:49 AM
  • Switch to better C based solution instead
tobik added a comment.Jan 9 2020, 7:51 AM
In D23100#506250, @mikael.urankar_gmail.com wrote:

It seems some sysctl are not present if COMPAT_FREEBSD11 is missing: https://github.com/libstatgrab/libstatgrab/issues/103, why not checking if sysctl vm.stats.vm.v_cache_count suceeds (I haven't tried if it works to be honest)?
Anyway, the issue is not limited to rust. People can have the problem doing the following:

pkg add rust
make -C /usr/ports/www/firefox

The check should probably be duplicated in every consumers (cargo.mk, bsd.gecko.mk...)

It's ok with me to put something in cargo.mk as soon as we have a good enough check.

tobik edited the summary of this revision. (Show Details)Jan 9 2020, 8:25 AM

I have tested this patch, since I had a kernel without COMPAT_ options around and it does what it tries, this is the output in poudriere:

===========================================================================
=======================<phase: configure      >============================
===>  Configuring for rust-1.40.0
===>   FreeBSD 10 autotools fix applied to /wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/vendor/libssh2-sys/libssh2/config.rpath
===>   FreeBSD 10 autotools fix applied to /wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/vendor/backtrace-sys/src/libbacktrace/config/libtool.m4
===>   FreeBSD 10 autotools fix applied to /wrkdirs/usr/ports/lang/rust/work/rustc-1.40.0-src/vendor/backtrace-sys/src/libbacktrace/configure
Bad system call
=> Sanity check failed: kernel is missing COMPAT_FREEBSD11
=> Aborting build
*** Error code 1

Stop.
make: stopped in /usr/ports/lang/rust
=>> Cleaning up wrkdir
===>  Cleaning for rust-1.40.0
tobik updated this revision to Diff 66613.Jan 11 2020, 8:45 AM
  • Add check to cargo.mk and bsd.gecko.mk too

@madpilot Thanks for testing!

To be complete I would also have to spam it into other ports using lang/rust:

graphics/librsvg2-rust
net-im/fractal
security/suricata
security/suricata5
www/cliqz

But I am not sure if it's worth it?

  • Add check to cargo.mk and bsd.gecko.mk too

@madpilot Thanks for testing!
To be complete I would also have to spam it into other ports using lang/rust:

graphics/librsvg2-rust
net-im/fractal
security/suricata
security/suricata5
www/cliqz

But I am not sure if it's worth it?

IMO it's enough to patch rust, cargo.mk and gecko.mk

mikael accepted this revision.Jan 11 2020, 9:32 AM

@jbeich Are you fine with the changes to bsd.gecko.mk ?

jbeich added a comment.EditedJan 12 2020, 7:18 PM

Looks ugly and doesn't cover runtime (see below) but I won't block landing.

$ pkg install rust ripgrep

$ truss rustc test.rs 2>&1 | tail -5
compat11.stat("(null)",0x0)                      ERR#78 'Function not implemented'
SIGNAL 12 (SIGSYS) code=SI_KERNEL
_umtx_op(0x8011f3500,UMTX_OP_WAIT,0x188aa,0x0,0x0) ERR#4 'Interrupted system call'
<thread 100951 exited>
process killed, signal = 12

$ truss rg test 2>&1 | tail -3
compat11.stat("(null)",0x0)                      ERR#78 'Function not implemented'
SIGNAL 12 (SIGSYS) code=SI_KERNEL
process killed, signal = 12
Mk/bsd.gecko.mk
382 ↗(On Diff #66613)

Necessary for what? www/firefox has lots of dependencies. Please, document why the quirk is needed rather than what it does.

386 ↗(On Diff #66613)

|| and ; are easy to miss. Maybe add indentation to denote the conditional or explicitly use if...fi.

lang/rust/Makefile
149

Why are you testing mknod (a rarely used syscall) insted of fstat?

tobik updated this revision to Diff 66674.Jan 13 2020, 6:49 AM
  • Externalize check
tobik marked 3 inline comments as done.Jan 13 2020, 7:07 AM

Looks ugly and doesn't cover runtime (see below) but I won't block landing.

$ pkg install rust ripgrep
$ truss rustc test.rs 2>&1 | tail -5
compat11.stat("(null)",0x0)                      ERR#78 'Function not implemented'
SIGNAL 12 (SIGSYS) code=SI_KERNEL
_umtx_op(0x8011f3500,UMTX_OP_WAIT,0x188aa,0x0,0x0) ERR#4 'Interrupted system call'
<thread 100951 exited>
process killed, signal = 12
$ truss rg test 2>&1 | tail -3
compat11.stat("(null)",0x0)                      ERR#78 'Function not implemented'
SIGNAL 12 (SIGSYS) code=SI_KERNEL
process killed, signal = 12

Yes, of course, but so far I have only seen people complain on Bugzilla when they are building their own stuff, i.e., kernels without COMPAT_FREEBSD11 + lang/rust and www/firefox. That same user group does not seem to use binary packages.

I suppose I could add an UPDATING entry for this too to cover all the bases but then this is as far as it should go IMHO. Then again binary package users will not read UPDATING either, so it would probably solve nothing.

lang/rust/Makefile
149

It was the first SYS_freebsd11_* one in sys/syscall.h and I just picked it. The only goal here is to check if the kernel has COMPAT_FREEBSD11 syscalls. I do not understand why it matters what syscall we test for?

jbeich accepted this revision.Jan 13 2020, 12:09 PM

Thanks. This version is more readable.

This revision was not accepted when it landed; it landed in state Needs Review.Jan 13 2020, 6:36 PM
This revision was automatically updated to reflect the committed changes.
tobik marked an inline comment as done.