| Summary: | ptraced process behavior gone wacky in latest kernels | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Tom Horsley <horsley1953> |
| Component: | kernel | Assignee: | Kernel Maintainer List <kernel-maint> |
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 16 | CC: | gansalmon, itamar, jonathan, kernel-maint, madhu.chinakonda, onestero |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-02-14 17:52:06 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
|
Description
Tom Horsley
2012-02-14 15:17:48 UTC
This is probably due to:
commit e268337dfe26dfc7efd422a804dbb27977a3cccc
Author: Linus Torvalds <torvalds>
Date: Tue Jan 17 15:21:19 2012 -0800
proc: clean up and fix /proc/<pid>/mem handling
Jüri Aedla reported that the /proc/<pid>/mem handling really isn't very
robust, and it also doesn't match the permission checking of any of the
other related files.
This changes it to do the permission checks at open time, and instead of
tracking the process, it tracks the VM at the time of the open. That
simplifies the code a lot, but does mean that if you hold the file
descriptor open over an execve(), you'll continue to read from the _old_
VM.
That is different from our previous behavior, but much simpler. If
somebody actually finds a load where this matters, we'll need to revert
this commit.
I suspect that nobody will ever notice - because the process mapping
addresses will also have changed as part of the execve. So you cannot
actually usefully access the fd across a VM change simply because all
the offsets for IO would have changed too.
Reported-by: Jüri Aedla <asd>
Cc: Al Viro <viro.org.uk>
Signed-off-by: Linus Torvalds <torvalds>
which went in as a security fix. You probably want to email upstream about your usecase and see what they say.
I'll look at the code. I would have thought I was already closing the fd on exec, but maybe I'm not. If I can fix all my problems by closing and reopening the fd across the exec, that shouldn't be difficult. (In reply to comment #2) > > If I can fix all my problems by closing > and reopening the fd across the exec, that shouldn't be difficult. Yes, please. I do not think it is possible to return to the previous semantics of /proc/pid/mem. BTW, on the recent kernel you can use sys_process_vm_readv/writev instead, it doesn't need fd/open/etc. Thanks for the info. I guess I'll need to investigate the new sys_process_vm stuff and add yet another thing for my ptrace-features program to detect and use if available. I did indeed find that all my problems disappeared when I closed the fd and reopened it (though the logic in Linus' comment is a little flawed since you can easily re-read the maps without ever closing the mem file, which is what the code was doing previously). Again, thanks to everyone for the rapid response with exactly the info I needed. I guess I can close this as not a bug. |