From: Juan Cespedes <cespedes@debian.org>
To: linux-kernel@vger.kernel.org
Subject: The ptrace() bug...
Date: Tue, 19 Feb 2002 23:05:23 +0100 [thread overview]
Message-ID: <20020219220523.GA10202@gizmo.thehackers.org> (raw)
Version 2.2.0 (at least) to 2.4.14-pre7 contain this line in
mm/memory.c:copy_page_range:
unsigned long cow = (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
Version 2.4.14-pre8 and later changed this line with:
unsigned long cow = (vma->vm_flags & (VM_SHARED | VM_WRITE)) == VM_WRITE;
This line decides if copy-on-write should be active in a vm_area just
after a fork. The latter is more correct IMHO, with one exception:
it breaks ptraced programs, because programs been ptraced can see their
pages modified without having the VM_WRITE flag, and this causes that
both the parent and the child may see their pages changed (copy-on-write
doesn't work).
Reverting that one-line patch solves many problems for me and I think
there are no other side-effects...
Could it be included in 2.4?
Thanks,
<====================================================================>
--- old/linux-2.4.17/mm/memory.c Fri Dec 21 18:42:05 2001
+++ linux-2.4.17/mm/memory.c Sun Feb 17 20:38:20 2002
@@ -177,7 +177,7 @@
pgd_t * src_pgd, * dst_pgd;
unsigned long address = vma->vm_start;
unsigned long end = vma->vm_end;
- unsigned long cow = (vma->vm_flags & (VM_SHARED | VM_WRITE)) == VM_WRITE;
+ unsigned long cow = (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
src_pgd = pgd_offset(src, address)-1;
dst_pgd = pgd_offset(dst, address)-1;
<====================================================================>
--
.+'''+. .+'''+. .+'''+. .+'''+. .+''
Juan Cespedes / \ / \ cespedes@TheHackers.org
.+' `+...+' `+...+' `+...+' `+...+'
reply other threads:[~2002-02-19 22:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20020219220523.GA10202@gizmo.thehackers.org \
--to=cespedes@debian.org \
--cc=linux-kernel@vger.kernel.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 NNTP newsgroup(s).