Skip to content

Commit

Permalink
examples/simple: disable UBSAN when building with Zig
Browse files Browse the repository at this point in the history
Zig enables UBSAN on C code by default and it seems to be creating
weird behaviour. If UB is detected at run-time, the program should
panic by executing a `brk` instruction in this case (ARM64 and no OS).

It seems that the Microkit event loop is actually doing different
things depending on whether or not UBSAN is on. Specifically, the
`seL4_NBSendRecv` system call is being made when UBSAN is on, even
though it should never be called in this example code (and is not
called when we turn UBSAN off).

Not sure what's going on, it's still entirely possible that we have
UB in our code. More investigation required.
  • Loading branch information
Ivan-Velickovic committed Jan 16, 2024
1 parent 7144d62 commit 66eb855
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions examples/simple/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ pub fn build(b: *std.Build) void {
"-Werror",
"-Wno-unused-function",
"-mstrict-align",
"-fno-sanitize=undefined", // @ivanv: ideally we wouldn't have to turn off UBSAN
fmtPrint("-DBOARD_{s}", .{ microkit_board }) // @ivanv: shouldn't be needed as the library should not depend on the board
}
});
Expand Down

0 comments on commit 66eb855

Please sign in to comment.