* [PATCH] thread-db.c: Avoid segfault by making sure that ``reg'' is initialized
@ 2004-11-19 1:02 Kevin Buettner
2004-12-13 21:25 ` Kevin Buettner
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2004-11-19 1:02 UTC (permalink / raw)
To: rda
[Hopefully, this'll end up in the right list this time...]
I've just committed the patch below. As indicated by the subject line, this
patch prevents a segfault when thread_db_set_thread_reg() returns an
uninitialized ``reg''. (This was happening on Fedora Core 2 due to lack of
xregset support.)
* thread-db.c (thread_db_set_thread_reg): Don't allow a successful
return without first initializing ``reg''.
Index: thread-db.c
===================================================================
RCS file: /cvs/src/src/rda/unix/thread-db.c,v
retrieving revision 1.9
diff -u -p -r1.9 thread-db.c
--- thread-db.c 20 Oct 2004 19:28:02 -0000 1.9
+++ thread-db.c 18 Nov 2004 21:39:21 -0000
@@ -2117,6 +2117,10 @@ thread_db_set_thread_reg (struct gdbserv
GREGSET_T gregset;
td_err_e ret;
+ /* Initialize reg to 0 in the event that we return early due to a
+ register being unsupported. */
+ gdbserv_ulonglong_to_reg (serv, 0LL, reg);
+
if (thread == NULL)
thread = process->event_thread; /* Default to the event thread. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] thread-db.c: Avoid segfault by making sure that ``reg'' is initialized
2004-11-19 1:02 [PATCH] thread-db.c: Avoid segfault by making sure that ``reg'' is initialized Kevin Buettner
@ 2004-12-13 21:25 ` Kevin Buettner
2004-12-14 18:16 ` Jim Blandy
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2004-12-13 21:25 UTC (permalink / raw)
To: rda
On Thu, 18 Nov 2004 18:02:40 -0700
Kevin Buettner <kevinb@redhat.com> wrote:
> [Hopefully, this'll end up in the right list this time...]
>
> I've just committed the patch below. As indicated by the subject line, this
> patch prevents a segfault when thread_db_set_thread_reg() returns an
> uninitialized ``reg''. (This was happening on Fedora Core 2 due to lack of
> xregset support.)
>
> * thread-db.c (thread_db_set_thread_reg): Don't allow a successful
> return without first initializing ``reg''.
This patch was wrong - I didn't look closely enough at the result of
applying a patch from a branch. Hopefully, this time I've applied the
correct fix...
* thread-db.c (thread_db_get_thread_reg): Don't allow a successful
return without first initializing ``reg''.
(thread_db_set_thread_reg): Remove code intended to for
thread_db_get_thread_reg().
Index: thread-db.c
===================================================================
RCS file: /cvs/src/src/rda/unix/thread-db.c,v
retrieving revision 1.10
diff -u -p -r1.10 thread-db.c
--- thread-db.c 18 Nov 2004 21:40:02 -0000 1.10
+++ thread-db.c 13 Dec 2004 21:22:00 -0000
@@ -1980,6 +1980,10 @@ thread_db_get_thread_reg (struct gdbserv
GREGSET_T gregset;
td_err_e ret;
+ /* Initialize reg to 0 in the event that we return early due to a
+ register being unsupported. */
+ gdbserv_ulonglong_to_reg (serv, 0LL, reg);
+
if (thread == NULL)
thread = process->event_thread; /* Default to the event thread. */
@@ -2117,10 +2121,6 @@ thread_db_set_thread_reg (struct gdbserv
GREGSET_T gregset;
td_err_e ret;
- /* Initialize reg to 0 in the event that we return early due to a
- register being unsupported. */
- gdbserv_ulonglong_to_reg (serv, 0LL, reg);
-
if (thread == NULL)
thread = process->event_thread; /* Default to the event thread. */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] thread-db.c: Avoid segfault by making sure that ``reg'' is initialized
2004-12-13 21:25 ` Kevin Buettner
@ 2004-12-14 18:16 ` Jim Blandy
0 siblings, 0 replies; 3+ messages in thread
From: Jim Blandy @ 2004-12-14 18:16 UTC (permalink / raw)
To: Kevin Buettner; +Cc: rda
Kevin Buettner <kevinb@redhat.com> writes:
> On Thu, 18 Nov 2004 18:02:40 -0700
> Kevin Buettner <kevinb@redhat.com> wrote:
>
> > [Hopefully, this'll end up in the right list this time...]
> >
> > I've just committed the patch below. As indicated by the subject line, this
> > patch prevents a segfault when thread_db_set_thread_reg() returns an
> > uninitialized ``reg''. (This was happening on Fedora Core 2 due to lack of
> > xregset support.)
> >
> > * thread-db.c (thread_db_set_thread_reg): Don't allow a successful
> > return without first initializing ``reg''.
>
> This patch was wrong - I didn't look closely enough at the result of
> applying a patch from a branch. Hopefully, this time I've applied the
> correct fix...
>
> * thread-db.c (thread_db_get_thread_reg): Don't allow a successful
> return without first initializing ``reg''.
> (thread_db_set_thread_reg): Remove code intended to for
> thread_db_get_thread_reg().
That's it --- no soup for you!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-12-14 18:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-19 1:02 [PATCH] thread-db.c: Avoid segfault by making sure that ``reg'' is initialized Kevin Buettner
2004-12-13 21:25 ` Kevin Buettner
2004-12-14 18:16 ` Jim Blandy
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).