[v4,00/14] Fix BZ 25631 - core file memory access problem

Message ID 20200705225807.2264705-1-kevinb@redhat.com
Headers show
Series
  • Fix BZ 25631 - core file memory access problem
Related show

Message

Simon Marchi via Gdb-patches July 5, 2020, 10:57 p.m.
This series fixes several core file related bugs.  The bug which
started this work can be viewed here:

    https://sourceware.org/bugzilla/show_bug.cgi?id=25631

Other problems were found either during review or during development. 
I discuss these in my commit log remarks.

Only some of these patches still need review.  A brief status
of each can be found below:

 1) Remove hack for GDB which sets the section size to 0

    Nick Clifton has approved this patch.

 2) Adjust corefile.exp test to show regression after bfd hack removal
 3) section_table_xfer_memory: Replace section name with callback
    predicate
 4) Provide access to non SEC_HAS_CONTENTS core file sections
 5) Test ability to access unwritten-to mmap data in core file

    I think that Pedro is okay with #2 thru #5.

 6) Update binary_get_section_contents to seek using section's file
    position

    Nick Cliften has approved patch #6.

 7) Add new gdbarch method, read_core_file_mappings

    This is a new patch which needs review.

 8) Use NT_FILE note section for reading core target memory

    This patch is significantly different than the v3 patch.
    It needs review.  

 9) Add test for accessing read-only mmapped data in a core file

    I think that Pedro is oky with this one.

10) gcore command: Place all file-backed mappings in NT_FILE note
11) xfail gdb.base/coredump-filter.exp test which now works without a
    binary
12) Add new command "maint print core-file-backed-mappings"

    #10 thru #12 are new patches which need review.

13) Add documentation for "maint print core-file-backed-mappings"

    This one needs a review from Eli.

14) New core file tests with mappings over existing program memory

    I've made all the changes that Pedro recommended, plus added
    a test for the new maint print command.  It needs review.

 bfd/binary.c                               |  12 +-
 bfd/elf.c                                  |   8 -
 gdb/NEWS                                   |   4 +
 gdb/arch-utils.c                           |  16 ++
 gdb/arch-utils.h                           |  12 +
 gdb/bfd-target.c                           |   3 +-
 gdb/corelow.c                              | 260 ++++++++++++++++++++-
 gdb/doc/gdb.texinfo                        |   8 +
 gdb/exec.c                                 |   8 +-
 gdb/exec.h                                 |  13 +-
 gdb/gdbarch.c                              |  23 ++
 gdb/gdbarch.h                              |   6 +
 gdb/gdbarch.sh                             |   3 +
 gdb/linux-tdep.c                           | 244 +++++++++++++------
 gdb/target.c                               |  18 +-
 gdb/testsuite/gdb.base/coredump-filter.exp |  21 ++
 gdb/testsuite/gdb.base/corefile.exp        |  24 +-
 gdb/testsuite/gdb.base/corefile2.exp       | 179 ++++++++++++++
 gdb/testsuite/gdb.base/coremaker.c         |  30 ++-
 gdb/testsuite/gdb.base/coremaker2.c        | 150 ++++++++++++
 20 files changed, 933 insertions(+), 109 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/corefile2.exp
 create mode 100644 gdb/testsuite/gdb.base/coremaker2.c

-- 
2.26.2

Comments

Pedro Alves July 10, 2020, 8:13 p.m. | #1
On 7/5/20 11:57 PM, Kevin Buettner via Gdb-patches wrote:
> This series fixes several core file related bugs.  The bug which

> started this work can be viewed here:

> 

>     https://sourceware.org/bugzilla/show_bug.cgi?id=25631

> 

> Other problems were found either during review or during development. 

> I discuss these in my commit log remarks.

> 

> Only some of these patches still need review.  A brief status

> of each can be found below:

> 

>  1) Remove hack for GDB which sets the section size to 0

> 

>     Nick Clifton has approved this patch.

> 

>  2) Adjust corefile.exp test to show regression after bfd hack removal

>  3) section_table_xfer_memory: Replace section name with callback

>     predicate

>  4) Provide access to non SEC_HAS_CONTENTS core file sections

>  5) Test ability to access unwritten-to mmap data in core file

> 

>     I think that Pedro is okay with #2 thru #5.

> 

>  6) Update binary_get_section_contents to seek using section's file

>     position

> 

>     Nick Cliften has approved patch #6.

> 

>  7) Add new gdbarch method, read_core_file_mappings

> 

>     This is a new patch which needs review.

> 

>  8) Use NT_FILE note section for reading core target memory

> 

>     This patch is significantly different than the v3 patch.

>     It needs review.  

> 

>  9) Add test for accessing read-only mmapped data in a core file

> 

>     I think that Pedro is oky with this one.

> 

> 10) gcore command: Place all file-backed mappings in NT_FILE note

> 11) xfail gdb.base/coredump-filter.exp test which now works without a

>     binary

> 12) Add new command "maint print core-file-backed-mappings"

> 

>     #10 thru #12 are new patches which need review.

> 

> 13) Add documentation for "maint print core-file-backed-mappings"

> 

>     This one needs a review from Eli.

> 

> 14) New core file tests with mappings over existing program memory

> 

>     I've made all the changes that Pedro recommended, plus added

>     a test for the new maint print command.  It needs review.



I think this looks overall very good.

I've sent some comments to patches #8, #11, #12, and #14.

Once those are revolved, I'll be happy to see this go in.

Pedro Alves