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 /include/os.h | |
parent | 0a60a81ba3860946551cb79aa6486aa076e357f3 (diff) |
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 'include/os.h')
-rw-r--r-- | include/os.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/os.h b/include/os.h index 5c797212c25..7116f875780 100644 --- a/include/os.h +++ b/include/os.h @@ -334,4 +334,16 @@ void os_localtime(struct rtc_time *rt); * os_abort() - Raise SIGABRT to exit sandbox (e.g. to debugger) */ void os_abort(void); + +/** + * os_mprotect_allow() - Remove write-protection on a region of memory + * + * The start and length will be page-aligned before use. + * + * @start: Region start + * @len: Region length in bytes + * @return 0 if OK, -1 on error from mprotect() + */ +int os_mprotect_allow(void *start, size_t len); + #endif |