All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ollie Wild <aaw@google.com>
Cc: linux-kernel@vger.kernel.org,
	parisc-linux@lists.parisc-linux.org,
	Linus Torvalds <torvalds@osdl.org>,
	Arjan van de Ven <arjan@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-mm@kvack.org, Andrew Morton <akpm@osdl.org>,
	Andi Kleen <ak@muc.de>,
	linux-arch@vger.kernel.org, David Howells <dhowells@redhat.com>
Subject: Re: Removing MAX_ARG_PAGES (request for comments/assistance)
Date: Wed, 11 Oct 2006 15:14:20 +0200	[thread overview]
Message-ID: <1160572460.2006.79.camel@taijtu> (raw)
In-Reply-To: <65dd6fd50610101705t3db93a72sc0847cd120aa05d3@mail.gmail.com>

On Tue, 2006-10-10 at 17:05 -0700, Ollie Wild wrote:

> +                       vma->vm_flags &= ~VM_EXEC;
> +               // FIXME: Are the next two lines sufficient, or do I need to
> +               // do some additional magic?
> +               vma->vm_flags |= mm->def_flags;
> +               vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];

Yeah, you'll need to change the PTEs for those pages you created by
calling get_user_page() by calling an mprotect like function; perhaps
something like:

 struct vm_area_struct *prev;
 unsigned long vm_flags = vma->vm_flags;

 s/vma->vm_flags/vm_flags/g

 err = mprotect_fixup(vma, &prev, vma->vm_start, vma->vm_end, vm_flags);
 BUG_ON(prev != vma);

mprotect_fixup will then set the new protection on all PTEs and update
vma->vm_flags and vma->vm_page_prot.

> +               /* Move stack pages down in memory. */
> +               if (stack_shift) {
> +                       // FIXME: Verify the shift is OK.
> +

What exactly are you wondering about? the call to move_vma looks sane to
me

> +                       /* This should be safe even with overlap because we
> +                        * are shifting down. */
> +                       ret = move_vma(vma, vma->vm_start,
> +                                       vma->vm_end - vma->vm_start,
> +                                       vma->vm_end - vma->vm_start,
> +                                       vma->vm_start - stack_shift);
> +                       if (ret & ~PAGE_MASK) {
> +                               up_write(&mm->mmap_sem);
> +                               return ret;
> +                       }
>                 }



WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Ollie Wild <aaw@google.com>
Cc: linux-kernel@vger.kernel.org,
	parisc-linux@lists.parisc-linux.org,
	Linus Torvalds <torvalds@osdl.org>,
	Arjan van de Ven <arjan@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-mm@kvack.org, Andrew Morton <akpm@osdl.org>,
	Andi Kleen <ak@muc.de>,
	linux-arch@vger.kernel.org, David Howells <dhowells@redhat.com>
Subject: Re: Removing MAX_ARG_PAGES (request for comments/assistance)
Date: Wed, 11 Oct 2006 15:14:20 +0200	[thread overview]
Message-ID: <1160572460.2006.79.camel@taijtu> (raw)
In-Reply-To: <65dd6fd50610101705t3db93a72sc0847cd120aa05d3@mail.gmail.com>

On Tue, 2006-10-10 at 17:05 -0700, Ollie Wild wrote:

> +                       vma->vm_flags &= ~VM_EXEC;
> +               // FIXME: Are the next two lines sufficient, or do I need to
> +               // do some additional magic?
> +               vma->vm_flags |= mm->def_flags;
> +               vma->vm_page_prot = protection_map[vma->vm_flags & 0x7];

Yeah, you'll need to change the PTEs for those pages you created by
calling get_user_page() by calling an mprotect like function; perhaps
something like:

 struct vm_area_struct *prev;
 unsigned long vm_flags = vma->vm_flags;

 s/vma->vm_flags/vm_flags/g

 err = mprotect_fixup(vma, &prev, vma->vm_start, vma->vm_end, vm_flags);
 BUG_ON(prev != vma);

