lkml.org 
[lkml]   [2002]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectThe ptrace() bug...
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
.+' `+...+' `+...+' `+...+' `+...+'
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:24    [W:0.028 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site