Page MenuHome GnuPG

libgcrypt: cipher/camellia-aarch64.S is not PIC
Closed, ResolvedPublic

Description

The code in cipher/camellia-aarch64.S uses a table that is probably unintended exported as a global visible symbol. This means some other module could override the address, and forces the assembler to emit a text relocation.

Newer binutils warn about this relocation, and it breaks the build on NetBSD for me.

Fix is trivial: it makes no sense to expose the table itself, so just remove the .global. Alternative solution: mark the table address as hidden.

Make this PIC.

Do not make _gcry_camellia_arm_tables global, to allow the assembler to
resolve the symbol locally (avoids relocations that break the build).

Signed-off-by: Martin Husemann <martin@NetBSD.org>

--- a/cipher/camellia-aarch64.S 2017-11-23 19:16:58.000000000 +0100
+++ b/cipher/camellia-aarch64.S 2019-01-09 14:27:16.928019986 +0100
@@ -284,7 +284,7 @@
 .size _gcry_camellia_arm_decrypt_block,.-_gcry_camellia_arm_decrypt_block;
 
 /* Encryption/Decryption tables */
-.globl _gcry_camellia_arm_tables
+#  .globl _gcry_camellia_arm_tables
 .type  _gcry_camellia_arm_tables,@object;
 .balign 32
 _gcry_camellia_arm_tables: