Re: [PATCH v2 4/4] arm: replace vector mem type with read-only type

From: Miles Chen
Date: Tue Oct 27 2020 - 03:42:27 EST


On Fri, 2020-10-23 at 11:12 +0100, Russell King - ARM Linux admin wrote:
> On Fri, Oct 23, 2020 at 05:14:37PM +0800, Miles Chen wrote:
> > Since kernel no longer writes to the vector, try to replace
> > the vector mem type with read-only type and remove L_PTE_MT_VECTORS.
> >
> > from Catalin in [1]:
> > "
> > > I don't think this matters since the kernel no longer writes to the
> > > vectors page at run-time but it needs cleaning up a bit (and testing in
> > > case I missed something). IOW, do we still need a dedicated mapping type
> > > for the vectors or we can simply use the read-only user page attributes?
> > "
>
> Catalin is incorrect. If CONFIG_KUSER_HELPERS is enabled, then the
> vectors page is definitely written to - it's a user interface, so
> it's not going to change:
>
> #ifdef CONFIG_KUSER_HELPERS
> /*
> * User space must never try to access this
> * directly. Expect your app to break
> * eventually if you do so. The user helper
> * at 0xffff0fe0 must be used instead. (see
> * entry-armv.S for details)
> */
> *((unsigned int *)0xffff0ff0) = val;
> #endif
>

Thanks for the comment.
We have to keep L_PTE_MT_VECTORS for KUSER_HELPERS.


Miles