Page MenuHomeFreeBSD

lang/rust: Add COMPAT_FREEBSD11 canary
ClosedPublic

Authored by tobik on Jan 9 2020, 6:27 AM.
Tags
None
Referenced Files
F80220376: D23100.id66674.diff
Fri, Mar 29, 8:17 AM
Unknown Object (File)
Mon, Mar 18, 6:05 PM
Unknown Object (File)
Thu, Mar 14, 9:04 AM
Unknown Object (File)
Mon, Mar 4, 12:29 AM
Unknown Object (File)
Mon, Mar 4, 12:29 AM
Unknown Object (File)
Mon, Mar 4, 12:29 AM
Unknown Object (File)
Mon, Mar 4, 12:29 AM
Unknown Object (File)
Mon, Mar 4, 12:29 AM
Subscribers

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 Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 28631
Build 26663: arc lint + arc unit

Event Timeline

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...)

  • Switch to better C based solution instead
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.

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
  • 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

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

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

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

386

|| 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?

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?

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.