diff options
author | Jan Beulich <jbeulich@suse.com> | 2025-04-14 14:24:28 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2025-04-14 14:24:28 +0200 |
commit | f47975106fc439d0ddc65bb7850f1a1d68c93e78 (patch) | |
tree | b641b19e6875003e3b200313d86e791b521c187d /gdb/testsuite/gdb.base/nofield.c | |
parent | 8fa7162be556f60fdbd146d2a38c1c7e776ead36 (diff) | |
download | binutils-f47975106fc439d0ddc65bb7850f1a1d68c93e78.zip binutils-f47975106fc439d0ddc65bb7850f1a1d68c93e78.tar.gz binutils-f47975106fc439d0ddc65bb7850f1a1d68c93e78.tar.bz2 |
ld/PE: restrict non-zero default DLL characteristics to MinGW
While commit ef6379e16dd1 ("Set the default DLL chracteristics to 0 for
Cygwin based targets") tried to undo the too broad earlier 514b4e191d5f
("Change the default characteristics of DLLs built by the linker to more
secure settings"), it didn't go quite far enough. Apparently the
assumption was that if it's not MinGW, it must be Cygwin. Whether it
really is okay to default three of the flags to non-zero on MinGW also
remains unclear - sadly neither of the commits came with any description
whatsoever. (Documentation also wasn't updated to indicate the restored
default.)
Setting effectively any of the DLL characteristics flags depends on
properties of the binary being linked. While defaulting to "more secure"
is a fair goal, it's only the programmer who can know whether their code
is actually compatible with the respective settings. On the assumption
that the change of defaults was indeed deliberate (and justifiable) for
MinGW, limit them to just that. In particular, don't default any of the
flags to set also for non-MinGW, non-Cygwin targets, like e.g. UEFI. At
least the mere applicability of the high-entropy-VA bit is pretty
questionable there in the first place - UEFI applications, after all,
run in "physical mode", i.e. either unpaged or (where paging is a
requirement, like for x86-64) direct-mapped.
The situation is particularly problematic with NX-compat: Many UEFI
implementations respect the "physical mode" property, where permissions
can't be enforced anyway. Some, like reportedly OVMF, even have a build
option to behave either way. Hence successfully testing a UEFI binary on
any number of systems does not guarantee it won't crash elsewhere if the
flag is wrongly set.
Get rid of excess semicolons as well.
Diffstat (limited to 'gdb/testsuite/gdb.base/nofield.c')
0 files changed, 0 insertions, 0 deletions