qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] configure: don't enable ASLR for --enable-debug Windows builds
@ 2020-10-05 13:34 Mark Cave-Ayland
  2020-10-05 13:42 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Cave-Ayland @ 2020-10-05 13:34 UTC (permalink / raw)
  To: qemu-devel, pbonzini

Unlike other OSs it is not possible for gdb to temporarily disable ASLR when
debugging executables on Windows which causes gdb to fail with memory access
errors when trying to debug QEMU.

Keep ASLR enabled by default on Windows via the --dynamicbase compiler flag
except for --enable-debug builds when there is a clear expectation that a
functioning gdb is expected at the cost of slightly less security.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 configure | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index f46f433649..a3de75b9f8 100755
--- a/configure
+++ b/configure
@@ -6144,7 +6144,14 @@ fi
 
 # Use ASLR, no-SEH and DEP if available
 if test "$mingw32" = "yes" ; then
-    for flag in --dynamicbase --no-seh --nxcompat; do
+    flags="--no-seh --nxcompat"
+
+    # Disable ASLR for debug builds to allow debugging with gdb
+    if test "$debug" = "no" ; then
+        flags="--dynamicbase $flags"
+    fi
+
+    for flag in $flags; do
         if ld_has $flag ; then
             QEMU_LDFLAGS="-Wl,$flag $QEMU_LDFLAGS"
         fi
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] configure: don't enable ASLR for --enable-debug Windows builds
  2020-10-05 13:34 [PATCH] configure: don't enable ASLR for --enable-debug Windows builds Mark Cave-Ayland
@ 2020-10-05 13:42 ` Richard Henderson
  2020-10-05 13:45   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Henderson @ 2020-10-05 13:42 UTC (permalink / raw)
  To: Mark Cave-Ayland, qemu-devel, pbonzini

On 10/5/20 8:34 AM, Mark Cave-Ayland wrote:
> Unlike other OSs it is not possible for gdb to temporarily disable ASLR when
> debugging executables on Windows which causes gdb to fail with memory access
> errors when trying to debug QEMU.
> 
> Keep ASLR enabled by default on Windows via the --dynamicbase compiler flag
> except for --enable-debug builds when there is a clear expectation that a
> functioning gdb is expected at the cost of slightly less security.
> 
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>  configure | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] configure: don't enable ASLR for --enable-debug Windows builds
  2020-10-05 13:42 ` Richard Henderson
@ 2020-10-05 13:45   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-10-05 13:45 UTC (permalink / raw)
  To: Richard Henderson, Mark Cave-Ayland, qemu-devel

On 05/10/20 15:42, Richard Henderson wrote:
> On 10/5/20 8:34 AM, Mark Cave-Ayland wrote:
>> Unlike other OSs it is not possible for gdb to temporarily disable ASLR when
>> debugging executables on Windows which causes gdb to fail with memory access
>> errors when trying to debug QEMU.
>>
>> Keep ASLR enabled by default on Windows via the --dynamicbase compiler flag
>> except for --enable-debug builds when there is a clear expectation that a
>> functioning gdb is expected at the cost of slightly less security.
>>
>> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
>> ---
>>  configure | 9 ++++++++-
>>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Queued, thanks.

Paolo



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-05 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-05 13:34 [PATCH] configure: don't enable ASLR for --enable-debug Windows builds Mark Cave-Ayland
2020-10-05 13:42 ` Richard Henderson
2020-10-05 13:45   ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).