Skip to content

Solaris getrandom() support breaks illumos #637

Closed
@jperkin

Description

@jperkin

Building rust 1.30.0 on illumos platforms (specifically SmartOS) results in build failure, which is a regression compared to 1.29.x.

I've tracked this down to the introduction of getrandom() support for Solaris, implemented in 43b4c1b.

The rust build failure itself isn't particularly helpful (abridged):

   Compiling core v0.0.0 (file:///home/pbulk/build/lang/rust/work/rustc-1.30.0-src/src/libcore)
error: Could not compile `core`.
expected success, got: exit code: 101
thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1112:9

but digging in further, I was able to deduce that this was caused by an ENOSYS failure, and truss(1)ing the build showed which syscall was being attempted:

30136/1:        sys#143()                                       Err#89 ENOSYS
30136/1:            Received signal #12, SIGSYS [default]
30136/1:              siginfo: SIG#0

Source code analysis (as I wasn't able to get a useful backtrace) showed that the attempt to call syscall 143 is coming from the Solaris getrandom test introduced in that commit.

If I simply bail early from that function with the following diff:

--- src/vendor/rand/src/rngs/os.rs.orig 2018-10-24 21:38:28.000000000 +0000
+++ src/vendor/rand/src/rngs/os.rs
@@ -675,6 +675,7 @@ mod imp {
     }

     fn getrandom(buf: &mut [u8], blocking: bool) -> libc::c_long {
+        return -1;
         extern "C" {
             fn syscall(number: libc::c_long, ...) -> libc::c_long;
         }

then the build succeeds as normal.

I don't know why the ENOSYS handler here isn't working correctly, so I don't have a proper patch to fix this issue unfortunately. I should also point out that while 143 might be the syscall id for getrandom() on Solaris 11.3, the equivalent syscall on illumos is 126, so it's probably worth adding support for that too. The illumos platform that I build on is an older release which doesn't have getrandom().

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-help-wantedParticipation: help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions