All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Franck <afranck@gmx.de>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: florin@iucha.net (Florin Iucha), linux-kernel@vger.kernel.org
Subject: Re: Linux 2.4.19pre1-ac1
Date: Thu, 28 Feb 2002 01:27:32 +0100	[thread overview]
Message-ID: <02022801273203.01097@dg1kfa> (raw)
In-Reply-To: <E16gEWj-0006aD-00@the-village.bc.nu>
In-Reply-To: <E16gEWj-0006aD-00@the-village.bc.nu>

Hi Alan!

> > Will try this now, sounds possible - but does patch really use shared
> > memory? I will try to narrow it down a bit. There also were some changes
> > to mm/memory.c between 2.4.18-rc2-ac2 and 2.4.18-ac1. Also a possibility?
>
> Could be - as far as I can tell they are also in vanilla 2.4.18 (the
> ptrace ones)

The changes I see here between them do not seem to be related to ptrace. But 
I think I already found one possible glitch by manual inspection there. Both 
kernels are compiling just now so I can test later.

diff -u -r linux-2.4.18-rc2-ac2/mm/memory.c linux-2.4.18-ac1/mm/memory.c
--- linux-2.4.18-rc2-ac2/mm/memory.c    Thu Feb 28 01:01:51 2002
+++ linux-2.4.18-ac1/mm/memory.c        Thu Feb 28 00:54:09 2002
@@ -180,7 +180,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;
@@ -250,7 +250,7 @@
                                        goto cont_copy_pte_range;
 
                                /* If it's a COW mapping, write protect it 
both in the parent and the child */
-                               if (cow) {
+                               if (cow && pte_write(pte)) {
                                        ptep_set_wrprotect(src_pte);
                                        pte = *src_pte;
                                }
@@ -460,21 +460,24 @@
 int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned 
long start,
                int len, int write, int force, struct page **pages, struct 
vm_area_struct **vmas)
 {
-       int i = 0;
+       int i;
+       unsigned int flags;
+
+       /*
+        * Require read or write permissions.
+        * If 'force' is set, we only require the "MAY" flags.
+        */
+       flags = write ? (VM_WRITE | VM_MAYWRITE) : (VM_READ | VM_MAYREAD);
+       flags &= force ? (VM_MAYREAD | VM_MAYWRITE) : (VM_READ | VM_WRITE);
+       i = 0;
 
        do {
                struct vm_area_struct * vma;
 
                vma = find_extend_vma(mm, start);
 
-               if ( !vma ||
-                   (pages && vma->vm_flags & VM_IO) ||
-                   (!force &&
-                       ((write && (!(vma->vm_flags & VM_WRITE))) ||
-                        (!write && (!(vma->vm_flags & VM_READ))) ) )) {
-                       if (i) return i;
-                       return -EFAULT;
-               }
+               if ( !vma || (pages && vma->vm_flags & VM_IO) || !(flags & 
vma->vm_flags) )
+                       return i ? : -EFAULT;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- This looks somewhat bogus, 
shouldn't it be "return i ? i : -EFAULT;" instead?

Greetings,
Andreas

  reply	other threads:[~2002-02-28  0:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-27 22:31 Linux 2.4.19pre1-ac1 Andreas Franck
2002-02-27 23:41 ` Alan Cox
2002-02-28  0:13   ` Andreas Franck
2002-02-28  0:34     ` Alan Cox
2002-02-28  0:27       ` Andreas Franck [this message]
2002-02-28  0:32         ` David S. Miller
2002-02-28  1:02         ` Alan Cox
2002-02-28  6:31   ` Florin Iucha
     [not found] <fa.kjtklqv.gnqri3@ifi.uio.no>
     [not found] ` <fa.g63p78v.1e7kv8e@ifi.uio.no>
2002-02-28  0:19   ` Jonathan Hudson
     [not found] <fa.c7mcedv.1a3esq4@ifi.uio.no>
2002-02-27 22:54 ` Jonathan Hudson
2002-02-27 23:48   ` Alan Cox
     [not found] ` <fa.g5iqv0v.11magge@ifi.uio.no>
2002-02-27 23:36   ` Jonathan Hudson
  -- strict thread matches above, loose matches on Subject: below --
2002-02-26  1:47 Alan Cox
2002-02-27 21:14 ` Florin Iucha

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=02022801273203.01097@dg1kfa \
    --to=afranck@gmx.de \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=florin@iucha.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.