[PATCHv5 11/12] arm64: uaccess: remove redundant PAN toggling
Qian Cai
qcai at redhat.com
Thu Dec 3 08:25:47 EST 2020
On Wed, 2020-12-02 at 13:15 +0000, Mark Rutland wrote:
> Some code (e.g. futex) needs to make privileged accesses to userspace
> memory, and uses uaccess_{enable,disable}_privileged() in order to
> permit this. All other uaccess primitives use LDTR/STTR, and never need
> to toggle PAN.
>
> Remove the redundant PAN toggling.
[]
> -static bool __maybe_unused
> -cpufeature_pan_not_uao(const struct arm64_cpu_capabilities *entry, int __unused)
> -{
> - return (__system_matches_cap(ARM64_HAS_PAN) &&
> !__system_matches_cap(ARM64_HAS_UAO));
> -}
With CONFIG_ARM64_PTR_AUTH=n, we now have,
arch/arm64/kernel/cpufeature.c:2649:13: warning: '__system_matches_cap' defined but not used [-Wunused-function]
static bool __system_matches_cap(unsigned int n)
^~~~~~~~~~~~~~~~~~~~
Probably just need to transfer __maybe_unused to __system_matches_cap().
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 6bdb03400581..d4e4d9d388b0 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -2646,7 +2646,7 @@ bool this_cpu_has_cap(unsigned int n)
* - The SYSTEM_FEATURE cpu_hwcaps may not have been set.
* In all other cases cpus_have_{const_}cap() should be used.
*/
-static bool __system_matches_cap(unsigned int n)
+static bool __maybe_unused __system_matches_cap(unsigned int n)
{
if (n < ARM64_NCAPS) {
const struct arm64_cpu_capabilities *cap = cpu_hwcaps_ptrs[n];
More information about the linux-arm-kernel
mailing list