public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][PING][PR gdb/19374] null-ptr dereference on solaris when running get_osdata( "processes" )
@ 2018-08-07 19:29 Brian Vandenberg
  2018-08-07 21:37 ` Simon Marchi
  2018-08-08 15:06 ` Tom Tromey
  0 siblings, 2 replies; 4+ messages in thread
From: Brian Vandenberg @ 2018-08-07 19:29 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1030 bytes --]

This patch is to address bug 19374 on solaris.

When running gdb under eclipse/CDT on Solaris, eclipse runs gdb with:

gdb --interpreter mi2 --nx

During execution it ends up sending the following string to gdb:

16-list-thread-groups --available

... at which point gdb crashes.

This patch partially reverts the change in the following:

http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=e75fdfcad1c868eae5396a95be9dd18010406306#patch4

... by re-adding the check for ops->beneath != NULL and returning
TARGET_XFER_E_IO.

I cannot easily run the test suite against these changes right now.
If this gets rejected based on that, I'll see about getting something
setup at home to run the tests when I have time.

----

note: this patch was tested against 8.1.1.  I don't know [yet] whether
this is still a problem in 8.2 because of the procfs C++ conversion.
The same logic still exists but "beneath" appears to be a function
object.

-brian

ps, my assignment/release forms were completed/received 10/30/2017

[-- Attachment #2: gdb-19374-patch, revised.txt --]
[-- Type: text/plain, Size: 742 bytes --]

gdb/Changelog:
2018-08-07  Brian Vandenberg <phantall@gmail.com>

	PR gdb/19374
	* gdb/procfs.c (procfs_xfer_partial): Added check for ops->beneath != NULL

diff --git a/gdb/procfs.c b/gdb/procfs.c
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ --2599,9 +2599,12 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object,
 #endif

     default:
-      return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
+      if( ops->beneath )
+        return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
                                            readbuf, writebuf, offset, len,
                                            xfered_len);
+      else
+        return TARGET_XFER_E_IO;
     }
 }

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

* Re: [PATCH][PING][PR gdb/19374] null-ptr dereference on solaris when running get_osdata( "processes" )
  2018-08-07 19:29 [PATCH][PING][PR gdb/19374] null-ptr dereference on solaris when running get_osdata( "processes" ) Brian Vandenberg
@ 2018-08-07 21:37 ` Simon Marchi
  2018-08-08 15:06 ` Tom Tromey
  1 sibling, 0 replies; 4+ messages in thread
From: Simon Marchi @ 2018-08-07 21:37 UTC (permalink / raw)
  To: Brian Vandenberg; +Cc: gdb-patches

On 2018-08-07 15:29, Brian Vandenberg wrote:
> This patch is to address bug 19374 on solaris.
> 
> When running gdb under eclipse/CDT on Solaris, eclipse runs gdb with:
> 
> gdb --interpreter mi2 --nx
> 
> During execution it ends up sending the following string to gdb:
> 
> 16-list-thread-groups --available
> 
> ... at which point gdb crashes.
> 
> This patch partially reverts the change in the following:
> 
> http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=e75fdfcad1c868eae5396a95be9dd18010406306#patch4
> 
> ... by re-adding the check for ops->beneath != NULL and returning
> TARGET_XFER_E_IO.
> 
> I cannot easily run the test suite against these changes right now.
> If this gets rejected based on that, I'll see about getting something
> setup at home to run the tests when I have time.
> 
> ----
> 
> note: this patch was tested against 8.1.1.  I don't know [yet] whether
> this is still a problem in 8.2 because of the procfs C++ conversion.
> The same logic still exists but "beneath" appears to be a function
> object.
> 
> -brian
> 
> ps, my assignment/release forms were completed/received 10/30/2017

Hi Brian,

Same here, please submit the patch that applies on master again once you 
are able to build & test (at least manually).

Simon

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

* Re: [PATCH][PING][PR gdb/19374] null-ptr dereference on solaris when running get_osdata( "processes" )
  2018-08-07 19:29 [PATCH][PING][PR gdb/19374] null-ptr dereference on solaris when running get_osdata( "processes" ) Brian Vandenberg
  2018-08-07 21:37 ` Simon Marchi
@ 2018-08-08 15:06 ` Tom Tromey
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2018-08-08 15:06 UTC (permalink / raw)
  To: Brian Vandenberg; +Cc: gdb-patches

>>>>> "Brian" == Brian Vandenberg <phantall@gmail.com> writes:

Brian> note: this patch was tested against 8.1.1.  I don't know [yet] whether
Brian> this is still a problem in 8.2 because of the procfs C++ conversion.
Brian> The same logic still exists but "beneath" appears to be a function
Brian> object.

Now you call beneath() to get the object beneath.
At least one spot (see windows_nat_target::xfer_partial) checks this for NULL.

Tom

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

* [PATCH][PING][PR gdb/19374] null-ptr dereference on solaris when running get_osdata( "processes" )
@ 2016-01-05 17:30 Brian Vandenberg
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Vandenberg @ 2016-01-05 17:30 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 656 bytes --]

This patch is to address bug 19374 on solaris.

When running gdb under eclipse/CDT on Solaris, eclipse
runs gdb with:

gdb --interpreter mi2 --nx

During execution it ends up sending the following string to gdb:

16-list-thread-groups --available

... at which point gdb crashes.

There's a few issues I see with this function, not all of which I'm
prepared to deal with competently.

This patch partially reverts the change in the following:

http://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=e75fdfcad1c868eae5396a95be9dd18010406306#patch4

... by re-adding the check for ops->beneath != NULL and returning
TARGET_XFER_E_IO.

-brian

[-- Attachment #2: gdb-19374-patch.txt --]
[-- Type: text/plain, Size: 773 bytes --]

gdb/Changelog:
2015-12-16  Brian Vandenberg <phantall@gmail.com>

	PR gdb/19374
	* gdb/procfs.c (procfs_xfer_partial): Added check for ops->beneath != NULL

diff --git a/gdb/procfs.c b/gdb/procfs.c
index 7b7ff45..7c08bf4 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ --3954,9 +3954,12 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object,
 #endif

     default:
-      return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
+      if( ops->beneath )
+        return ops->beneath->to_xfer_partial (ops->beneath, object, annex,
                                            readbuf, writebuf, offset, len,
                                            xfered_len);
+      else
+        return TARGET_XFER_E_IO;
     }
 }

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

end of thread, other threads:[~2018-08-08 15:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-07 19:29 [PATCH][PING][PR gdb/19374] null-ptr dereference on solaris when running get_osdata( "processes" ) Brian Vandenberg
2018-08-07 21:37 ` Simon Marchi
2018-08-08 15:06 ` Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2016-01-05 17:30 Brian Vandenberg

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).