Morello: disable VMAP_STACK#24
Conversation
VMAP_STACK checks for kernel stack overflows on kernel entry and reports a fault if the checks fail. This was originally disabled when the Morello port was developed. Since then, commit ef6861b (see [1]) enabled VMAP_STACK by default on arm64. Unfortunately, the VMAP_STACK entry code clobbers [c]sp on entry, causing the stack pointer capability to lose its tag. Since there are not enough scratch registers available at that stage of execution, this commit explicitly disables VMAP_STACK again for Morello. [1] https://lore.kernel.org/all/20250707-arm64_vmap-v1-0-8de98ca0f91c@debian.org/ Signed-off-by: Hesham Almatary <hesham.almatary@cl.cam.ac.uk>
|
I don't think this is sufficient. The patch that enabled VMAP_STACK conditionally is actually part of a series of 8 patches, quite a few things behaved differently without VMAP_STACK: https://lore.kernel.org/all/20250707-arm64_vmap-v1-0-8de98ca0f91c@debian.org/ |
|
Reverting the whole series isn't practical IMHO, things are likely to go wrong when rebasing. I think there are two options:
|
This wasn't enough unfortunately. There was another bad stack check during an exit system call and a task clean-up in the kernel's
I can have a look at implementing that later. I'd need to prioritise the purecap Morello kernel though as hybrid will most likely be obsolete. I was just trying to do the bare minimum for hybrid to get a shell. |
|
Ah right then you'd need to disable all overflow checks. Unfortunately it looks like this is going to be quite a bit of work to maintain no matter what you do. I don't think there should be much difference between hybrid and purecap kernel if you were to amend the checks to use e.g. CTPIDR_EL1. |
VMAP_STACK checks for kernel stack overflows on kernel entry and reports a fault if the checks fail. This was originally disabled when the Morello port was developed. Since then, commit ef6861b (see [1]) enabled VMAP_STACK by default on arm64.
Unfortunately, the VMAP_STACK entry code clobbers [c]sp on entry, causing the stack pointer capability to lose its tag. Since there are not enough scratch registers available at that stage of execution, this commit explicitly disables VMAP_STACK again for Morello.
[1] https://lore.kernel.org/all/20250707-arm64_vmap-v1-0-8de98ca0f91c@debian.org/