Skip to content

Commit

Permalink
CheriBSD bugs workarounds
Browse files Browse the repository at this point in the history
The correct thing to do, of course, is to fix these upstream, but that requires
understanding exactly what's wrong, and that's harder than just not tickling the
bugs.
  • Loading branch information
nwf-msr committed Oct 18, 2021
1 parent 7d0563a commit d4bb2f2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/pal/pal_consts.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ namespace snmalloc
* - using_readonly
* - not_using
* model.
*
* TODO: There is a known bug in CheriBSD that means round-tripping through
* PROT_NONE sheds capability load and store permissions (while restoring data
* read/write, for added excitement). For the moment, just force this down on
* CHERI.
*/
#ifdef SNMALLOC_CHECK_CLIENT
#if defined(SNMALLOC_CHECK_CLIENT) && !defined(__CHERI_PURE_CAPABILITY__)
static constexpr bool PalEnforceAccess = true;
#else
static constexpr bool PalEnforceAccess = false;
Expand Down
5 changes: 4 additions & 1 deletion src/pal/pal_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ namespace snmalloc

static void print_stack_trace()
{
#ifdef SNMALLOC_BACKTRACE_HEADER
// TODO: the backtrace mechanism does not yet work on CHERI, and causes
// tests which expect to be able to hook abort() to fail. Just skip it
// for the moment.
#if defined(SNMALLOC_BACKTRACE_HEADER) && !defined(__CHERI_PURE_CAPABILITY__)
constexpr int SIZE = 1024;
void* buffer[SIZE];
auto nptrs = backtrace(buffer, SIZE);
Expand Down

0 comments on commit d4bb2f2

Please sign in to comment.