diff options
author | Simon Glass <sjg@chromium.org> | 2018-10-01 21:12:32 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-10-08 07:34:34 -0600 |
commit | 9f8037ea9ca81fc158bc190f7427f329d96ad76c (patch) | |
tree | 9281878d51a409189bfea57068c6ebe12f13ae99 /arch/sandbox/cpu | |
parent | 0a60a81ba3860946551cb79aa6486aa076e357f3 (diff) | |
download | u-boot-9f8037ea9ca81fc158bc190f7427f329d96ad76c.tar.gz |
sandbox: Unprotect DATA regions in bus tests
On my Ubuntu 18.04.1 machine two driver-model bus tests have started
failing recently. The problem appears to be that the DATA region of the
executable is protected. This does not seem correct, but perhaps there
is a reason.
To work around it, unprotect the regions in these tests before accessing
them.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox/cpu')
-rw-r--r-- | arch/sandbox/cpu/os.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 9fbcb9ef92..d4d6d78dc7 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -636,3 +636,14 @@ void os_abort(void) { abort(); } + +int os_mprotect_allow(void *start, size_t len) +{ + int page_size = getpagesize(); + + /* Move start to the start of a page, len to the end */ + start = (void *)(((ulong)start) & ~(page_size - 1)); + len = (len + page_size * 2) & ~(page_size - 1); + + return mprotect(start, len, PROT_READ | PROT_WRITE); +} |