Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 149350 Details for
Bug 230850
/proc/PID/mem is not readable
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch on-demand PTRACE_ATTACHING the inferior for /proc/PID/mem read(2).
elfutils-0.126-mem-ptrace3.patch (text/plain), 1.90 KB, created by
Jan Kratochvil
on 2007-03-06 16:27:06 UTC
(
hide
)
Description:
Patch on-demand PTRACE_ATTACHING the inferior for /proc/PID/mem read(2).
Filename:
MIME Type:
Creator:
Jan Kratochvil
Created:
2007-03-06 16:27:06 UTC
Size:
1.90 KB
patch
obsolete
>--- elfutils-0.126-orig/libdwfl/linux-proc-maps.c 2007-01-30 17:19:22.000000000 +0100 >+++ elfutils-0.126/libdwfl/linux-proc-maps.c 2007-03-06 17:10:42.000000000 +0100 >@@ -60,6 +60,8 @@ > #include <unistd.h> > #include <assert.h> > #include <endian.h> >+#include <sys/ptrace.h> >+#include <sys/wait.h> > > > #define PROCMAPSFMT "/proc/%d/maps" >@@ -261,12 +263,28 @@ dwfl_linux_proc_report (Dwfl *dwfl, pid_ > } > INTDEF (dwfl_linux_proc_report) > >+struct read_proc_memory >+ { >+ /* PID gets zero on our successful PTRACE_ATTACH. */ >+ pid_t pid; >+ int fd; >+ }; >+ > static ssize_t >-read_proc_memory (void *arg, void *data, GElf_Addr address, >+read_proc_memory (void *arg_pointer, void *data, GElf_Addr address, > size_t minread, size_t maxread) > { >- const int fd = *(const int *) arg; >- ssize_t nread = pread64 (fd, data, maxread, (off64_t) address); >+ struct read_proc_memory *arg = arg_pointer; >+ ssize_t nread = pread64 (arg->fd, data, maxread, (off64_t) address); >+ /* We may read /proc/PID/mem only for `PID == getpid()' or if PID is actively >+ PTRACEd by ourselves. */ >+ if (nread == -1 && errno == ESRCH && arg->pid != 0 >+ && ptrace (PTRACE_ATTACH, arg->pid, NULL, NULL) == 0) >+ { >+ arg->pid = 0; >+ /* FIXME: Race? waitpid() here locks up for `vdso-test'. */ >+ nread = pread64 (arg->fd, data, maxread, (off64_t) address); >+ } > if (nread > 0 && (size_t) nread < minread) > nread = 0; > return nread; >@@ -319,9 +337,17 @@ dwfl_linux_proc_find_elf (Dwfl_Module *m > if (fd < 0) > return -1; > >- *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, &fd); >+ struct read_proc_memory arg; >+ arg.pid = pid; >+ arg.fd = fd; >+ *elfp = elf_from_remote_memory (base, NULL, &read_proc_memory, &arg); > > close (fd); >+ if (arg.pid == 0) >+ { >+ if (ptrace (PTRACE_DETACH, pid, NULL, NULL) != 0) >+ return -1; >+ } > > *file_name = NULL; > return -1;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 230850
:
149185
|
149186
|
149248
| 149350