* [PATCH] Use volatile pointers when attempting to trigger SIGSEGVs
@ 2020-06-30 13:42 Gary Benson
2020-07-10 14:39 ` Pedro Alves
0 siblings, 1 reply; 3+ messages in thread
From: Gary Benson @ 2020-06-30 13:42 UTC (permalink / raw)
To: gdb-patches
Hi all,
Clang fails to compile a number of files with the following warning:
indirection of non-volatile null pointer will be deleted, not trap
[-Wnull-dereference]. This patch qualifies the relevant pointers
with 'volatile'.
Checked on Fedora 31 x86_64, GCC and clang. Ok to commit?
Cheers,
Gary
--
gdb/testsuite/ChangeLog:
* gdb.base/bigcore.c (main): Use a volatile pointer when
attempting to trigger a SIGSEGV.
* gdb.base/gcore-relro-pie.c (break_here): Likewise.
* gdb.base/gcore-tls-pie.c (break_here): Likewise.
* gdb.base/savedregs.c (thrower): Likewise.
* gdb.mi/mi-syn-frame.c (bar): Likewise.
---
gdb/testsuite/ChangeLog | 9 +++++++++
gdb/testsuite/gdb.base/bigcore.c | 2 +-
gdb/testsuite/gdb.base/gcore-relro-pie.c | 2 +-
gdb/testsuite/gdb.base/gcore-tls-pie.c | 2 +-
gdb/testsuite/gdb.base/savedregs.c | 2 +-
gdb/testsuite/gdb.mi/mi-syn-frame.c | 2 +-
6 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/gdb/testsuite/gdb.base/bigcore.c b/gdb/testsuite/gdb.base/bigcore.c
index 174e0f6..8be1b15 100644
--- a/gdb/testsuite/gdb.base/bigcore.c
+++ b/gdb/testsuite/gdb.base/bigcore.c
@@ -267,5 +267,5 @@ struct list
/* Push everything out to disk. */
print_string ("Dump core ....\n");
- *(char*)0 = 0;
+ *(volatile char*)0 = 0;
}
diff --git a/gdb/testsuite/gdb.base/gcore-relro-pie.c b/gdb/testsuite/gdb.base/gcore-relro-pie.c
index 20cf12c..9ae7cb2 100644
--- a/gdb/testsuite/gdb.base/gcore-relro-pie.c
+++ b/gdb/testsuite/gdb.base/gcore-relro-pie.c
@@ -18,7 +18,7 @@
void
break_here (void)
{
- *(int *) 0 = 0;
+ *(volatile int *) 0 = 0;
}
void
diff --git a/gdb/testsuite/gdb.base/gcore-tls-pie.c b/gdb/testsuite/gdb.base/gcore-tls-pie.c
index 73aec40..18169fc 100644
--- a/gdb/testsuite/gdb.base/gcore-tls-pie.c
+++ b/gdb/testsuite/gdb.base/gcore-tls-pie.c
@@ -25,7 +25,7 @@
void
break_here (void)
{
- *(int *) 0 = 0;
+ *(volatile int *) 0 = 0;
}
void
diff --git a/gdb/testsuite/gdb.base/savedregs.c b/gdb/testsuite/gdb.base/savedregs.c
index 71b076f..aec2a38 100644
--- a/gdb/testsuite/gdb.base/savedregs.c
+++ b/gdb/testsuite/gdb.base/savedregs.c
@@ -46,7 +46,7 @@
thrower (void)
{
/* Trigger a SIGSEGV. */
- *(char *)0 = 0;
+ *(volatile char *)0 = 0;
/* On MMU-less system, previous memory access to address zero doesn't
trigger a SIGSEGV. Trigger a SIGILL. Each arch should define its
diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.c b/gdb/testsuite/gdb.mi/mi-syn-frame.c
index c260112..b6ab6e8 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.c
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.c
@@ -27,7 +27,7 @@
void
bar (void)
{
- *(char *)0 = 0; /* try to cause a segfault */
+ *(volatile char *)0 = 0; /* try to cause a segfault */
/* On MMU-less system, previous memory access to address zero doesn't
trigger a SIGSEGV. Trigger a SIGILL. Each arch should define its
--
1.8.3.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Use volatile pointers when attempting to trigger SIGSEGVs
2020-06-30 13:42 [PATCH] Use volatile pointers when attempting to trigger SIGSEGVs Gary Benson
@ 2020-07-10 14:39 ` Pedro Alves
2020-07-13 13:50 ` Gary Benson
0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2020-07-10 14:39 UTC (permalink / raw)
To: Gary Benson, gdb-patches
On 6/30/20 2:42 PM, Gary Benson via Gdb-patches wrote:
> Hi all,
>
> Clang fails to compile a number of files with the following warning:
> indirection of non-volatile null pointer will be deleted, not trap
> [-Wnull-dereference]. This patch qualifies the relevant pointers
> with 'volatile'.
>
> Checked on Fedora 31 x86_64, GCC and clang. Ok to commit?
OK
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Use volatile pointers when attempting to trigger SIGSEGVs
2020-07-10 14:39 ` Pedro Alves
@ 2020-07-13 13:50 ` Gary Benson
0 siblings, 0 replies; 3+ messages in thread
From: Gary Benson @ 2020-07-13 13:50 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
Pedro Alves wrote:
> On 6/30/20 2:42 PM, Gary Benson via Gdb-patches wrote:
> > Hi all,
> >
> > Clang fails to compile a number of files with the following warning:
> > indirection of non-volatile null pointer will be deleted, not trap
> > [-Wnull-dereference]. This patch qualifies the relevant pointers
> > with 'volatile'.
> >
> > Checked on Fedora 31 x86_64, GCC and clang. Ok to commit?
>
> OK
Thanks, I've pushed it.
Cheers,
Gary
--
Gary Benson - he / him / his
Principal Software Engineer, Red Hat
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-13 13:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30 13:42 [PATCH] Use volatile pointers when attempting to trigger SIGSEGVs Gary Benson
2020-07-10 14:39 ` Pedro Alves
2020-07-13 13:50 ` Gary Benson
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 read-only IMAP folder(s) and NNTP newsgroup(s).