mprotect_fixup will then set the new protection on all PTEs and update
vma->vm_flags and vma->vm_page_prot.

> +               /* Move stack pages down in memory. */
> +               if (stack_shift) {
> +                       // FIXME: Verify the shift is OK.
> +

What exactly are you wondering about? the call to move_vma looks sane to
me

> +                       /* This should be safe even with overlap because we
> +                        * are shifting down. */
> +                       ret = move_vma(vma, vma->vm_start,
> +                                       vma->vm_end - vma->vm_start,
> +                                       vma->vm_end - vma->vm_start,
> +                                       vma->vm_start - stack_shift);
> +                       if (ret & ~PAGE_MASK) {
> +                               up_write(&mm->mmap_sem);
> +                               return ret;
> +                       }
>                 }


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2006-10-11 13:14 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-11  0:05 Removing MAX_ARG_PAGES (request for comments/assistance) Ollie Wild
2006-10-11  8:00 ` Arjan van de Ven
2006-10-11  8:00   ` Arjan van de Ven
2006-10-11 17:13   ` Ollie Wild
2006-10-11 17:13     ` Ollie Wild
2006-10-11 17:13   ` [parisc-linux] " Ollie Wild
2006-10-11  8:00 ` Arjan van de Ven
2006-10-11 13:14 ` Peter Zijlstra
2006-10-11 13:14 ` Peter Zijlstra [this message]
2006-10-11 13:14   ` Peter Zijlstra
2006-10-11 21:48   ` Ollie Wild
2006-10-24 17:48     ` [parisc-linux] " Ollie Wild
2006-10-24 17:48     ` Ollie Wild
2006-10-24 17:48       ` Ollie Wild
     [not found]       ` <1161712748.24143.54.camel@taijtu>
2006-10-24 18:47         ` Ollie Wild
2006-12-29 20:03       ` [patch] remove MAX_ARG_PAGES Ingo Molnar
2006-12-29 20:03         ` Ingo Molnar
2006-12-29 20:49         ` [parisc-linux] " Russell King
2006-12-29 20:49         ` Russell King
2006-12-29 20:49           ` Russell King
2006-12-29 21:23           ` Linus Torvalds
2006-12-29 21:23             ` Linus Torvalds
2006-12-29 22:20             ` [parisc-linux] " Ingo Molnar
2006-12-29 22:20             ` Ingo Molnar
2006-12-29 22:20               ` Ingo Molnar
2006-12-29 21:23           ` [parisc-linux] " Linus Torvalds
2006-12-29 21:57           ` Ingo Molnar
2006-12-29 21:57           ` Ingo Molnar
2006-12-29 21:57             ` Ingo Molnar
2007-01-01  6:51         ` Ollie Wild
2007-01-01  6:51         ` [parisc-linux] " Ollie Wild
2007-01-01  6:58         ` Ollie Wild
2007-01-01  6:58         ` Ollie Wild
2007-01-01  6:58           ` Ollie Wild
2007-01-01 17:28         ` [parisc-linux] " Pavel Machek
2007-01-01 17:28         ` Pavel Machek
2007-01-01 17:28           ` Pavel Machek
2006-12-29 20:03       ` [parisc-linux] " Ingo Molnar
2007-01-02 18:18       ` [parisc-linux] " David Howells
2007-01-02 18:18       ` David Howells
2007-01-02 18:18         ` David Howells
2006-10-11 21:48   ` [parisc-linux] Re: Removing MAX_ARG_PAGES (request for comments/assistance) Ollie Wild
2007-01-02 17:52 ` David Howells
2007-01-02 17:52 ` David Howells
2007-01-02 17:52   ` David Howells

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=1160572460.2006.79.camel@taijtu \
    --to=a.p.zijlstra@chello.nl \
    --cc=aaw@google.com \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=dhowells@redhat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=parisc-linux@lists.parisc-linux.org \
    --cc=torvalds@osdl.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.