Hi Jason,
> I've tried the attached simple program on RedHat 2.4.9-17 and
> the lastest 2.4.17 build from IBM, and both fail miserably:

This is a bug in arch/{s390,s390x}/mm/fault.c that is present since the
beginning. A small wonder that nobody noticed it until now...
The following patch should take care of it:

diff -urN linux-2.4.17/arch/s390/mm/fault.c linux-2.4.17-s390/arch/s390/mm/fault.c
--- linux-2.4.17/arch/s390/mm/fault.c     Wed May 22 20:18:55 2002
+++ linux-2.4.17-s390/arch/s390/mm/fault.c      Wed May 22 20:14:10 2002
@@ -222,6 +222,9 @@
            /* page not present, check vm flags */
            if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
                  goto bad_area;
+     } else {
+           if (!(vma->vm_flags & VM_WRITE))
+                 goto bad_area;
      }

 survive:
diff -urN linux-2.4.17/arch/s390x/mm/fault.c linux-2.4.17-s390/arch/s390x/mm/fault.c
--- linux-2.4.17/arch/s390x/mm/fault.c    Wed May 22 20:19:08 2002
+++ linux-2.4.17-s390/arch/s390x/mm/fault.c     Wed May 22 20:14:10 2002
@@ -222,6 +222,9 @@
            /* page not present, check vm flags */
            if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
                  goto bad_area;
+     } else {
+           if (!(vma->vm_flags & VM_WRITE))
+                 goto bad_area;
      }

 survive:

blue skies,
   Martin

Linux/390 Design & Development, IBM Deutschland Entwicklung GmbH
Sch�naicherstr. 220, D-71032 B�blingen, Telefon: 49 - (0)7031 - 16-2247
E-Mail: [EMAIL PROTECTED]

Reply via email to