Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Support FreeBSD #419

Closed
wants to merge 11 commits into from
Closed

Support FreeBSD #419

wants to merge 11 commits into from

Conversation

valpackett
Copy link
Contributor

Hi, this is sort of a work-in-progress but I have Lucet working on FreeBSD/amd64. Not many changes here but wasi-common needs to be updated somehow…

  • wasi-common/yanix requires fixes — wasi-common/yanix: fix FreeBSD support wasmtime#756 for the upstream version, but lucet uses an older one (0.7.0) — I have a backport for that locally, but it would be better if lucet could upgrade
  • linking (with lld) sort of requires -z notext, otherwise: ld.lld: error: can't create dynamic relocation R_X86_64_64 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output — ?? Should I just use notext in the default flags, or is there some very well hidden settings for the output to be fully position-independent?
  • We'll have wasi-libc and compiler-rt as an OS package. WASI_SDK=/usr/local seems to work fine with that.
  • Some PoisonErrors are happening in tests o_0 but real examples work fine.
% LDFLAGS="-z notext -shared $PWD/target/debug/liblucet_runtime.so $PWD/target/debug/liblucet_wasi.so $PWD/lucet-builtins/build/libbuiltins.so" LD=ld.lld90 target/debug/lucetc --builtins=lucet-builtins/build/libbuiltins.so --bindings=lucet-wasi/bindings.json --emit so -o qr-lc.so ~/Downloads/qr2text.wasm
% RUST_BACKTRACE=1 target/debug/lucet-wasi qr-lc.so hi

[shows qr code]
Test failures (PoisonError)
% LD=ld.lld90 LDFLAGS="-shared -z notext" WASI_SDK=/usr/local cargo test

[…]
failures:

---- handle_host_signal stdout ----
thread 'handle_host_signal' panicked at 'unexpected wait status: Exited(Pid(82536), 0)', lucet-runtime/tests/guest_fault.rs:3:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- hit_sigstack_guard_page stdout ----
thread 'hit_sigstack_guard_page' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:35:16

---- sigsegv_handler_during_guest stdout ----
thread 'sigsegv_handler_during_guest' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:35:16

---- sigsegv_handler_saved_restored stdout ----
thread 'sigsegv_handler_saved_restored' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:35:16

---- fatal_continue_signal_handler stdout ----
thread 'fatal_continue_signal_handler' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:21:16

---- hostcall_error stdout ----
thread 'hostcall_error' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:21:16

---- oob stdout ----
thread 'oob' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:21:16

---- sigaltstack_restores stdout ----
thread 'sigaltstack_restores' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:21:16

---- illegal_instr stdout ----
thread 'illegal_instr' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:21:16

@iximeow
Copy link
Contributor

iximeow commented Feb 10, 2020

This is rad! I'm glad to see how small the diff is too :)

I suspect the linker error you're seeing is us doing something funny in writing relocations. I don't recall off the top of my head what segment these would end up in, but if for some reason it was readonly I think that would make the error you see.

The PoisonError you see probably has the same root cause as #323, where we return from a signal handler in a way that isn't portable. Since it's in fault-handling path you likely wouldn't see it in a well-behaved program, but I bet you'll be able to reproduce that issue on FreeBSD if the tests are reporting errors.

Do you know how we might set up FreeBSD testing using GitHub CI? If we're working on FreeBSD it would be good to ensure we don't break that in the future, though it may end up similar to macos where we can't guarantee full functionality (see also: our signal handler still misbehaves on macos)

@pchickey
Copy link
Contributor

Thank you for working on this!

With regard to our out-of-date wasi-common dependency- @kubkon and I have been working on some major renovations to the library, using a new code generator https://github.com/kubkon/wiggle. This work will eliminate a bunch of duplicated code and give us a good path to support future snapshots. I've held off on updating wasi-common until those changes are made, because most of the changes needed to support the current version would change yet again. I expect all of that to land before the end of the month.

@valpackett
Copy link
Contributor Author

some major renovations to the library

Cool, I'll wait for that then.

set up FreeBSD testing using GitHub CI?

Not with GitHub Actions right now, but Cirrus (example) and builds.sr.ht are the two well known options.

may end up similar to macos where we can't guarantee full functionality

That's fine. My primary use case so far would be trying to enable Firefox's rlbox sandboxing, which they do use on macOS I think.

@pchickey
Copy link
Contributor

Thanks for the pointers on CI. The Cirrus setup looks reasonable. I'll look into that sometime when I get a chance.

It turns out that Firefox's rlbox uses a different signal handler than the one that lucet-runtime typically installs, so if that is your only use case, it may end up working without fixing that bad behavior in Lucet.

@iximeow
Copy link
Contributor

iximeow commented Mar 2, 2020

Nudging this: can you retry Lucet's tests with the changes from multiplatform-signals? see also: #437

If you get to it soon, I expect you'll see test failures in the expect_stack_overflow_locals series of tests, which are an unhandled issue in multiplatform-signals. That's a WIP error case on all platforms, so you seeing no PoisonError would still be a good start.

@valpackett
Copy link
Contributor Author

Nah, still PoisonErrors:

runtime test results
~/src/github.com/bytecodealliance/lucet/lucet-runtime % LD=ld.lld90 LDFLAGS="-shared -z notext" WASI_SDK=/usr/local cargo test -- --nocapture --test-threads=1                                                                            23:26
warning: unnecessary parentheses around assigned value
    --> /usr/home/greg/src/github.com/rust-lang/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs:1038:38
     |
1038 | pub const LC_COLLATE_MASK: ::c_int = (1 << 0);
     |                                      ^^^^^^^^ help: remove these parentheses
     |
     = note: `#[warn(unused_parens)]` on by default

warning: unnecessary parentheses around assigned value
    --> /usr/home/greg/src/github.com/rust-lang/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs:1039:36
     |
1039 | pub const LC_CTYPE_MASK: ::c_int = (1 << 1);
     |                                    ^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around assigned value
    --> /usr/home/greg/src/github.com/rust-lang/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs:1040:39
     |
1040 | pub const LC_MONETARY_MASK: ::c_int = (1 << 2);
     |                                       ^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around assigned value
    --> /usr/home/greg/src/github.com/rust-lang/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs:1041:38
     |
1041 | pub const LC_NUMERIC_MASK: ::c_int = (1 << 3);
     |                                      ^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around assigned value
    --> /usr/home/greg/src/github.com/rust-lang/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs:1042:35
     |
1042 | pub const LC_TIME_MASK: ::c_int = (1 << 4);
     |                                   ^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around assigned value
    --> /usr/home/greg/src/github.com/rust-lang/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs:1043:39
     |
1043 | pub const LC_MESSAGES_MASK: ::c_int = (1 << 5);
     |                                       ^^^^^^^^ help: remove these parentheses

warning: unnecessary parentheses around assigned value
  --> /usr/home/greg/src/github.com/rust-lang/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs:33:32
   |
33 | pub const _MC_FLAG_MASK: u32 = (_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE);
   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses

warning: src/context/context_asm.S:215:1: warning: DWARF2 only supports one section per compilation unit
warning: .section .note.GNU-stack,"",%progbits
warning: ^
warning: src/guest_fault/traps.S:69:2: warning: DWARF2 only supports one section per compilation unit
warning:  .section ".note.GNU-stack","",@progbits
warning:  ^
warning: use of deprecated item 'std::error::Error::description': use the Display impl or to_string()
  --> lucetc/src/load.rs:37:33
   |
37 |             result.push_str(err.description());
   |                                 ^^^^^^^^^^^
   |
   = note: `#[warn(deprecated)]` on by default

    Finished test [unoptimized + debuginfo] target(s) in 0.31s
     Running /usr/home/greg/src/github.com/bytecodealliance/lucet/target/debug/deps/lucet_runtime-5d2ee8d12b8ab10f

running 2 tests
test c_api::tests::expand_heap ... ok
test c_api::tests::yield_resume ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running /usr/home/greg/src/github.com/bytecodealliance/lucet/target/debug/deps/entrypoint-9d79741957a4fa1b

running 31 tests
test allocator_create_region ... ok
test allocator_create_region_and_increment ... ok
test allocator_create_two_regions ... ok
test entrypoint_callback ... ok
test entrypoint_ctype ... ok
test mock_calc_add_10 ... ok
test mock_calc_add_2 ... ok
test mock_calc_add_f32_10 ... ok
test mock_calc_add_f32_2 ... ok
test mock_calc_add_f64_10 ... ok
test mock_calc_add_f64_2 ... ok
test mock_calc_add_mixed_20 ... ok
test mock_calc_add_then_mul ... ok
test mock_calc_invalid_entrypoint ... ok
test mock_calc_mul_2 ... ok
test mock_imported_entrypoint ... ok
test mock_typecheck_entrypoint_too_few_args ... ok
test mock_typecheck_entrypoint_too_many_args ... ok
test mock_typecheck_entrypoint_wrong_args ... ok
test wat_calc_add_10 ... ok
test wat_calc_add_2 ... ok
test wat_calc_add_f32_10 ... ok
test wat_calc_add_f32_2 ... ok
test wat_calc_add_f64_10 ... ok
test wat_calc_add_f64_2 ... ok
test wat_calc_invalid_entrypoint ... ok
test wat_calc_mul_2 ... ok
test wat_imported_entrypoint ... ok
test wat_typecheck_entrypoint_too_few_args ... ok
test wat_typecheck_entrypoint_too_many_args ... ok
test wat_typecheck_entrypoint_wrong_args ... ok

test result: ok. 31 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running /usr/home/greg/src/github.com/bytecodealliance/lucet/target/debug/deps/globals-fbd98e53e02d7113

running 6 tests
test defined_globals ... ok
test get_both_globals ... ok
test get_global0 ... ok
test globals_initialized ... ok
test mutate_global0 ... ok
test reject_import ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running /usr/home/greg/src/github.com/bytecodealliance/lucet/target/debug/deps/guest_fault-941cf6cbe1636abf

running 12 tests
test fatal_abort ... ok
test fatal_continue_signal_handler ... thread 'main' panicked at 'mmap succeeds: Sys(EINVAL)', lucet-runtime/tests/guest_fault.rs:3:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
FAILED
test fatal_handler ... ok
test fatal_terminate_signal_handler ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', lucet-runtime/tests/guest_fault.rs:3:1
FAILED
test handle_host_signal ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:35:16
FAILED
test hit_sigstack_guard_page ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:35:16
FAILED
test hostcall_error ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:21:16
FAILED
test illegal_instr ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:21:16
FAILED
test oob ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:21:16
FAILED
test sigaltstack_restores ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:21:16
FAILED
test sigsegv_handler_during_guest ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:35:16
FAILED
test sigsegv_handler_saved_restored ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:35:16
FAILED

failures:

failures:
    fatal_continue_signal_handler
    fatal_terminate_signal_handler
    handle_host_signal
    hit_sigstack_guard_page
    hostcall_error
    illegal_instr
    oob
    sigaltstack_restores
    sigsegv_handler_during_guest
    sigsegv_handler_saved_restored

