* [PATCH] arm64: Support VDSO remapping
@ 2015-11-25 12:49 Christopher Covington
2015-12-02 12:19 ` Will Deacon
0 siblings, 1 reply; 3+ messages in thread
From: Christopher Covington @ 2015-11-25 12:49 UTC (permalink / raw)
To: Catalin Marinas, Will Deacon, linux-arm-kernel
Cc: linux-arm-msm, Christopher Covington, Jens Axboe, Andrew Morton,
Jason Cooper, Laurent Dufour, Daniel Borkmann, Marc Zyngier,
Ingo Molnar, Ard Biesheuvel, Mark Rutland, linux-kernel
Some applications such as Checkpoint/Restore In Userspace (CRIU) remap and
unmap the VDSO. Add support for this to the AArch64 kernel by copying in
the PowerPC code with slight modifications.
Signed-off-by: Christopher Covington <cov@codeaurora.org>
---
arch/arm64/include/asm/Kbuild | 1 -
arch/arm64/include/asm/mm-arch-hooks.h | 28 ++++++++++++++++++++++++++++
arch/arm64/include/asm/mmu_context.h | 23 ++++++++++++++++++++++-
3 files changed, 50 insertions(+), 2 deletions(-)
create mode 100644 arch/arm64/include/asm/mm-arch-hooks.h
diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
index 70fd9ff..b112a39 100644
--- a/arch/arm64/include/asm/Kbuild
+++ b/arch/arm64/include/asm/Kbuild
@@ -25,7 +25,6 @@ generic-y += kvm_para.h
generic-y += local.h
generic-y += local64.h
generic-y += mcs_spinlock.h
-generic-y += mm-arch-hooks.h
generic-y += mman.h
generic-y += msgbuf.h
generic-y += msi.h
diff --git a/arch/arm64/include/asm/mm-arch-hooks.h b/arch/arm64/include/asm/mm-arch-hooks.h
new file mode 100644
index 0000000..e6923fb
--- /dev/null
+++ b/arch/arm64/include/asm/mm-arch-hooks.h
@@ -0,0 +1,28 @@
+/*
+ * Architecture specific mm hooks
+ *
+ * Copyright (C) 2015, IBM Corporation
+ * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ASM_MM_ARCH_HOOKS_H
+#define __ASM_MM_ARCH_HOOKS_H
+
+static inline void arch_remap(struct mm_struct *mm,
+ unsigned long old_start, unsigned long old_end,
+ unsigned long new_start, unsigned long new_end)
+{
+ /*
+ * mremap() doesn't allow moving multiple vmas so we can limit the
+ * check to old_start == vdso_base.
+ */
+ if ((void *)old_start == mm->context.vdso)
+ mm->context.vdso = (void *)new_start;
+}
+#define arch_remap arch_remap
+
+#endif /* __ASM_MM_ARCH_HOOKS_H */
diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
index 2416578..9fe0773 100644
--- a/arch/arm64/include/asm/mmu_context.h
+++ b/arch/arm64/include/asm/mmu_context.h
@@ -24,7 +24,6 @@
#include <asm/cacheflush.h>
#include <asm/proc-fns.h>
-#include <asm-generic/mm_hooks.h>
#include <asm/cputype.h>
#include <asm/pgtable.h>
@@ -147,4 +146,26 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
#define deactivate_mm(tsk,mm) do { } while (0)
#define activate_mm(prev,next) switch_mm(prev, next, NULL)
+static inline void arch_dup_mmap(struct mm_struct *oldmm,
+ struct mm_struct *mm)
+{
+}
+
+static inline void arch_exit_mmap(struct mm_struct *mm)
+{
+}
+
+static inline void arch_unmap(struct mm_struct *mm,
+ struct vm_area_struct *vma,
+ unsigned long start, unsigned long end)
+{
+ if ((void *)start <= mm->context.vdso && mm->context.vdso < (void *)end)
+ mm->context.vdso = NULL;
+}
+
+static inline void arch_bprm_mm_init(struct mm_struct *mm,
+ struct vm_area_struct *vma)
+{
+}
+
#endif
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] arm64: Support VDSO remapping
2015-11-25 12:49 [PATCH] arm64: Support VDSO remapping Christopher Covington
@ 2015-12-02 12:19 ` Will Deacon
2015-12-03 18:05 ` Christopher Covington
0 siblings, 1 reply; 3+ messages in thread
From: Will Deacon @ 2015-12-02 12:19 UTC (permalink / raw)
To: Christopher Covington
Cc: Catalin Marinas, linux-arm-kernel, linux-arm-msm, Jens Axboe,
Andrew Morton, Jason Cooper, Laurent Dufour, Daniel Borkmann,
Marc Zyngier, Ingo Molnar, Ard Biesheuvel, Mark Rutland,
linux-kernel
Hi Christopher,
On Wed, Nov 25, 2015 at 07:49:29AM -0500, Christopher Covington wrote:
> Some applications such as Checkpoint/Restore In Userspace (CRIU) remap and
> unmap the VDSO. Add support for this to the AArch64 kernel by copying in
> the PowerPC code with slight modifications.
>
> Signed-off-by: Christopher Covington <cov@codeaurora.org>
> ---
> arch/arm64/include/asm/Kbuild | 1 -
> arch/arm64/include/asm/mm-arch-hooks.h | 28 ++++++++++++++++++++++++++++
> arch/arm64/include/asm/mmu_context.h | 23 ++++++++++++++++++++++-
> 3 files changed, 50 insertions(+), 2 deletions(-)
> create mode 100644 arch/arm64/include/asm/mm-arch-hooks.h
>
> diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
> index 70fd9ff..b112a39 100644
> --- a/arch/arm64/include/asm/Kbuild
> +++ b/arch/arm64/include/asm/Kbuild
> @@ -25,7 +25,6 @@ generic-y += kvm_para.h
> generic-y += local.h
> generic-y += local64.h
> generic-y += mcs_spinlock.h
> -generic-y += mm-arch-hooks.h
> generic-y += mman.h
> generic-y += msgbuf.h
> generic-y += msi.h
> diff --git a/arch/arm64/include/asm/mm-arch-hooks.h b/arch/arm64/include/asm/mm-arch-hooks.h
> new file mode 100644
> index 0000000..e6923fb
> --- /dev/null
> +++ b/arch/arm64/include/asm/mm-arch-hooks.h
> @@ -0,0 +1,28 @@
> +/*
> + * Architecture specific mm hooks
> + *
> + * Copyright (C) 2015, IBM Corporation
> + * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef __ASM_MM_ARCH_HOOKS_H
> +#define __ASM_MM_ARCH_HOOKS_H
> +
> +static inline void arch_remap(struct mm_struct *mm,
> + unsigned long old_start, unsigned long old_end,
> + unsigned long new_start, unsigned long new_end)
> +{
> + /*
> + * mremap() doesn't allow moving multiple vmas so we can limit the
> + * check to old_start == vdso_base.
> + */
> + if ((void *)old_start == mm->context.vdso)
> + mm->context.vdso = (void *)new_start;
> +}
> +#define arch_remap arch_remap
> +
> +#endif /* __ASM_MM_ARCH_HOOKS_H */
> diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
> index 2416578..9fe0773 100644
> --- a/arch/arm64/include/asm/mmu_context.h
> +++ b/arch/arm64/include/asm/mmu_context.h
> @@ -24,7 +24,6 @@
>
> #include <asm/cacheflush.h>
> #include <asm/proc-fns.h>
> -#include <asm-generic/mm_hooks.h>
> #include <asm/cputype.h>
> #include <asm/pgtable.h>
>
> @@ -147,4 +146,26 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
> #define deactivate_mm(tsk,mm) do { } while (0)
> #define activate_mm(prev,next) switch_mm(prev, next, NULL)
>
> +static inline void arch_dup_mmap(struct mm_struct *oldmm,
> + struct mm_struct *mm)
> +{
> +}
> +
> +static inline void arch_exit_mmap(struct mm_struct *mm)
> +{
> +}
> +
> +static inline void arch_unmap(struct mm_struct *mm,
> + struct vm_area_struct *vma,
> + unsigned long start, unsigned long end)
> +{
> + if ((void *)start <= mm->context.vdso && mm->context.vdso < (void *)end)
> + mm->context.vdso = NULL;
> +}
> +
> +static inline void arch_bprm_mm_init(struct mm_struct *mm,
> + struct vm_area_struct *vma)
> +{
> +}
This is virtually identical to the PowerPC implementation, afaict. Any
chance we could move this to core code and define some generic vdso
accessors for the mm?
Will
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] arm64: Support VDSO remapping
2015-12-02 12:19 ` Will Deacon
@ 2015-12-03 18:05 ` Christopher Covington
0 siblings, 0 replies; 3+ messages in thread
From: Christopher Covington @ 2015-12-03 18:05 UTC (permalink / raw)
To: Will Deacon
Cc: Mark Rutland, Jason Cooper, Ard Biesheuvel, Marc Zyngier,
Catalin Marinas, linux-kernel, Jens Axboe, Daniel Borkmann,
linux-arm-msm, Andrew Morton, Laurent Dufour, Ingo Molnar,
linux-arm-kernel
On 12/02/2015 07:19 AM, Will Deacon wrote:
> Hi Christopher,
>
> On Wed, Nov 25, 2015 at 07:49:29AM -0500, Christopher Covington wrote:
>> Some applications such as Checkpoint/Restore In Userspace (CRIU) remap and
>> unmap the VDSO. Add support for this to the AArch64 kernel by copying in
>> the PowerPC code with slight modifications.
>>
>> Signed-off-by: Christopher Covington <cov@codeaurora.org>
>> ---
>> arch/arm64/include/asm/Kbuild | 1 -
>> arch/arm64/include/asm/mm-arch-hooks.h | 28 ++++++++++++++++++++++++++++
>> arch/arm64/include/asm/mmu_context.h | 23 ++++++++++++++++++++++-
>> 3 files changed, 50 insertions(+), 2 deletions(-)
>> create mode 100644 arch/arm64/include/asm/mm-arch-hooks.h
>>
>> diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild
>> index 70fd9ff..b112a39 100644
>> --- a/arch/arm64/include/asm/Kbuild
>> +++ b/arch/arm64/include/asm/Kbuild
>> @@ -25,7 +25,6 @@ generic-y += kvm_para.h
>> generic-y += local.h
>> generic-y += local64.h
>> generic-y += mcs_spinlock.h
>> -generic-y += mm-arch-hooks.h
>> generic-y += mman.h
>> generic-y += msgbuf.h
>> generic-y += msi.h
>> diff --git a/arch/arm64/include/asm/mm-arch-hooks.h b/arch/arm64/include/asm/mm-arch-hooks.h
>> new file mode 100644
>> index 0000000..e6923fb
>> --- /dev/null
>> +++ b/arch/arm64/include/asm/mm-arch-hooks.h
>> @@ -0,0 +1,28 @@
>> +/*
>> + * Architecture specific mm hooks
>> + *
>> + * Copyright (C) 2015, IBM Corporation
>> + * Author: Laurent Dufour <ldufour@linux.vnet.ibm.com>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#ifndef __ASM_MM_ARCH_HOOKS_H
>> +#define __ASM_MM_ARCH_HOOKS_H
>> +
>> +static inline void arch_remap(struct mm_struct *mm,
>> + unsigned long old_start, unsigned long old_end,
>> + unsigned long new_start, unsigned long new_end)
>> +{
>> + /*
>> + * mremap() doesn't allow moving multiple vmas so we can limit the
>> + * check to old_start == vdso_base.
>> + */
>> + if ((void *)old_start == mm->context.vdso)
>> + mm->context.vdso = (void *)new_start;
>> +}
>> +#define arch_remap arch_remap
>> +
>> +#endif /* __ASM_MM_ARCH_HOOKS_H */
>> diff --git a/arch/arm64/include/asm/mmu_context.h b/arch/arm64/include/asm/mmu_context.h
>> index 2416578..9fe0773 100644
>> --- a/arch/arm64/include/asm/mmu_context.h
>> +++ b/arch/arm64/include/asm/mmu_context.h
>> @@ -24,7 +24,6 @@
>>
>> #include <asm/cacheflush.h>
>> #include <asm/proc-fns.h>
>> -#include <asm-generic/mm_hooks.h>
>> #include <asm/cputype.h>
>> #include <asm/pgtable.h>
>>
>> @@ -147,4 +146,26 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
>> #define deactivate_mm(tsk,mm) do { } while (0)
>> #define activate_mm(prev,next) switch_mm(prev, next, NULL)
>>
>> +static inline void arch_dup_mmap(struct mm_struct *oldmm,
>> + struct mm_struct *mm)
>> +{
>> +}
>> +
>> +static inline void arch_exit_mmap(struct mm_struct *mm)
>> +{
>> +}
>> +
>> +static inline void arch_unmap(struct mm_struct *mm,
>> + struct vm_area_struct *vma,
>> + unsigned long start, unsigned long end)
>> +{
>> + if ((void *)start <= mm->context.vdso && mm->context.vdso < (void *)end)
>> + mm->context.vdso = NULL;
>> +}
>> +
>> +static inline void arch_bprm_mm_init(struct mm_struct *mm,
>> + struct vm_area_struct *vma)
>> +{
>> +}
>
> This is virtually identical to the PowerPC implementation, afaict. Any
> chance we could move this to core code and define some generic vdso
> accessors for the mm?
I think the same criticism applies to the VDSO code itself, and I'm not
sure how easy it is to provide common VDSO remap/unmap without common
VDSO code. I guess I'll do some investigating when I have then chance.
Thanks,
Christopher Covington
--
Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-03 18:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25 12:49 [PATCH] arm64: Support VDSO remapping Christopher Covington
2015-12-02 12:19 ` Will Deacon
2015-12-03 18:05 ` Christopher Covington
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox