mirror of
https://github.com/clearlinux/graphene.git
synced 2026-09-06 05:41:37 +00:00
[LibOS] Add missing memory barrier in regression/mmap-file.c
Previously, the test could fail if the compiler changed the order of variable assignments (`message` vs `a[4096]`).
This commit is contained in:
committed by
Michał Kowalczyk
parent
b0b29c54c8
commit
4e1d892891
@@ -6,7 +6,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
const char* message;
|
||||
static const char* message;
|
||||
|
||||
void SIGBUS_handler(int sig) {
|
||||
puts(message);
|
||||
@@ -79,6 +79,8 @@ int main(int argc, const char** argv) {
|
||||
}
|
||||
|
||||
message = pid == 0 ? "mmap test 5 passed\n" : "mmap test 8 passed\n";
|
||||
/* need a barrier to assign message before SIGBUS due to a[4096] */
|
||||
asm volatile ("nop" ::: "memory");
|
||||
a[4096] = 0xff;
|
||||
|
||||
if (signal(SIGBUS, SIG_DFL) == SIG_ERR) {
|
||||
|
||||
Reference in New Issue
Block a user