target/arm: Fix Privileged Access Never (PAN) for aarch32
commit6f2d9d74416a71dedeb1a52480e8e809e2862702
authorTimofey Kutergin <tkutergin@gmail.com>
Thu, 3 Nov 2022 13:10:41 +0000 (3 13:10 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 4 Nov 2022 10:58:58 +0000 (4 10:58 +0000)
tree76b6bb9a614e23d00e815d112d80e050095afe79
parent4870f38b0babe48babdce90ac8bba11d29abaf0d
target/arm: Fix Privileged Access Never (PAN) for aarch32

When we implemented the PAN support we theoretically wanted
to support it for both AArch32 and AArch64, but in practice
several bugs made it essentially unusable with an AArch32
guest. Fix all those problems:

    - Use CPSR.PAN to check for PAN state in aarch32 mode
    - throw permission fault during address translation when PAN is
      enabled and kernel tries to access user acessible page
    - ignore SCTLR_XP bit for armv7 and armv8 (conflicts with SCTLR_SPAN).

Signed-off-by: Timofey Kutergin <tkutergin@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20221027112619.2205229-1-tkutergin@gmail.com
[PMM: tweak commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/helper.c
target/arm/ptw.c