public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/30525] gdb cannot read shared libraries on SPARC64
Date: Thu, 06 Jul 2023 16:58:02 +0000	[thread overview]
Message-ID: <bug-30525-4717-YKlXh6xURi@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-30525-4717@http.sourceware.org/bugzilla/>

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

--- Comment #14 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Pedro Alves <palves@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=31a56a22c45d76df4c597439f337e3f75ac3065c

commit 31a56a22c45d76df4c597439f337e3f75ac3065c
Author: Pedro Alves <pedro@palves.net>
Date:   Wed Jun 7 10:38:14 2023 +0100

    Linux: Avoid pread64/pwrite64 for high memory addresses (PR gdb/30525)

    Since commit 05c06f318fd9 ("Linux: Access memory even if threads are
    running"), GDB prefers pread64/pwrite64 to access inferior memory
    instead of ptrace.  That change broke reading shared libraries on
    SPARC64 Linux, as reported by PR gdb/30525 ("gdb cannot read shared
    libraries on SPARC64").

    On SPARC64 Linux, surprisingly (to me), userspace shared libraries are
    mapped at high 64-bit addresses:

       (gdb) info sharedlibrary
       Cannot access memory at address 0xfff80001002011e0
       Cannot access memory at address 0xfff80001002011d8
       Cannot access memory at address 0xfff80001002011d8
       From                To                  Syms Read   Shared Object
Library
       0xfff80001000010a0  0xfff8000100021f80  Yes (*)     /lib64/ld-linux.so.2
       (*): Shared library is missing debugging information.

    Those addresses are 64-bit addresses with the high bits set.  When
    interpreted as signed, they're negative.

    The Linux kernel rejects pread64/pwrite64 if the offset argument of
    type off_t (a signed type) is negative, which happens if the memory
    address we're accessing has its high bit set.  See
    linux/fs/read_write.c sys_pread64 and sys_pwrite64 in Linux.

    Thankfully, lseek does not fail in that situation.  So the fix is to
    use the 'lseek + read|write' path if the offset would be negative.

    Fix this in both native GDB and GDBserver.

    Tested on a SPARC64 GNU/Linux and x86-64 GNU/Linux.

    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30525
    Change-Id: I79c724f918037ea67b7396fadb521bc9d1b10dc5

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2023-07-06 16:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06 19:19 [Bug gdb/30525] New: " mattst88 at gmail dot com
2023-06-06 19:19 ` [Bug gdb/30525] " mattst88 at gmail dot com
2023-06-06 22:27 ` mattst88 at gmail dot com
2023-06-07  8:36 ` sam at gentoo dot org
2023-06-07  8:37 ` sam at gentoo dot org
2023-06-07  9:05 ` pedro at palves dot net
2023-06-07 10:19 ` pedro at palves dot net
2023-06-07 10:44 ` pedro at palves dot net
2023-06-07 14:43 ` mattst88 at gmail dot com
2023-06-07 15:18 ` mattst88 at gmail dot com
2023-06-07 15:33 ` mattst88 at gmail dot com
2023-06-07 22:11 ` pedro at palves dot net
2023-06-07 22:12 ` pedro at palves dot net
2023-06-07 23:57 ` mattst88 at gmail dot com
2023-06-14 23:42 ` mattst88 at gmail dot com
2023-06-15 10:39 ` pedro at palves dot net
2023-07-05 13:43 ` pedro at palves dot net
2023-07-06 16:58 ` cvs-commit at gcc dot gnu.org [this message]
2023-07-06 20:55 ` sam at gentoo dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30525-4717-YKlXh6xURi@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).