test result: FAILED. 2 passed; 10 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test guest_fault'

failures in the expect_stack_overflow_locals series of tests

These tests aren't running, I couldn't figure out how to make them run..

@iximeow
Copy link
Contributor

iximeow commented Mar 2, 2020

Drat. The mmap succeeds error is because there's another MAP_ANON with a bad fd, and that failing poisons the rest of guest_fault.

expect_stack_overflow_locals isn't running for you because the guest_fault suite runs (and fails) first, so cargo stops there. You can run its tests (stack) with cargo test --test stack, or specifically cargo test --test stack expect_stack_overflow_locals. It'll take a while to actually fail on account of the bug in multiplatform-signals, so reproducing it isn't a big concern at the moment.

@valpackett
Copy link
Contributor Author

The mmap succeeds error is because there's another MAP_ANON with a bad fd, and that failing poisons the rest of guest_fault.

Oh. Well that's the same thing as I fixed in region/mmap.rs, easy. Now only 2 fails:

test fatal_abort ... ok
test fatal_continue_signal_handler ... ok
test fatal_handler ... ok
test fatal_terminate_signal_handler ... ok
test handle_host_signal ... ok
test hit_sigstack_guard_page ... ok
test hostcall_error ... ok
test illegal_instr ... ok
test oob ... ok
test sigaltstack_restores ... ok
test sigsegv_handler_during_guest ... thread 'main' panicked at 'munmap succeeds: Sys(EINVAL)', lucet-runtime/tests/guest_fault.rs:3:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
FAILED
test sigsegv_handler_saved_restored ... thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: "PoisonError { inner: .. }"', /usr/home/greg/src/github.com/bytecodealliance/lucet/lucet-runtime/lucet-runtime-tests/src/helpers.rs:35:16
FAILED

@pchickey
Copy link
Contributor

pchickey commented Apr 2, 2020

Now that #437 has landed, we expect things to be a bit better. Do you mind pulling those changes in?

@valpackett
Copy link
Contributor Author

Now that #437 has landed, we expect things to be a bit better. Do you mind pulling those changes in?

I think this is currently based on an earlier version of #437. Of course I'll rebase on master, but what I'm really waiting for is a yanix update..

@valpackett
Copy link
Contributor Author

Okay, I see the wasmtime upgrade has happened, yay! Rebased.

So now, the only dependencies are

And the only test failures are in wasm_spec, all the internals pass!

`LD=ld.lld10 WASI_SDK=/usr/local cargo test` run results
     Running target/debug/deps/lucet_benchmarks-2c993df2918cd317

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/lucet_concurrency_tests-fff138318485c42a

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/killswitch-702e90784e39ce85

running 17 tests
test double_terminate ... ok
test terminate_during_guest_fault_racing_deschedule ... ok
test terminate_entering_guest ... ok
test terminate_during_guest_fault ... ok
test terminate_in_guest ... ok
test terminate_after_guest_fault ... ok
test terminate_after_guest_drop ... ok
test timeout_before_guest_runs ... ok
test timeout_while_yielded ... ok
test timeout_after_guest_runs ... ok
test timeout_after_guest_reset ... ok
test terminate_exiting_guest_before_domain_change ... ok
test terminate_in_hostcall ... ok
test terminate_exiting_guest_after_domain_change ... ok
test terminate_exiting_hostcall ... ok
test terminate_entering_hostcall ... ok
test terminate_exiting_guest_during_terminable_check ... ok

test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/lucet_module-cb398167ab9a7033

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/bindings-e37c2f47fc44e048

running 4 tests
test explicit_from_nonexistent_file ... ok
test explicit ... ok
test explicit_from_garbage_file ... ok
test explicit_from_file ... ok

test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/version-af8dcd9a023c9016

running 1 test
test version_equality ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/lucet_objdump-734b763710cf626c

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/lucet_runtime-8b5ac11a4d0cd7c0

running 2 tests
test c_api::tests::expand_heap ... ok
test c_api::tests::yield_resume ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/entrypoint-be8e77d86a552a51

running 32 tests
test ensure_linked ... ok
test mock_calc_add_f32_10 ... ok
test mock_calc_add_f32_2 ... ok
test mock_calc_invalid_entrypoint ... ok
test mock_calc_add_then_mul ... ok
test mock_calc_add_mixed_20 ... ok
test mock_calc_add_f64_2 ... ok
test mock_calc_add_10 ... ok
test mock_calc_add_f64_10 ... ok
test mock_imported_entrypoint ... ok
test mock_calc_add_2 ... ok
test mock_typecheck_entrypoint_too_few_args ... ok
test mock_calc_mul_2 ... ok
test mock_typecheck_entrypoint_too_many_args ... ok
test mock_typecheck_entrypoint_wrong_args ... ok
test wat_calc_invalid_entrypoint ... ok
test wat_calc_add_f64_10 ... ok
test wat_calc_mul_2 ... ok
test wat_calc_add_f32_2 ... ok
test wat_calc_add_f64_2 ... ok
test wat_imported_entrypoint ... ok
test wat_calc_add_f32_10 ... ok
test wat_typecheck_entrypoint_too_many_args ... ok
test wat_calc_add_2 ... ok
test wat_calc_add_10 ... ok
test wat_typecheck_entrypoint_too_few_args ... ok
test wat_typecheck_entrypoint_wrong_args ... ok
test entrypoint_callback ... ok
test allocator_create_region ... ok
test allocator_create_two_regions ... ok
test allocator_create_region_and_increment ... ok
test entrypoint_ctype ... ok

test result: ok. 32 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/globals-d6527d5c9c46a867

running 6 tests
test globals_initialized ... ok
test reject_import ... ok
test get_global0 ... ok
test get_both_globals ... ok
test mutate_global0 ... ok
test defined_globals ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/guest_fault-98d6db31c8ca8d44

running 17 tests
test ensure_linked ... ok
test fatal_abort ... ok
test hit_sigstack_guard_page ... ok
test fatal_handler ... ok
test fatal_terminate_signal_handler ... ok
test illegal_instr_manuals_signal ... ok
test handle_host_signal ... ok
test illegal_instr_manual_signal ... ok
test sigsegv_handler_during_guest ... ok
test sigsegv_handler_saved_restored ... ok
test sigaltstack_restores ... ok
test illegal_instr ... ok
test oob ... ok
test fatal_continue_signal_handler ... ok
test guest_after_fault_without_reset ... ok
test illegal_instr_manual_sigstack ... ok
test hostcall_error ... ok

test result: ok. 17 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/host-d9a842eb742ba8bd

running 20 tests
test ensure_linked ... ok
test load_nonexistent_module ... ok
test coop_factorials ... ok
test missing_resume_val ... ok
test resume_wrong_type ... ok
test resume_unexpected ... ok
test run_hostcall_missing_embed_ctx ... ok
test run_hostcall_bad_borrow ... ok
test run_hostcall_multiple_vmctx ... ok
test run_hostcall_yield_expects_5 ... ok
test run_hostcall_yields_5 ... ok
test yield_factorials ... ok
test switch_threads_resume ... ok
test instantiate_trivial ... ok
test run_hostcall_error_unwind ... ok
test load_module ... ok
test run_fpe ... ok
test run_trivial ... ok
test run_hello ... ok
test run_hostcall_error ... ok

test result: ok. 20 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/instruction_counting-7d38967aaa5fd594

running 3 tests
test ensure_linked ... ok
test check_instruction_count ... ok
test check_instruction_count_off ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/memory-b631683d8a0d481e

running 3 tests
test ensure_linked ... ok
test current_memory_hostcall ... ok
test grow_memory_hostcall ... ok

test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/stack-6c6c91c720084f05

running 14 tests
test ensure_linked ... ok
test expect_ok_locals3_1 ... ok
test expect_ok_locals64_481 ... ok
test expect_ok_locals64_2 ... ok
test expect_ok_locals64_1 ... ok
test expect_stack_overflow_locals64_481 ... ok
test expect_ok_locals_1page_30 ... ok
test expect_ok_locals_1page_1 ... ok
test expect_ok_locals_1page_2 ... ok
test expect_stack_overflow_locals_1page_31 ... ok
test expect_ok_locals_multipage_2 ... ok
test expect_ok_locals_multipage_1 ... ok
test expect_stack_overflow_locals_multipage_6 ... ok
test expect_ok_locals_multipage_5 ... ok

test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/start-1a7984c9b2eaf06d

running 9 tests
test ensure_linked ... ok
test no_start_without_reset ... ok
test global_init ... ok
test no_start ... ok
test start_and_reset ... ok
test manual_signal_handler_ok ... ok
test start_is_required ... ok
test start_and_call ... ok
test manual_sigstack_ok ... ok

test result: ok. 9 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/strcmp-e773f975256981ab

running 6 tests
test ensure_linked ... ok
test strcmp_abc_abcd ... ok
test strcmp_fault_test ... ok
test strcmp_abcd_abc ... ok
test strcmp_def_abc ... ok
test strcmp_abc_abc ... ok

test result: ok. 6 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/val-090b607cd4109f13

running 12 tests
test untyped_ret_val_from_bool_true ... ok
test untyped_ret_val_from_f32 ... ok
test untyped_ret_val_from_bool_false ... ok
test untyped_ret_val_from_f64 ... ok
test untyped_ret_val_from_i16 ... ok
test untyped_ret_val_from_i32 ... ok
test untyped_ret_val_from_i8 ... ok
test untyped_ret_val_from_u16 ... ok
test untyped_ret_val_from_u32 ... ok
test untyped_ret_val_from_i64 ... ok
test untyped_ret_val_from_u8 ... ok
test untyped_ret_val_from_u64 ... ok

test result: ok. 12 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/version_checks-640aeb4c849a99f4

running 2 tests
test ensure_linked ... ok
test reject_old_modules ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/lucet_runtime_example-3d38094423c4ee4e

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/lucet_runtime_internals-e5e7fb195fef8d01

running 74 tests
test alloc::tests::badly_specced_instance_does_not_take_up_capacity ... ok
test alloc::tests::context_alloc_child ... ok
test alloc::tests::allocate_runtime_works ... ok
test alloc::tests::alloc_reset ... ok
test alloc::tests::guardless_heap_create ... ok
test alloc::tests::context_stack_pattern ... ok
test alloc::tests::expand_heap_once ... ok
test alloc::tests::alloc_grow_reset ... ok
test alloc::tests::reject_heap_memory_size_exeeds_instance_limits ... ok
test alloc::tests::reject_heap_memory_size_exceeds_region_limits ... ok
test alloc::tests::drop_region_first ... ok
test alloc::tests::reject_large_guard_heap ... ok
test alloc::tests::reject_undersized_address_space ... ok
test alloc::tests::expand_past_spec_max ... ok
test alloc::tests::initial_empty_guardless_expand_heap_once ... ok
test alloc::tests::expand_past_spec_max_with_custom_limit ... ok
test alloc::tests::reject_unaligned_sigstack ... ok
test alloc::tests::reject_initial_oversize_heap ... ok
test alloc::tests::expand_heap_twice ... ok
test alloc::tests::guardless_expand_heap_once ... ok
test context::tests::c_child::call_child_setcontext ... ok
test context::tests::c_child::call_child ... ok
test alloc::tests::initial_empty_expand_heap_once ... ok
test context::tests::c_child::call_child_setcontext_twice ... ok
test context::tests::c_child::call_child_twice ... ok
test context::tests::c_child::test_child_10_args ... ok
test context::tests::c_child::test_child_3_args ... ok
test context::tests::c_child::call_returning_child ... ok
test context::tests::c_child::test_child_4_args ... ok
test alloc::tests::slot_counts_work_with_random_alloc ... ok
test context::tests::c_child::test_child_5_args ... ok
test context::tests::c_child::test_child_6_args ... ok
test context::tests::init_rejects_unaligned ... ok
test context::tests::context_offsets_correct ... ok
test context::tests::rust_child::call_child ... ok
test context::tests::c_child::test_child_7_args ... ok
test context::tests::rust_child::call_child_setcontext ... ok
test context::tests::c_child::test_child_8_args ... ok
test context::tests::rust_child::call_child_setcontext_twice ... ok
test context::tests::c_child::test_child_9_args ... ok
test context::tests::rust_child::call_child_twice ... ok
test context::tests::rust_child::call_returning_child ... ok
test context::tests::rust_child::child_10_args ... ok
test context::tests::rust_child::child_10_fp_args ... ok
test context::tests::rust_child::child_3_args ... ok
test context::tests::rust_child::child_4_args ... ok
test context::tests::rust_child::child_5_args ... ok
test context::tests::rust_child::child_6_args ... ok
test context::tests::rust_child::child_6_fp_args ... ok
test alloc::tests::reject_debug_sigstack_smaller_than_12kib ... ok
test context::tests::rust_child::child_7_args ... ok
test alloc::tests::reuse_slot_works ... ok
test alloc::tests::reject_sigstack_smaller_than_min ... ok
test context::tests::rust_child::child_8_args ... ok
test context::tests::rust_child::child_9_args ... ok
test alloc::tests::slot_counts_work ... ok
test context::tests::rust_child::child_7_fp_args ... ok
test context::tests::rust_child::child_8_fp_args ... ok
test context::tests::rust_child::child_9_fp_args ... ok
test instance::termination_details_any_typing ... ok
test context::tests::rust_child::guest_access_tls ... ok
test context::tests::rust_child::guest_realloc_string ... ok
test context::tests::rust_child::returning_add_f32 ... ok
test context::tests::rust_child::returning_add_u32 ... ok
test context::tests::rust_child::returning_add_u64 ... ok
test context::tests::rust_child::returning_add_f64 ... ok
test alloc::tests::accept_small_guard_heap ... ok
test alloc::tests::custom_size_does_not_break_default ... ok
test alloc::tests::expand_past_heap_limit ... ok
test module::sparse_page_data::tests::instantiate_valid_sparse_data ... ok
test module::sparse_page_data::tests::valid_sparse_page_data ... ok
test alloc::tests::slot_counts_work_with_mixed_alloc ... ok
test alloc::tests::slot_counts_work_with_custom_random_alloc ... ok
test region::mmap::tests2::test_aligned_mem ... ok

test result: ok. 74 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/lucet_runtime_macros-331af8248eef0641

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/lucet_spectest-3ec691f94adb6650

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/spec_test-c0e16bb9725e4d43

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

     Running target/debug/deps/wasm_spec-008b2ba0067f6fc5

running 70 tests
test break_drop ... ok
test elem ... FAILED
test custom ... ok
test comments ... ok
test f32_bitwise ... ok
test block ... ok
test call ... ok
test br_if ... ok
test conversions ... ok
test endianness ... ok
test f64_bitwise ... ok
test fac ... ok
test br ... ok
test binary ... ok
test forward ... ok
test call_indirect ... ok
test f32_ ... ok
test f32_cmp ... ok
test float_misc ... ok
test get_local ... ok
test address ... ok
test func_ptrs ... ok
test f64_cmp ... ok
test f64_ ... ok
test inline_module ... ok
test data ... FAILED
test float_memory ... ok
test float_literals ... ok
test globals ... FAILED
test const_ ... ok
test i32_ ... ok
test int_literals ... ok
test i64_ ... ok
test memory_redundancy ... ok
test if_ ... ok
test func ... ok
test labels ... ok
test memory_grow ... ok
test select ... ok
test loop_ ... ok
test memory_trap ... ok
test store_retval ... ok
test linking ... FAILED
test set_local ... ok
test token ... ok
test return_ ... ok
test memory ... ok
test type_ ... ok
test switch ... ok
test nop ... ok
test tee_local ... ok
test unreached_invaild ... ok
test typecheck ... ok
test align ... ok
test start ... FAILED
test utf8_custom_section_id ... ok
test utf8_import_field ... ok
test utf8_import_module ... ok
test utf8_invalid_encoding ... ok
test unreachable ... ok
test exports ... ok
test br_table ... ok
test int_exprs ... ok
test traps ... ok
test unwind ... ok
test imports ... FAILED
test stack ... ok
test left_to_right ... ok
test float_exprs ... ok
test skip_stack_guard_page ... ok

failures:

