Sourceware Bugzilla – Attachment 12804 Details for
Bug 19011
Issues with ld on mingw-w64 and bad defaults
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PATCH 2/2] LD/PR19011: more secure default PE options.
0002-LD-PR19011-more-secure-default-PE-options.patch (text/plain), 2.61 KB, created by
sourceware-bugzilla
on 2020-08-27 04:30:13 UTC
(
hide
)
Description:
[PATCH 2/2] LD/PR19011: more secure default PE options.
Filename:
MIME Type:
Creator:
sourceware-bugzilla
Created:
2020-08-27 04:30:13 UTC
Size:
2.61 KB
patch
obsolete
>From 1188731e7606df1e2aed8febd7e1b9e53fa3386f Mon Sep 17 00:00:00 2001 >From: Jeremy Drake <sourceware-bugzilla@jdrake.com> >Date: Wed, 26 Aug 2020 13:34:27 -0700 >Subject: [PATCH 2/2] LD/PR19011: more secure default PE options. > > - Default to enabling dynamicbase and nxcompat. > - Default to enabling HEASLR (high-entropy-va) > - Use a base address > 4GB for 64-bit binaries. > - Default to enabling reloc sections. >--- > ld/emultempl/pe.em | 2 +- > ld/emultempl/pep.em | 10 +++++----- > ld/pe-dll.c | 2 +- > 3 files changed, 7 insertions(+), 7 deletions(-) > >diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em >index 8d61fae2bd..b9e2f33868 100644 >--- a/ld/emultempl/pe.em >+++ b/ld/emultempl/pe.em >@@ -104,7 +104,7 @@ fragment <<EOF > #define DEFAULT_PSEUDO_RELOC_VERSION 1 > #endif > >-#define DEFAULT_DLL_CHARACTERISTICS 0x0 >+#define DEFAULT_DLL_CHARACTERISTICS (IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE |IMAGE_DLL_CHARACTERISTICS_NX_COMPAT) > > #if defined(TARGET_IS_i386pe) || ! defined(DLL_SUPPORT) > #define PE_DEF_SUBSYSTEM 3 >diff --git a/ld/emultempl/pep.em b/ld/emultempl/pep.em >index 947fab6562..761852ea41 100644 >--- a/ld/emultempl/pep.em >+++ b/ld/emultempl/pep.em >@@ -99,26 +99,26 @@ fragment <<EOF > #define DLL_SUPPORT > #endif > >-#define DEFAULT_DLL_CHARACTERISTICS 0x0 >+#define DEFAULT_DLL_CHARACTERISTICS (IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE|IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA|IMAGE_DLL_CHARACTERISTICS_NX_COMPAT) > > #if defined(TARGET_IS_i386pep) || ! defined(DLL_SUPPORT) > #define PE_DEF_SUBSYSTEM 3 > #undef NT_EXE_IMAGE_BASE > #define NT_EXE_IMAGE_BASE \ > ((bfd_vma) (${move_default_addr_high} ? 0x100400000LL \ >- : 0x400000LL)) >+ : 0x140000000LL)) > #undef NT_DLL_IMAGE_BASE > #define NT_DLL_IMAGE_BASE \ > ((bfd_vma) (${move_default_addr_high} ? 0x400000000LL \ >- : 0x10000000LL)) >+ : 0x180000000LL)) > #undef NT_DLL_AUTO_IMAGE_BASE > #define NT_DLL_AUTO_IMAGE_BASE \ > ((bfd_vma) (${move_default_addr_high} ? 0x400000000LL \ >- : 0x61300000LL)) >+ : 0x1C0000000LL)) > #undef NT_DLL_AUTO_IMAGE_MASK > #define NT_DLL_AUTO_IMAGE_MASK \ > ((bfd_vma) (${move_default_addr_high} ? 0x1ffff0000LL \ >- : 0x0ffc0000LL)) >+ : 0x1ffff0000LL)) > #else > #undef NT_EXE_IMAGE_BASE > #define NT_EXE_IMAGE_BASE \ >diff --git a/ld/pe-dll.c b/ld/pe-dll.c >index 3e8fe1be9b..cdce3fefea 100644 >--- a/ld/pe-dll.c >+++ b/ld/pe-dll.c >@@ -160,7 +160,7 @@ int pe_dll_extra_pe_debug = 0; > int pe_use_nul_prefixed_import_tables = 0; > int pe_use_coff_long_section_names = -1; > int pe_leading_underscore = -1; >-int pe_dll_enable_reloc_section = 0; >+int pe_dll_enable_reloc_section = 1; > > /* Static variables and types. */ > >-- >2.28.0.windows.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 19011
:
11152
|
12800
|
12801
|
12802
| 12804