Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1706273
| Path | csiph.com!news.redatomik.org!weretis.net!feeder4.news.weretis.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Will Deacon <will.deacon@arm.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] arm64/vdso: Support mremap() for vDSO |
| Date | Tue, 08 Aug 2017 11:50:04 +0200 |
| Message-ID | <uc9je-69T-29@gated-at.bofh.it> (permalink) |
| References | <u8gCC-6cX-7@gated-at.bofh.it> <u8gCC-6cX-5@gated-at.bofh.it> <u8iO6-7Od-3@gated-at.bofh.it> <ua4nE-3Eo-25@gated-at.bofh.it> <uc99w-65V-15@gated-at.bofh.it> |
| X-Original-To | Dmitry Safonov <0x7f454c46@gmail.com> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.5.23 (2014-03-12) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 73 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Dmitry Safonov <dsafonov@virtuozzo.com>, open list <linux-kernel@vger.kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, Russell King <rmk+kernel@armlinux.org.uk>, linux-arm-kernel@lists.infradead.org, Cyrill Gorcunov <gorcunov@openvz.org>, Pavel Emelyanov <xemul@virtuozzo.com>, Christopher Covington <cov@codeaurora.org> |
| X-Original-Date | Tue, 8 Aug 2017 10:44:13 +0100 |
| X-Original-Message-ID | <20170808094413.GB13355@arm.com> |
| X-Original-References | <20170726170737.21696-1-dsafonov@virtuozzo.com> <20170728164800.GD14170@arm.com> <CAJwJo6bCxRvKvwmwwH7UZW2fRZkqTTqfnp0j85Si454pDQUjVw@mail.gmail.com> <20170802160401.GA16932@arm.com> <CAJwJo6bKgZnH+3RRGb_G1SN06hyx=g49OMrrZS8F3PoMa3t-sA@mail.gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1706273 |
Show key headers only | View raw
On Tue, Aug 08, 2017 at 12:29:50PM +0300, Dmitry Safonov wrote:
> 2017-08-02 19:04 GMT+03:00 Will Deacon <will.deacon@arm.com>:
> > On Fri, Jul 28, 2017 at 10:06:20PM +0300, Dmitry Safonov wrote:
> >> 2017-07-28 19:48 GMT+03:00 Will Deacon <will.deacon@arm.com>:
> >> > On Wed, Jul 26, 2017 at 08:07:37PM +0300, Dmitry Safonov wrote:
> >> >> vDSO VMA address is saved in mm_context for the purpose of using
> >> >> restorer from vDSO page to return to userspace after signal handling.
> >> >>
> >> >> In Checkpoint Restore in Userspace (CRIU) project we place vDSO VMA
> >> >> on restore back to the place where it was on the dump.
> >> >> With the exception for x86 (where there is API to map vDSO with
> >> >> arch_prctl()), we move vDSO inherited from CRIU task to restoree
> >> >> position by mremap().
> >> >>
> >> >> CRIU does support arm64 architecture, but kernel doesn't update
> >> >> context.vdso pointer after mremap(). Which results in translation
> >> >> fault after signal handling on restored application:
> >> >> https://github.com/xemul/criu/issues/288
> >> >>
> >> >> Make vDSO code track the VMA address by supplying .mremap() fops
> >> >> the same way it's done for x86 and arm32 by:
> >> >> commit b059a453b1cf ("x86/vdso: Add mremap hook to vm_special_mapping")
> >> >> commit 280e87e98c09 ("ARM: 8683/1: ARM32: Support mremap() for sigpage/vDSO").
> >> >>
> >> >> Cc: Catalin Marinas <catalin.marinas@arm.com>
> >> >> Cc: Will Deacon <will.deacon@arm.com>
> >> >> Cc: Russell King <rmk+kernel@armlinux.org.uk>
> >> >> Cc: linux-arm-kernel@lists.infradead.org
> >> >> Cc: Cyrill Gorcunov <gorcunov@openvz.org>
> >> >> Cc: Pavel Emelyanov <xemul@virtuozzo.com>
> >> >> Cc: Christopher Covington <cov@codeaurora.org>
> >> >> Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
> >> >> ---
> >> >> arch/arm64/kernel/vdso.c | 15 +++++++++++++++
> >> >> 1 file changed, 15 insertions(+)
> >> >>
> >> >> diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c
> >> >> index e8f759f764f2..2d419006ad43 100644
> >> >> --- a/arch/arm64/kernel/vdso.c
> >> >> +++ b/arch/arm64/kernel/vdso.c
> >> >> @@ -110,12 +110,27 @@ int aarch32_setup_vectors_page(struct linux_binprm *bprm, int uses_interp)
> >> >> }
> >> >> #endif /* CONFIG_COMPAT */
> >> >>
> >> >> +static int vdso_mremap(const struct vm_special_mapping *sm,
> >> >> + struct vm_area_struct *new_vma)
> >> >> +{
> >> >> + unsigned long new_size = new_vma->vm_end - new_vma->vm_start;
> >> >> + unsigned long vdso_size = vdso_end - vdso_start;
> >> >
> >> > You might be able to use vdso_pages here, but it depends on my question
> >> > below.
> >>
> >> Yes, shifting with PAGE_SHIFT.
> >> Is it just a preference?
> >
> > Yeah, just a minor thing, although thinking about it again, I don't know
> > what you're trying to achieve with the size check anyway. Userspace is only
> > going to hurt itself if it screws up the layout, so why police this?
>
> Well, it's for keeping the same semantics as on x86.
> The idea of restriction to partial mremap() is suggested by Andy
> so that userspace won't be allowed to hurt itself and to simplify
> kernel code on x86.
I still don't see why that's a useful thing for us to be doing on arm64, but
ok.
Either way:
Reviewed-by: Will Deacon <will.deacon@arm.com>
Will
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] arm64/vdso: Support mremap() for vDSO Will Deacon <will.deacon@arm.com> - 2017-08-02 18:10 +0200
Re: [PATCH] arm64/vdso: Support mremap() for vDSO Dmitry Safonov <0x7f454c46@gmail.com> - 2017-08-08 11:40 +0200
Re: [PATCH] arm64/vdso: Support mremap() for vDSO Will Deacon <will.deacon@arm.com> - 2017-08-08 11:50 +0200
Re: [PATCH] arm64/vdso: Support mremap() for vDSO Dmitry Safonov <0x7f454c46@gmail.com> - 2017-08-08 19:10 +0200
csiph-web