mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Hugh Dickins <hughd@google.com>, Andrey Vagin <avagin@openvz.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Pavel Emelyanov <xemul@virtuozzo.com>,
	Dmitry Safonov <dsafonov@virtuozzo.com>,
	Andrew Morton <akpm@linuxfoundation.org>
Subject: Re: [criu] 1M guard page ruined restore
Date: Tue, 20 Jun 2017 12:51:16 +0200	[thread overview]
Message-ID: <20170620105116.GA20974@redhat.com> (raw)
In-Reply-To: <20170620075206.GB1909@uranus.lan>

On 06/20, Cyrill Gorcunov wrote:
>
>  | diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
>  | index f0c8b33..520802d 100644
>  | --- a/fs/proc/task_mmu.c
>  | +++ b/fs/proc/task_mmu.c
>  | @@ -300,11 +300,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma, int is_pid)
>  |
>  |         /* We don't show the stack guard page in /proc/maps */
>  |         start = vma->vm_start;
>  | -       if (stack_guard_page_start(vma, start))
>  | -               start += PAGE_SIZE;
>  |         end = vma->vm_end;
>  | -       if (stack_guard_page_end(vma, end))
>  | -               end -= PAGE_SIZE;
>  |
>  |         seq_setwidth(m, 25 + sizeof(void *) * 6 - 1);
>  |         seq_printf(m, "%08lx-%08lx %c%c%c%c %08llx %02x:%02x %lu ",
>
> For which we of course are not ready because we've been implying the
> guard page is returned here so we adjust addresses locally when saving
> them into images.
>
> So now we need to figure out somehow if show_map_vma accounts [PAGE_SIZE|guard_area] or not,
> I guess we might use kernel version here but it won't be working fine on custom kernels,
> or kernels with the patch backported.

You can write a simple test. Just do mmap(MAP_GROWSDOWN) and look at
/proc/self/maps. If it reports vm_start + PAGE_SIZE rather than addr
returned by mmap, then the kernel is old.

> Second I guess we might need to detect @stack_guard_gap runtime as
> well

I do not think so. criu does not need to know about the new guard area
at all. It simply doesn't exist from user-space pov.

In fact, I think this should have been true even before this change, just
stack_guard_page_start() was not accurate and this is the reason (I guess)
you had to play with stack guard; the first page (hidden by show_map_vma)
can have a valid stack data, for example if the application played with
MAP_FIXED or munmap().

So I think you should simply disable, say, unmap_guard_pages() and most
of all other MAP_GROWSDOWN code in criu.

Oleg.

  parent reply	other threads:[~2017-06-20 10:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-20  7:52 Cyrill Gorcunov
2017-06-20 10:23 ` Hugh Dickins
2017-06-20 10:41   ` Cyrill Gorcunov
2017-06-21 15:22   ` Cyrill Gorcunov
2017-06-21 15:48     ` Cyrill Gorcunov
2017-06-21 15:57     ` Oleg Nesterov
2017-06-21 16:04       ` Cyrill Gorcunov
2017-06-21 17:01         ` Oleg Nesterov
2017-06-21 17:15           ` Dmitry Safonov
2017-06-21 17:19             ` Dmitry Safonov
2017-06-21 17:31               ` Oleg Nesterov
2017-06-21 17:37                 ` Dmitry Safonov
2017-06-21 17:52                 ` Dmitry Safonov
2017-06-22  1:24                   ` Hugh Dickins
2017-06-22  8:06                     ` Cyrill Gorcunov
2017-06-21 17:15           ` Oleg Nesterov
2017-06-21 17:53             ` Cyrill Gorcunov
2017-06-21 17:16           ` Willy Tarreau
2017-06-22 14:23           ` Oleg Nesterov
2017-06-22 15:05             ` Cyrill Gorcunov
2017-06-20 10:51 ` Oleg Nesterov [this message]
2017-06-20 11:10   ` Cyrill Gorcunov
2017-06-20 11:55   ` Cyrill Gorcunov

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=20170620105116.GA20974@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linuxfoundation.org \
    --cc=avagin@openvz.org \
    --cc=dsafonov@virtuozzo.com \
    --cc=gorcunov@gmail.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xemul@virtuozzo.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

Powered by JetHome