Re: [patchv3 0/8] Validate binary before use

Jan Kratochvil
2014-03-08T17:33:31Z

On Mon, 03 Mar 2014 14:27:14 +0100, Pedro Alves wrote:
> On 03/02/2014 06:36 PM, Jan Kratochvil wrote:
> > > BTW, do you plan on contributing support for validation with cores too?
> >
> > No.
>
> OK. I think it'd be useful, so that GDB can warn/reject in the
> common scenario of the user not pointing at a sysroot with the
> correct DSOs.

Yes, may extensions would be useful. The question is if it should be
a blocker for this patch series.

> Thanks. I think that feature may be a little beyond borderline
> for that project page though, as core loading is not really part
> of the native target. IMO it'd good if this had its own project
> page, where it'd give answer to questions like the below.

Created:
https://sourceware.org/gdb/wiki/GDBserverCoreFiles
And removed it from:
https://sourceware.org/gdb/wiki/LocalRemoteFeatureParity?action=diff&rev2=57&rev1=56

> #0 - If implemented by gdbserver, it seems like it'd involve further user
> action to trigger the feature? How does one tell GDB/gdbserver to load the
> ore on the remote side rather than locally?

I did not think more about it as I have never started that project.

The basic functionality would be:
$ gdbserver -c :1234 corefile
$ gdb executable
(gdb) target remote :1234
And if I did not forget anything it could work.

For more comfortable use it overlaps more with my non-upstreamed patches:
http://pkgs.fedoraproject.org/cgit/gdb.git/tree/gdb-6.6-buildid-locate.patch
http://pkgs.fedoraproject.org/cgit/gdb.git/tree/gdb-6.6-buildid-locate-core-as-arg.patch

So that one could possibly load executable+libraries by:
$ gdbserver :1234 corefile
$ gdb
(gdb) target (extended-?)remote :1234
The same way one can load executable+libraries in linux-nat and the patches
above using:
$ gdb corefile

> #1 - couldn't this be addressed by just using fuse/ssh/somesuch to
> access the core? (that is, transparently from GDB).

It could but in many cases would be slower than uploading the whole corefile.

It all depends on upload bandwidth vs. RTT. Depending on these two link
parameters currently for some people is faster to do core file upload, for
other people to do NFS-like corefile access.

The best choice would be the gdbserver-for-corefile as in such case the major
RTT hit is the link_map traversal while gdbserver can send
qXfer:libraries-svr4:read.

OTOH nowadays there is also NT_FILE but so far GDB does not use it for the
shared library list, it may also contain ELF files mmap()ed and not
dlopen()ed.

> #2 - if not, could we perhaps tweak the target stratum bits a little to
> allow sitting core_ops on top of extended-remote, and have it read the
> necessary bits off the remote core with target_fileio_xxx. So we'd
> still have host-side core_ops / bfd. You'd load the core with e.g.,
> "core remote:/.../core.pid").

The same performance problem as #1 above.

> >>> --- a/gdb/testsuite/gdb.base/solib-mismatch.exp
> >>> +++ b/gdb/testsuite/gdb.base/solib-mismatch.exp
> >>> @@ -1,4 +1,4 @@
> >>> -# Copyright 2013 Free Software Foundation, Inc.
> >>> +# Copyright 2014 Free Software Foundation, Inc.
> >>
> >> These need to be 2013-2014.
> >
> > Why? It counts since the first post to gdb-patches?
>
> https://sourceware.org/ml/gdb-patches/2014-02/msg00859.html

Do you mean this part?
# 1. We start claiming copyright the year the file as committed
# to a medium (hard drive), not the year it was published.

Does "medium" mean any disk even unrelated to the GDB project?
Or does "medium" mean "any medium used for GDB development"?

It is not discussed more above, I guess you mean the former but was it really
meant that way? (Cced Joel)

Thanks,
Jan