mm/usercopy: Switch to using lm_alias
authorLaura Abbott <labbott@redhat.com>
Tue, 10 Jan 2017 21:35:45 +0000 (13:35 -0800)
committerWill Deacon <will.deacon@arm.com>
Wed, 11 Jan 2017 13:56:50 +0000 (13:56 +0000)
The usercopy checking code currently calls __va(__pa(...)) to check for
aliases on symbols. Switch to using lm_alias instead.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Tested-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
mm/usercopy.c

index 3c8da0af96959387e9bb1d2c0bfe272334344e26..8345299e3e3b08e617f425ae18050a794b50b5e4 100644 (file)
@@ -108,13 +108,13 @@ static inline const char *check_kernel_text_object(const void *ptr,
         * __pa() is not just the reverse of __va(). This can be detected
         * and checked:
         */
-       textlow_linear = (unsigned long)__va(__pa(textlow));
+       textlow_linear = (unsigned long)lm_alias(textlow);
        /* No different mapping: we're done. */
        if (textlow_linear == textlow)
                return NULL;
 
        /* Check the secondary mapping... */
-       texthigh_linear = (unsigned long)__va(__pa(texthigh));
+       texthigh_linear = (unsigned long)lm_alias(texthigh);
        if (overlaps(ptr, n, textlow_linear, texthigh_linear))
                return "<linear kernel text>";