From 9f8037ea9ca81fc158bc190f7427f329d96ad76c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 1 Oct 2018 21:12:32 -0600 Subject: 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 --- test/dm/bus.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/dm') diff --git a/test/dm/bus.c b/test/dm/bus.c index e9a4028f047..08137a2216a 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -4,6 +4,9 @@ */ #include +#ifdef CONFIG_SANDBOX +#include +#endif #include #include #include @@ -297,6 +300,11 @@ static int dm_test_bus_parent_data_uclass(struct unit_test_state *uts) ut_assertok(uclass_find_device(UCLASS_TEST_BUS, 0, &bus)); drv = (struct driver *)bus->driver; size = drv->per_child_auto_alloc_size; + +#ifdef CONFIG_SANDBOX + os_mprotect_allow(bus->uclass->uc_drv, sizeof(*bus->uclass->uc_drv)); + os_mprotect_allow(drv, sizeof(*drv)); +#endif bus->uclass->uc_drv->per_child_auto_alloc_size = size; drv->per_child_auto_alloc_size = 0; ret = test_bus_parent_data(uts); @@ -440,6 +448,10 @@ static int dm_test_bus_parent_platdata_uclass(struct unit_test_state *uts) ut_assertok(uclass_find_device(UCLASS_TEST_BUS, 0, &bus)); drv = (struct driver *)bus->driver; size = drv->per_child_platdata_auto_alloc_size; +#ifdef CONFIG_SANDBOX + os_mprotect_allow(bus->uclass->uc_drv, sizeof(*bus->uclass->uc_drv)); + os_mprotect_allow(drv, sizeof(*drv)); +#endif bus->uclass->uc_drv->per_child_platdata_auto_alloc_size = size; drv->per_child_platdata_auto_alloc_size = 0; ret = test_bus_parent_platdata(uts); -- cgit v1.2.3