---- elem stdout ----
module None
module None
module None
thread 'elem' panicked at 'creation of elements for undeclared table! only table 0 is implicitly declared', lucetc/src/module.rs:380:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- data stdout ----
module None
module None
module None
module None
module None
module None
skipped unsupported command
module None
skipped unsupported command
module None
skipped unsupported command
module None
skipped unsupported command
module None
module None
module None
module None
module None
module None
module None
module None
module None
module None
module None
module None
module None
skipped unsupported command
module None
skipped unsupported command
module None
module None
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
skipped unsupported command
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_invalid
assert_invalid
assert_invalid
assert_invalid
assert_invalid
assert_invalid
25 passed
7 skipped:
SKIP in Module, line 50: Unsupported by lucetc
SKIP in Module, line 55: Unsupported by lucetc
SKIP in Module, line 61: Unsupported by lucetc
SKIP in Module, line 66: Unsupported by lucetc
SKIP in Module, line 137: Unsupported by lucetc
SKIP in Module, line 143: Unsupported by lucetc
SKIP in AssertUnlinkable, line 211: Unsupported by lucetc
13 failures:
FAIL in AssertUnlinkable, line 162: UnexpectedSuccess
FAIL in AssertUnlinkable, line 170: UnexpectedSuccess
FAIL in AssertUnlinkable, line 178: UnexpectedSuccess
FAIL in AssertUnlinkable, line 186: UnexpectedSuccess
FAIL in AssertUnlinkable, line 194: UnexpectedSuccess
FAIL in AssertUnlinkable, line 220: UnexpectedSuccess
FAIL in AssertUnlinkable, line 227: UnexpectedSuccess
FAIL in AssertUnlinkable, line 235: UnexpectedSuccess
FAIL in AssertUnlinkable, line 243: UnexpectedSuccess
FAIL in AssertUnlinkable, line 251: UnexpectedFailure("Program error")
FAIL in AssertUnlinkable, line 258: UnexpectedFailure("Program error")
FAIL in AssertUnlinkable, line 266: UnexpectedFailure("Program error")
FAIL in AssertUnlinkable, line 273: UnexpectedFailure("Program error")
thread 'data' panicked at 'data had 13 failures', lucet-spectest/tests/wasm-spec.rs:9:9

---- globals stdout ----
module None
assert_return (invoke None get-a []) [I32(-2)]
assert_return (invoke None get-b []) [I64(-5)]
assert_return (invoke None get-x []) [I32(-12)]
assert_return (invoke None get-y []) [I64(-15)]
assert_return (invoke None get-1 []) [F32(-3.0)]
assert_return (invoke None get-2 []) [F64(-4.0)]
assert_return (invoke None get-5 []) [F32(-13.0)]
assert_return (invoke None get-6 []) [F64(-14.0)]
assert_return (invoke None set-x [I32(6)]) []
assert_return (invoke None set-y [I64(7)]) []
assert_return (invoke None set-5 [F32(8.0)]) []
assert_return (invoke None set-6 [F64(9.0)]) []
assert_return (invoke None get-x []) [I32(6)]
assert_return (invoke None get-y []) [I64(7)]
assert_return (invoke None get-5 []) [F32(8.0)]
assert_return (invoke None get-6 []) [F64(9.0)]
assert_invalid
module None
module None
assert_invalid
assert_invalid
assert_invalid
assert_invalid
assert_invalid
assert_invalid
assert_invalid
assert_invalid
assert_invalid
assert_invalid
module None
command failed
assert_malformed
assert_malformed
module None
assert_malformed
assert_malformed
35 passed
1 failures:
FAIL in Module, line 108: UnexpectedFailure("Instantiation error")
thread 'globals' panicked at 'globals had 1 failures', lucet-spectest/tests/wasm-spec.rs:9:9

---- linking stdout ----
module Some("$Mf")
register Some("$Mf") Mf
module Some("$Nf")
command failed
assert_return (invoke Some("$Mf") call []) [I32(2)]
command failed
assert_return (invoke Some("$Nf") Mf.call []) [I32(2)]
command failed
assert_return (invoke Some("$Nf") call []) [I32(3)]
command failed
assert_return (invoke Some("$Nf") call Mf.call []) [I32(2)]
command failed
module None
register None reexport_f
assert_unlinkable
command failed
assert_unlinkable
command failed
module Some("$Mg")
register Some("$Mg") Mg
module Some("$Ng")
command failed
skipped unsupported command
skipped unsupported command
skipped unsupported command
assert_return (invoke Some("$Mg") get []) [I32(42)]
command failed
assert_return (invoke Some("$Ng") Mg.get []) [I32(42)]
command failed
assert_return (invoke Some("$Ng") get []) [I32(43)]
command failed
skipped unsupported command
skipped unsupported command
assert_return (invoke Some("$Mg") get_mut []) [I32(142)]
command failed
assert_return (invoke Some("$Ng") Mg.get_mut []) [I32(142)]
command failed
assert_return (invoke Some("$Mg") set_mut [I32(241)]) []
command failed
skipped unsupported command
skipped unsupported command
assert_return (invoke Some("$Mg") get_mut []) [I32(241)]
command failed
assert_return (invoke Some("$Ng") Mg.get_mut []) [I32(241)]
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
module Some("$Mt")
register Some("$Mt") Mt
module Some("$Nt")
command failed
assert_return (invoke Some("$Mt") call [I32(2)]) [I32(4)]
command failed
assert_return (invoke Some("$Nt") Mt.call [I32(2)]) [I32(4)]
command failed
assert_return (invoke Some("$Nt") call [I32(2)]) [I32(5)]
command failed
assert_return (invoke Some("$Nt") call Mt.call [I32(2)]) [I32(4)]
command failed
assert_trap (invoke Some("$Mt") call [I32(1)])
command failed
assert_trap (invoke Some("$Nt") Mt.call [I32(1)])
command failed
assert_return (invoke Some("$Nt") call [I32(1)]) [I32(5)]
command failed
assert_trap (invoke Some("$Nt") call Mt.call [I32(1)])
command failed
assert_trap (invoke Some("$Mt") call [I32(0)])
command failed
assert_trap (invoke Some("$Nt") Mt.call [I32(0)])
command failed
assert_return (invoke Some("$Nt") call [I32(0)]) [I32(5)]
command failed
assert_trap (invoke Some("$Nt") call Mt.call [I32(0)])
command failed
assert_trap (invoke Some("$Mt") call [I32(20)])
command failed
assert_trap (invoke Some("$Nt") Mt.call [I32(20)])
command failed
assert_trap (invoke Some("$Nt") call [I32(7)])
command failed
assert_trap (invoke Some("$Nt") call Mt.call [I32(20)])
command failed
assert_return (invoke Some("$Nt") call [I32(3)]) [I32(-4)]
command failed
assert_trap (invoke Some("$Nt") call [I32(4)])
command failed
module Some("$Ot")
thread 'linking' panicked at 'creation of elements for undeclared table! only table 0 is implicitly declared', lucetc/src/module.rs:380:21

