From 31b4d3a16f200bf04db8439a63b72bba7af4e1be Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 3 Feb 2022 08:57:47 +1030 Subject: PR28824, relro security issues, x86 keep COMMONPAGESIZE relro x86 treats MAXPAGESIZE as a memory optimisation parameter, actual hardware paging is always COMMPAGESIZE of 4k. Use COMMONPAGESIZE for the end of the relro segment alignment. The previous patch regresses pr18176, increasing the testcase file size from 322208 to 2099872 bytes. Fixing this on x86 will require introducing a gap after the end of the relro segment (of up to relropagesize-1 bytes). PR 28824 PR 18176 * ld.h (ld_config_type): Add relro_use_commonpagesize field. * ldexp.c (fold_segment_align): Set relropagesize depending on relro_use_commonpagesize. * emultempl/elf-x86.em (elf_x86_create_output_section_statements): Set relro_use_commonpagesize. * testsuite/ld-x86-64/pr18176.d: xfail. --- ld/emultempl/elf-x86.em | 1 + 1 file changed, 1 insertion(+) (limited to 'ld/emultempl') diff --git a/ld/emultempl/elf-x86.em b/ld/emultempl/elf-x86.em index f75521c..134e4e1 100644 --- a/ld/emultempl/elf-x86.em +++ b/ld/emultempl/elf-x86.em @@ -33,6 +33,7 @@ static struct elf_linker_x86_params params; static void elf_x86_create_output_section_statements (void) { + config.relro_use_commonpagesize = true; _bfd_elf_linker_x86_set_options (&link_info, ¶ms); } -- cgit v1.1