crypto: arm64/crc32 - move literal data to .rodata section
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 10 Jan 2018 12:11:39 +0000 (12:11 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 18 Jan 2018 12:00:31 +0000 (23:00 +1100)
Move CRC32 literal data to the .rodata section where it is safe from
being exploited by speculative execution.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/arm64/crypto/crc32-ce-core.S

index 18f5a8442276689324302c364fe5979bbf8569a9..16ed3c7ebd3769d9e9c17bc71fe9d227db558e53 100644 (file)
@@ -50,7 +50,7 @@
 #include <linux/linkage.h>
 #include <asm/assembler.h>
 
-       .text
+       .section        ".rodata", "a"
        .align          6
        .cpu            generic+crypto+crc
 
         * uint crc32_pmull_le(unsigned char const *buffer,
         *                     size_t len, uint crc32)
         */
+       .text
 ENTRY(crc32_pmull_le)
-       adr             x3, .Lcrc32_constants
+       adr_l           x3, .Lcrc32_constants
        b               0f
 
 ENTRY(crc32c_pmull_le)
-       adr             x3, .Lcrc32c_constants
+       adr_l           x3, .Lcrc32c_constants
 
 0:     bic             LEN, LEN, #15
        ld1             {v1.16b-v4.16b}, [BUF], #0x40