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

Add support for CheriBSD #36

Closed
wants to merge 7 commits into from

Commits on Sep 3, 2023

  1. microatf: ensure that struct atf_tc_s is large enough

    When running the tests on a CheriBSD system on Arm Morello, pointers are
    16 bytes, so the implicit size of 8192 bytes is not large enough to hold
    all of struct atf_tc_impl_s_ and running the tests fails with a bounds
    violation. To fix this issue, this commit explicitly sizes the array
    instead of relying on the alignment and adds a static assertion to the
    source file to ensure this invariant holds. I've also reordered
    struct atf_tc_impl_s_ to avoid padding on CHERI systems.
    arichardson committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    ee4107d View commit details
    Browse the repository at this point in the history
  2. Safely interpose fcntl() on architectures with bounded variadic argum…

    …ents
    
    `fcntl()` abuses C variadic arguments to implement optional parameters.
    We want to forward this argument to the real `fcntl()` call, but doing
    so is non-portable. On most architectures, we can just read an
    `intptr_t`/`void*` and this will give us a (semi-)valid result even if
    no argument/an int was passed instead since `va_arg()` will generally
    read the next argument register or arbitrary data from the stack.
    
    On CHERI-enabled architectures, variadic arguments are tightly
    bounded, which means that reading a `void*` if an `int` was passed will
    result in a runtime trap. This commit adds a switch ensures that we read
    the correct number of bytes from the variadic arguments.
    This ugly workaround would not be needed if a vfcntl() call taking
    a va_list existed, or if fcntl just took an intptr_t argument.
    
    This reduces the number of test failures on CheriBSD Morello from 210
    to 8.
    arichardson committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    ee037af View commit details
    Browse the repository at this point in the history
  3. Fix epoll__event_size test on CHERI systems

    Some systems such as 64-bit CHERI-RISC-V or Arm Morello have 128-bit
    pointers, so for them the sizeof(event) assertion needs to be updated.
    arichardson committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    9c17e21 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    48ba3a4 View commit details
    Browse the repository at this point in the history
  5. Use uintptr_t when reading kevs[i].ident

    This avoids a warning when building for CheriBSD (Morello purecap).
    arichardson committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    6529f5c View commit details
    Browse the repository at this point in the history
  6. Don't run target executables during build when cross-compiling

    Trying to run the test executables during the build to get the list of
    test cases causes my cross-compilation to fail. Skip adding the test cases
    to CTest in that case (but still build them we can run them manually).
    arichardson committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    c8ef343 View commit details
    Browse the repository at this point in the history
  7. Check errno on startup in timerfd__{reset_to_very_long,unmodified_errno}

    Due to a bug in CheriBSD, errno was set non-zero when starting this test,
    but without these checks the test confusingly failed in the later check
    which made me think something was wrong in timerfd_create. Check errno on
    startup to make this more obvious.
    
    See CTSRD-CHERI/cheribsd#1424
    arichardson committed Sep 3, 2023
    Configuration menu
    Copy the full SHA
    ecac389 View commit details
    Browse the repository at this point in the history