mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
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>
This commit is contained in:
parent
0a60a81ba3
commit
9f8037ea9c
3 changed files with 35 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue