From: Benjamin LaHaise <bcrl@kvack.org>
To: Shaohua Li <shli@fb.com>
Cc: linux-mm@kvack.org, Kernel-team@fb.com,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/2] aio: make aio .mremap handle size changes
Date: Tue, 3 Feb 2015 14:23:23 -0500 [thread overview]
Message-ID: <20150203192323.GT2974@kvack.org> (raw)
In-Reply-To: <798fafb96373cfab0707457a266dd137016cd1e9.1422986358.git.shli@fb.com>
On Tue, Feb 03, 2015 at 11:18:53AM -0800, Shaohua Li wrote:
> mremap aio ring buffer to another smaller vma is legal. For example,
> mremap the ring buffer from the begining, though after the mremap, some
> ring buffer pages can't be accessed in userspace because vma size is
> shrinked. The problem is ctx->mmap_size isn't changed if the new ring
> buffer vma size is changed. Latter io_destroy will zap all vmas within
> mmap_size, which might zap unrelated vmas.
Nak. Shrinking the aio ring buffer is not a supported operation and will
cause the application to lose events. Make the size changing mremap fail,
as this patch will not make the system do the right thing.
-ben
> Cc: Benjamin LaHaise <bcrl@kvack.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Shaohua Li <shli@fb.com>
> ---
> fs/aio.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/aio.c b/fs/aio.c
> index 1b7893e..fa354cf 100644
> --- a/fs/aio.c
> +++ b/fs/aio.c
> @@ -306,6 +306,7 @@ static void aio_ring_remap(struct file *file, struct vm_area_struct *vma)
> ctx = table->table[i];
> if (ctx && ctx->aio_ring_file == file) {
> ctx->user_id = ctx->mmap_base = vma->vm_start;
> + ctx->mmap_size = vma->vm_end - vma->vm_start;
> break;
> }
> }
> --
> 1.8.1
--
"Thought is the essence of where you are now."
--
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>
next prev parent reply other threads:[~2015-02-03 19:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-03 19:18 [PATCH 1/2] mremap: don't allow VM_MIXEDMAP vma expanding Shaohua Li
2015-02-03 19:18 ` [PATCH 2/2] aio: make aio .mremap handle size changes Shaohua Li
2015-02-03 19:23 ` Benjamin LaHaise [this message]
2015-02-03 19:31 ` Shaohua Li
2015-02-03 19:48 ` Benjamin LaHaise
2015-02-03 21:31 ` Shaohua Li
2015-02-03 21:47 ` Benjamin LaHaise
2015-02-03 22:58 ` Shaohua Li
2015-02-03 23:25 ` Benjamin LaHaise
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=20150203192323.GT2974@kvack.org \
--to=bcrl@kvack.org \
--cc=Kernel-team@fb.com \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--cc=shli@fb.com \
/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