seL4 / seL4

The seL4 microkernel

Home Page:https://sel4.systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`physBase` isn't aligned properly on `ARM_HYP`

nspin opened this issue · comments

physBase is required to be aligned to seL4_SuperSectionBits:

/* For alignment conditions to translate over addrFromPPtr, physBase must be
aligned to at least the size of a SuperSection. */
compile_assert(physBase_aligned, IS_ALIGNED(PHYS_BASE_RAW, seL4_SuperSectionBits));

On ARM_HYP, seL4_SuperSectionBits = 25:

#define seL4_SuperSectionBits 25

However, in hardware/config.py the value of SUPERSECTION_BITS is hard-coded to 24, its value on ARM:

class ARMConfig(Config):
''' Config class for ARM '''
arch = 'arm'
SUPERSECTION_BITS = 24 # 2^24 = 16 MiByte

While this bug may not have caused issues for currently supported platform, I noticed it when testing #976 on ARM_HYP. In this case, physBase is set to 2**24 by hardware/config.py and the assertion in hardware.h fails.

Nice find, and I'm glad that the assert catches it, because that would have been super hard to find at runtime. The value in config.py is just wrong, it needs to depend on whether hyp mode is on or not.