---- start stdout ----
assert_invalid
assert_invalid
assert_invalid
module None
assert_return (invoke None get []) [I32(68)]
command failed
invoke None inc []
command failed
assert_return (invoke None get []) [I32(69)]
command failed
invoke None inc []
command failed
assert_return (invoke None get []) [I32(70)]
command failed
module None
assert_return (invoke None get []) [I32(68)]
command failed
invoke None inc []
command failed
assert_return (invoke None get []) [I32(69)]
command failed
invoke None inc []
command failed
assert_return (invoke None get []) [I32(70)]
command failed
module None
module None
module None
assert_uninstantiable
command failed
8 passed
11 failures:
FAIL in AssertReturn, line 45: UnexpectedFailure("Runtime error")
FAIL in PerformAction, line 46: UnexpectedFailure("Runtime error")
FAIL in AssertReturn, line 47: UnexpectedFailure("Runtime error")
FAIL in PerformAction, line 48: UnexpectedFailure("Runtime error")
FAIL in AssertReturn, line 49: UnexpectedFailure("Runtime error")
FAIL in AssertReturn, line 74: UnexpectedFailure("Runtime error")
FAIL in PerformAction, line 75: UnexpectedFailure("Runtime error")
FAIL in AssertReturn, line 76: UnexpectedFailure("Runtime error")
FAIL in PerformAction, line 77: UnexpectedFailure("Runtime error")
FAIL in AssertReturn, line 78: UnexpectedFailure("Runtime error")
FAIL in AssertUninstantiable, line 98: UnexpectedSuccess
thread 'start' panicked at 'start had 11 failures', lucet-spectest/tests/wasm-spec.rs:9:9

---- imports stdout ----
module None
register None test
module None
command failed
assert_return (invoke None print32 [I32(13)]) []
command failed
assert_return (invoke None print64 [I64(24)]) []
command failed
assert_invalid
module None
command failed
module None
command failed
module None
command failed
module None
command failed
module None
command failed
module None
command failed
module None
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
module None
command failed
assert_return (invoke None get-0 []) [I32(666)]
command failed
assert_return (invoke None get-1 []) [I32(666)]
command failed
assert_return (invoke None get-x []) [I32(666)]
command failed
assert_return (invoke None get-y []) [I32(666)]
command failed
module None
command failed
module None
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
assert_unlinkable
command failed
module None
thread 'imports' panicked at 'creation of elements for undeclared table! only table 0 is implicitly declared', lucetc/src/module.rs:380:21


failures:
    data
    elem
    globals
    imports
    linking
    start

test result: FAILED. 64 passed; 6 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '-p lucet-spectest --test wasm-spec'

@iximeow
Copy link
Contributor

iximeow commented May 9, 2020

Fantastic! We actually don't pass all wasm spectests on linux or macos either, mostly because we don't support importing wasm globals for the time being, so wasm_spec failing is expected.

That said, if memory serves I think we only fail five suites on those platforms, where start is the here outlier with

8 passed
11 failures:
FAIL in AssertReturn, line 45: UnexpectedFailure("Runtime error")
FAIL in PerformAction, line 46: UnexpectedFailure("Runtime error")
FAIL in AssertReturn, line 47: UnexpectedFailure("Runtime error")
FAIL in PerformAction, line 48: UnexpectedFailure("Runtime error")
FAIL in AssertReturn, line 49: UnexpectedFailure("Runtime error")
FAIL in AssertReturn, line 74: UnexpectedFailure("Runtime error")
FAIL in PerformAction, line 75: UnexpectedFailure("Runtime error")
FAIL in AssertReturn, line 76: UnexpectedFailure("Runtime error")
FAIL in PerformAction, line 77: UnexpectedFailure("Runtime error")
FAIL in AssertReturn, line 78: UnexpectedFailure("Runtime error")
FAIL in AssertUninstantiable, line 98: UnexpectedSuccess
thread 'start' panicked at 'start had 11 failures', lucet-spectest/tests/wasm-spec.rs:9:9

Probably worth checking to see if this varies from other platforms. I think we really just have to get CI squared away at this point, though!

@pchickey
Copy link
Contributor

pchickey commented May 14, 2020

wrt CI: we nearly have finished setting up Circle CI as an additional CI environment. It appears that Circle CI supports FreeBSD as well, so once we have that initial integration set and working, we should be able to add FreeBSD as well. edit: i got cirrus ci and circle ci confused. Nevermind

@Hoverbear
Copy link

@myfreeweb You are such an awesome steward of the ecosystem. :) Thanks for all this, so much.

@valpackett
Copy link
Contributor Author

valpackett commented May 16, 2020

hmm, how am I not hitting the "stack size must be a multiple of host page size" error when testing, when SIGSTKSZ == MINSIGSTKSZ+32768 == 34816?

(hit that with the rlbox/mozilla fork of lucet, when running firefox)

Is that check correct? Why does it matter that stack size is a multiple of page size?

@iximeow
Copy link
Contributor

iximeow commented May 16, 2020

That's a good question. My first suspicion would be that rlbox might be setting a custom stack size derived from the platform, but Limits::default chooses stack_size: 128 * 1024. That might make things fail at runtime there that don't fail in tests? But with a SIGSTKSZ of 34816 I'd expect Limits::validate to error too. We even test that aspect of SIGSTKSZ in reject_unaligned_sigstack, so with a platform SIGSTKSZ == 34816 I'd expect that to fail out of the box..

Can you collect Limits being used by rlbox and see if that's more informative? Hopefully comparing that to Limits::default might explain why tests work here but the runtime errors there. I'd also wonder if we're collecting an incorrect SIGSTKSZ somehow for the default, where rlbox is providing the correct platform-provided SIGSTKSZ and tripping the size check..

As for why it matters, MmapRegion operates on memory in page granularity, so sizes that aren't evenly divisible would, at the least, require rounding up to page size. Off the top of my head, that's important for correctness in having guard pages self-contained in a page not shared with other data, and important in ensuring we do what users ask for, rather than the next closest thing that might work. Platforms specifying a non-page-multiple size certainly is a surprise to me - is that rounded up to a multiple when mapped?

@valpackett
Copy link
Contributor Author

valpackett commented May 16, 2020

Well, if debug_assertions are on by default (I didn't touch anything related to that), here it was 12 * 1024 instead of SIGSTKSZ which is fine.

I'd expect Limits::validate to error too

that is what failed in rlbox I think — I mentioned the "stack size must be a multiple of host page size" string specifically :)

After commenting that assertion out, it barely works in Firefox: ogg mostly works but sometimes crashes, graphite instantly crashes. One backtrace showed drop_alloc. Currently rebuilding with a good page size. UPD yep, that was it, it works now \o/

is that rounded up to a multiple when mapped?

The manpage hints at something like that:

The mmap() system call causes the pages starting at addr and continuing for at most len bytes to be mapped from the object described by fd, starting at byte offset offset. If len is not a multiple of the page size, the mapped region may extend past the specified range. Any such extension beyond the end of the mapped object will be zero-filled.

Platforms specifying a non-page-multiple size certainly is a surprise to me

Must be some historical weirdness, on arm and arm64 MINSIGSTKSZ is 1024 * 4, but on amd64 it's 512 * 4..

@iximeow
Copy link
Contributor

iximeow commented May 16, 2020

UPD yep, that was it, it works now \o/

Great! I'd totally glazed over the debug_assertions config arm when reading earlier, good catch.

cfg-if is a good call too, though you'll also want to include the updated Cargo.lock that gets generated with that dependency. We maintain that it, along with the rest of the source tree, is not changed when building+running tests, which is why d7c573a is failing.

@pchickey pchickey closed this Jun 26, 2020
@pchickey
Copy link
Contributor

This PR was closed as a byproduct of deleting the branch named master. If this is still an active PR, re-open as a new PR against main.

@acfoltzer acfoltzer reopened this Jun 26, 2020
@acfoltzer acfoltzer changed the base branch from master to main June 26, 2020 00:50
@valpackett
Copy link
Contributor Author

wooooo required libc PR is in \o/

Since this also needs newer object, rebased on top of #553.

@pchickey
Copy link
Contributor

pchickey commented Jul 8, 2020

Thanks! #553 is pending some of the integration passing some downstream tests on our internal stuff, and I took some vacation since starting it, should be getting it in within a day or two.

@swills
Copy link

swills commented Jul 13, 2020

Since #553 was closed, can we from draft to ready for review?

@valpackett valpackett marked this pull request as ready for review July 13, 2020 20:48
@valpackett
Copy link
Contributor Author

Rebased, undrafted

@iximeow
Copy link
Contributor

iximeow commented Jul 13, 2020

Undrafting got me to notice

linking (with lld) sort of requires -z notext

again and to follow up there too: #563 is an issue tracking linkage with lld. I think the issue you originally observed should be resolved now - at least trying to use lld on main when writing up that issue, things appeared to work. When #254 lands, hopefully soon, the way we construct .eh_frame will almost certainly break lld usage again in that it'll produce modules that segfault on load.

@valpackett
Copy link
Contributor Author

@iximeow it is resolved, haven't needed any extra flags for a while.

@swills
Copy link

swills commented Aug 15, 2020

ping

@pchickey pchickey mentioned this pull request Aug 17, 2020
@pchickey
Copy link
Contributor

Sorry, this fell off our radar. CircleCI is messed up for forks, I forget the root cause anymore but I rebased and pushed this to #577 to see if we can get it to go green.

We haven't had any time to get CI testing for the freebsd target working - Unfortunately, our team doesn't have bandwidth to support additional platforms in general. If someone can provide a config to run CI in freebsd on either Github CI or CircleCI, we'd welcome it, but at this time we aren't keen to add yet another CI provider. I am willing to merge this support without CI and rely on freebsd contributors to file PRs to fix anything that inadvertently gets broken.

@valpackett
Copy link
Contributor Author

Yeah, I'm fine with that, I basically never expect CI from anyone.

@pchickey
Copy link
Contributor

Merged as #577. Thank you for your work on this!

@pchickey pchickey closed this Aug 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants