Re: [PATCH] powerpc/vdso: Separate vvar vma from vdso

2021-03-31 Thread Dmitry Safonov
On 3/31/21 10:59 AM, Michael Ellerman wrote: > Christophe Leroy writes: [..] >> >>> @@ -133,7 +135,13 @@ static int __arch_setup_additional_pages(struct >>> linux_binprm *bprm, int uses_int >>> * install_special_mapping or the perf counter mmap tracking code >>> * will fail to

Re: [PATCH] powerpc/vdso: Separate vvar vma from vdso

2021-03-31 Thread Dmitry Safonov
On 3/30/21 11:17 AM, Christophe Leroy wrote: > > > Le 26/03/2021 à 20:17, Dmitry Safonov a écrit : [..] >> --- a/arch/powerpc/kernel/vdso.c >> +++ b/arch/powerpc/kernel/vdso.c >> @@ -55,10 +55,10 @@ static int vdso_mremap(const struct >> vm_special_

[PATCH] xfrm/compat: Cleanup WARN()s that can be user-triggered

2021-03-29 Thread Dmitry Safonov
xfrm dumps to 64=>32 bit translator") Cc: "David S. Miller" Cc: Eric Dumazet Cc: Herbert Xu Cc: Jakub Kicinski Cc: Steffen Klassert Cc: net...@vger.kernel.org Cc: sta...@vger.kernel.org Signed-off-by: Dmitry Safonov --- net/xfrm/xfrm_compat.c | 12 +--- 1 file changed,

Re: [syzbot] WARNING in xfrm_alloc_compat (2)

2021-03-29 Thread Dmitry Safonov
On 3/29/21 9:31 PM, Eric Dumazet wrote: > > > On 3/29/21 9:57 PM, Dmitry Safonov wrote: [..] >>> [ cut here ] >>> unsupported nla_type 356 >> >> This doesn't seem to be an issue. >> Userspace sent message with nla_type 356,

Re: [PATCH] powerpc/vdso: Separate vvar vma from vdso

2021-03-29 Thread Dmitry Safonov
On 3/29/21 4:14 PM, Laurent Dufour wrote: > Le 26/03/2021 à 20:17, Dmitry Safonov a écrit : >> Since commit 511157ab641e ("powerpc/vdso: Move vdso datapage up front") >> VVAR page is in front of the VDSO area. In result it breaks CRIU >> (Checkpoint Restore In Use

Re: [syzbot] WARNING in xfrm_alloc_compat (2)

2021-03-29 Thread Dmitry Safonov
c?x=17ae6b7cd0 > > The issue was bisected to: > > commit 5f3eea6b7e8f58cf5c8a9d4b9679dc19e9e67ba3 > Author: Dmitry Safonov > Date: Mon Sep 21 14:36:53 2020 + > > xfrm/compat: Attach xfrm dumps to 64=>32 bit translator > > bisection log: https:

Re: [PATCH] powerpc/vdso: Separate vvar vma from vdso

2021-03-27 Thread Dmitry Safonov
; >> Cc: Andrei Vagin >> Cc: Andy Lutomirski >> Cc: Benjamin Herrenschmidt >> Cc: Christophe Leroy >> Cc: Laurent Dufour >> Cc: Michael Ellerman >> Cc: Paul Mackerras >> Cc: linuxppc-...@lists.ozlabs.org >> Cc: sta...@vger.kernel.org # v5.

[PATCH] powerpc/vdso: Separate vvar vma from vdso

2021-03-26 Thread Dmitry Safonov
Cc: Benjamin Herrenschmidt Cc: Christophe Leroy Cc: Laurent Dufour Cc: Michael Ellerman Cc: Paul Mackerras Cc: linuxppc-...@lists.ozlabs.org Cc: sta...@vger.kernel.org # v5.11 [1]: https://github.com/checkpoint-restore/criu/issues/1417 Signed-off-by: Dmitry Safonov Tested-by: Christophe Leroy

Re: [PATCH v2] prctl: PR_SET_MM - unify copying of user's auvx

2021-03-25 Thread Dmitry Safonov
Hi Cyrill, On 3/23/21 10:06 PM, Cyrill Gorcunov wrote: [..] > --- linux-tip.git.orig/kernel/sys.c > +++ linux-tip.git/kernel/sys.c > @@ -1961,6 +1961,30 @@ out: > return error; > } > > +static int copy_auxv_from_user(unsigned long *auxv, size_t auxv_size, > +

Re: [PATCH v5 2/3] Revert "mremap: don't allow MREMAP_DONTUNMAP on special_mappings and aio"

2021-03-23 Thread Dmitry Safonov
s://lkml.org/lkml/2020/12/28/2340 > > Signed-off-by: Brian Geffon > Acked-by: Hugh Dickins Reviewed-by: Dmitry Safonov <0x7f454...@gmail.com> Thanks, Dmitry

Re: [PATCH v5 1/3] mm: Extend MREMAP_DONTUNMAP to non-anonymous mappings

2021-03-23 Thread Dmitry Safonov
79-1-axelrasmus...@google.com/ > > Signed-off-by: Brian Geffon > Acked-by: Hugh Dickins > Tested-by: Lokesh Gidra Reviewed-by: Dmitry Safonov <0x7f454...@gmail.com> Thanks, Dmitry

Re: [PATCH] mm: Allow shmem mappings with MREMAP_DONTUNMAP

2021-03-16 Thread Dmitry Safonov
Hi Brian, Hugh, On 3/16/21 7:18 PM, Brian Geffon wrote: > Hi Hugh, > Thanks for this suggestion, responses in line. > >> A better patch would say: >> >> - if (flags & MREMAP_DONTUNMAP && (!vma_is_anonymous(vma) || >> - vma->vm_flags & VM_SHARED)) >> + if ((flags

[PATCH] perf diff: Don't crash on freeing errno-session

2021-03-01 Thread Dmitry Safonov
is needed, and with temp variable it's possible to make the same mistake. Cc: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Ingo Molnar Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Signed-off-by: Dmitry Safonov --- tools/perf/builtin-diff.c | 3 ++- 1 file changed, 2 i

[PATCH] perf: Use (long) for iterator for bfd symbols

2021-02-09 Thread Dmitry Safonov
r Shishkin Cc: Arnaldo Carvalho de Melo Cc: Ingo Molnar Cc: Jacek Caban Cc: Jiri Olsa Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Remi Bernon Signed-off-by: Dmitry Safonov --- tools/perf/util/symbol.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/p

Re: [PATCH 6/6] mm: Forbid splitting special mappings

2021-01-22 Thread Dmitry Safonov
On 1/22/21 1:00 PM, Will Deacon wrote: > On Fri, Jan 22, 2021 at 12:58:58PM +, Will Deacon wrote: >> On Tue, Oct 13, 2020 at 02:34:16AM +0100, Dmitry Safonov wrote: >>> Don't allow splitting of vm_special_mapping's. >>> It affects vdso/vvar areas. Uprobes have o

Re: [PATCH 3/6] mremap: Don't allow MREMAP_DONTUNMAP on special_mappings and aio

2020-12-28 Thread Dmitry Safonov
[I moved your reply to avoid top-posting] On 12/28/20 6:03 PM, Brian Geffon wrote: > On Mon, Oct 12, 2020 at 6:34 PM Dmitry Safonov wrote: >> >> As kernel expect to see only one of such mappings, any further >> operations on the VMA-copy may be unexpected by the kernel

Re: [PATCH 3/6] mremap: Don't allow MREMAP_DONTUNMAP on special_mappings and aio

2020-12-28 Thread Dmitry Safonov
On 12/28/20 7:33 PM, Dmitry Safonov wrote: > [I moved your reply to avoid top-posting] > > On 12/28/20 6:03 PM, Brian Geffon wrote: >> On Mon, Oct 12, 2020 at 6:34 PM Dmitry Safonov wrote: >>> >>> As kernel expect to see only one of such mappings, any further &

Re: [PATCH 2/6] mm/mremap: For MREMAP_DONTUNMAP check security_vm_enough_memory_mm()

2020-12-28 Thread Dmitry Safonov
On 12/28/20 6:21 PM, Brian Geffon wrote: > This looks good to me with a small comment. > >> if (do_munmap(mm, old_addr, old_len, uf_unmap) < 0) { >> /* OOM: unable to split vma, just get accounts right */ >> - if (vm_flags & VM_ACCOUNT) >> + if

Re: [RESEND PATCH v3 0/4] iommu/iova: Solve longterm IOVA issue

2020-12-02 Thread Dmitry Safonov
On Tue, 1 Dec 2020 at 21:50, Will Deacon wrote: > > On Tue, 17 Nov 2020 18:25:30 +0800, John Garry wrote: > > This series contains a patch to solve the longterm IOVA issue which > > leizhen originally tried to address at [0]. > > > > A sieved kernel log is at the following, showing periodic dumps

Re: [PATCH v2 00/19] Add generic vdso_base tracking

2020-11-26 Thread Dmitry Safonov
Hi Christophe, On 11/24/20 6:53 AM, Christophe Leroy wrote: > > > Le 24/11/2020 à 01:29, Dmitry Safonov a écrit : >> v2 Changes: >> - Rename user_landing to vdso_base as it tracks vDSO VMA start address, >>    rather than the explicit address to land (Andy) >> -

Re: [PATCH v2 13/19] x86/signal: Check if vdso_image_32 is mapped before trying to land on it

2020-11-26 Thread Dmitry Safonov
On 11/24/20 11:43 PM, Andy Lutomirski wrote: > On Mon, Nov 23, 2020 at 4:29 PM Dmitry Safonov wrote: >> >> Provide current_has_vdso_image_32() helper and check it apriory landing >> attempt on vdso vma. >> The helper is a macro, not a static inline funciton to avoid

Re: [PATCH v2 08/19] arm/vdso: Remove vdso pointer from mm->context

2020-11-26 Thread Dmitry Safonov
On 11/24/20 6:22 AM, Christophe Leroy wrote: > > > Le 24/11/2020 à 01:29, Dmitry Safonov a écrit : >> Not used any more. > > But what about mremap() ? Maybe you should explain why you can remove it ? Yep, it was only to keep track of context->vdso position. I'll a

Re: [PATCH v2 05/19] elf: Remove compat_arch_setup_additional_pages()

2020-11-26 Thread Dmitry Safonov
On 11/24/20 6:13 AM, Christophe Leroy wrote: > > > Le 24/11/2020 à 01:29, Dmitry Safonov a écrit : >> Now that all users rely on detecting bitness of new-born task checking >> personality, remove compat_arch_setup_additional_pages() macro, >> simplifying the code. &

Re: [PATCH v2 06/19] elf/vdso: Reuse arch_setup_additional_pages() parameters

2020-11-26 Thread Dmitry Safonov
On 11/24/20 6:18 AM, Christophe Leroy wrote: > "Reuse arch_setup_additional_pages() parameters" > > Did you mean "remove" ? Or "Revise" ? > > Maybe could be: > > "Modify arch_setup_additional_pages() parameters" Sure. Thanks, Dmitry

Re: [PATCH v2 02/19] elf: Move arch_setup_additional_pages() to generic elf.h

2020-11-26 Thread Dmitry Safonov
On 11/24/20 6:12 AM, Christophe Leroy wrote: [..] >> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig >> index 6fd7d38a60c8..4221f171d1a9 100644 >> --- a/arch/powerpc/Kconfig >> +++ b/arch/powerpc/Kconfig >> @@ -134,6 +134,7 @@ config PPC >>   select ARCH_HAS_PTE_SPECIAL >>  

[PATCH v2 02/19] elf: Move arch_setup_additional_pages() to generic elf.h

2020-11-23 Thread Dmitry Safonov
). Signed-off-by: Dmitry Safonov --- arch/arm/Kconfig| 1 + arch/arm/include/asm/elf.h | 5 - arch/arm64/Kconfig | 1 + arch/arm64/include/asm/elf.h| 6 +- arch/csky/Kconfig | 1 + arch/csky/include/asm/elf.h | 4 arch/hexagon

[PATCH v2 08/19] arm/vdso: Remove vdso pointer from mm->context

2020-11-23 Thread Dmitry Safonov
Not used any more. Signed-off-by: Dmitry Safonov --- arch/arm/include/asm/mmu.h | 3 --- arch/arm/kernel/vdso.c | 12 2 files changed, 15 deletions(-) diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h index 1592a4264488..2397b0a19f59 100644 --- a/arch/arm

[PATCH v2 06/19] elf/vdso: Reuse arch_setup_additional_pages() parameters

2020-11-23 Thread Dmitry Safonov
t; Cc: Palmer Dabbelt Cc: Paul Walmsley Cc: linux-fsde...@vger.kernel.org Signed-off-by: Dmitry Safonov --- arch/arm/include/asm/vdso.h| 6 -- arch/arm/kernel/process.c | 4 ++-- arch/arm/kernel/vdso.c | 10 +++--- arch/arm64/kernel/vdso.c | 17 +

[PATCH v2 13/19] x86/signal: Check if vdso_image_32 is mapped before trying to land on it

2020-11-23 Thread Dmitry Safonov
Provide current_has_vdso_image_32() helper and check it apriory landing attempt on vdso vma. The helper is a macro, not a static inline funciton to avoid linux/sched/task_stack.h inclusion in asm/vdso.h. Signed-off-by: Dmitry Safonov --- arch/x86/entry/common.c | 7 ++- arch/x86/ia32

[PATCH v2 15/19] x86/vdso: Migrate to generic vdso_base

2020-11-23 Thread Dmitry Safonov
Generic way to track the landing vma area. As a bonus, after unmapping vdso, kernel won't try to land on its previous position (due to UNMAPPED_VDSO_BASE check instead of context.vdso ?= 0 check). Signed-off-by: Dmitry Safonov --- arch/x86/Kconfig | 1 + arch/x86/entry/common.c

[PATCH v2 19/19] mips/vdso: Migrate to generic vdso_base

2020-11-23 Thread Dmitry Safonov
Generic way to track the landing vma area. As a bonus, after unmapping sigpage, kernel won't try to land on its previous position (due to UNMAPPED_VDSO_BASE check instead of context.vdso ?= 0 check). Cc: Thomas Bogendoerfer Cc: linux-m...@vger.kernel.org Signed-off-by: Dmitry Safonov --- arch

[PATCH v2 18/19] arm64/vdso: Migrate native signals to generic vdso_base

2020-11-23 Thread Dmitry Safonov
Generic way to track the land vma area. As a bonus, after unmapping vdso, kernel won't try to land on its previous position (due to UNMAPPED_VDSO_BASE check instead of context.vdso ?= 0 check). Signed-off-by: Dmitry Safonov --- arch/arm64/kernel/signal.c | 10 +++--- arch/arm64/kernel

[PATCH v2 16/19] arm/vdso: Migrate to generic vdso_base

2020-11-23 Thread Dmitry Safonov
Generic way to track the landing vma area. As a bonus, after unmapping sigpage, kernel won't try to land on its previous position (due to UNMAPPED_VDSO_BASE check instead of context.vdso ?= 0 check). Signed-off-by: Dmitry Safonov --- arch/arm/Kconfig | 1 + arch/arm/kernel/process.c

[PATCH v2 17/19] arm64/vdso: Migrate compat signals to generic vdso_base

2020-11-23 Thread Dmitry Safonov
Generic way to track the landing vma area. As a bonus, after unmapping sigpage, kernel won't try to land on its previous position (due to UNMAPPED_VDSO_BASE check instead of context.vdso ?= 0 check). Signed-off-by: Dmitry Safonov --- arch/arm64/Kconfig | 1 + arch/arm64/kernel

[PATCH v2 12/19] x86/signal: Land on >retcode when vdso isn't mapped

2020-11-23 Thread Dmitry Safonov
ss where vdso was previously mapped. For programs with executable stack it'll just do the same for rt signals as for non-rt. Discouraging users to run with executable stack is done separately in commit 47a2ebb7f505 ("execve: warn if process starts with executable stack"). Signed-off-by: Dmitry Safo

[PATCH v2 14/19] mm: Add vdso_base in mm_struct

2020-11-23 Thread Dmitry Safonov
://lore.kernel.org/linux-arch/cajwjo6zanqykshbq+3b+fi_vt80mtrzev5yreqawx-l8j8x...@mail.gmail.com/ Cc: Thomas Bogendoerfer Cc: linux-m...@vger.kernel.org Signed-off-by: Dmitry Safonov --- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 3 ++- fs/aio.c | 3 ++- include/linux/mm.h

[PATCH v2 10/19] sparc/vdso: Remove vdso pointer from mm->context

2020-11-23 Thread Dmitry Safonov
Not used any more. Cc: "David S. Miller" Cc: sparcli...@vger.kernel.org Signed-off-by: Dmitry Safonov --- arch/sparc/include/asm/mmu_64.h | 1 - arch/sparc/vdso/vma.c | 5 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/sparc/include/asm/mmu_64.h b/

[PATCH v2 11/19] mm/mmap: Make vm_special_mapping::mremap return void

2020-11-23 Thread Dmitry Safonov
the callback. Also, it removes needless `return 0` from callbacks. Signed-off-by: Dmitry Safonov --- arch/arm/kernel/process.c | 3 +-- arch/arm64/kernel/vdso.c | 4 +--- arch/mips/vdso/genvdso.c | 3 +-- arch/x86/entry/vdso/vma.c | 4 +--- include/linux/mm_types.h | 2 +- mm/mmap.c

[PATCH v2 09/19] s390/vdso: Remove vdso_base pointer from mm->context

2020-11-23 Thread Dmitry Safonov
Not used any more. Cc: Christian Borntraeger Cc: Heiko Carstens Cc: Vasily Gorbik Cc: linux-s...@vger.kernel.org Signed-off-by: Dmitry Safonov --- arch/s390/include/asm/mmu.h | 1 - arch/s390/kernel/vdso.c | 10 -- 2 files changed, 11 deletions(-) diff --git a/arch/s390/include

[PATCH v2 04/19] x86: Remove compat_arch_setup_additional_pages()

2020-11-23 Thread Dmitry Safonov
compat_arch_setup_additional_pages() macro re-definition from compat elf code (another redefined marco less). Cc: x...@kernel.org Signed-off-by: Dmitry Safonov --- arch/x86/entry/vdso/vma.c | 41 +++--- arch/x86/include/asm/elf.h | 5 - 2 files changed, 21 insertions(+), 25

[PATCH v2 05/19] elf: Remove compat_arch_setup_additional_pages()

2020-11-23 Thread Dmitry Safonov
Now that all users rely on detecting bitness of new-born task checking personality, remove compat_arch_setup_additional_pages() macro, simplifying the code. Signed-off-by: Dmitry Safonov --- fs/compat_binfmt_elf.c | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/compat_binfmt_elf.c b

[PATCH v2 07/19] elf: Use sysinfo_ehdr in ARCH_DLINFO()

2020-11-23 Thread Dmitry Safonov
Instead mm->context.vdso use the pointer provided by elf loader. That allows to drop the pointer on arm/s390/sparc. Cc: Christian Borntraeger Cc: Heiko Carstens Cc: Vasily Gorbik Cc: linux-s...@vger.kernel.org Cc: "David S. Miller" Cc: sparcli...@vger.kernel.org Signed-off-by: D

[PATCH v2 01/19] x86/elf: Check in_x32_syscall() in compat_arch_setup_additional_pages()

2020-11-23 Thread Dmitry Safonov
map_base to use (see arch_pick_mmap_layout()). Add comments that describe how it works. Cc: x...@kernel.org Signed-off-by: Dmitry Safonov --- arch/x86/entry/vdso/vma.c | 4 ++-- arch/x86/include/asm/compat.h | 6 ++ arch/x86/include/asm/elf.h| 6 ++ fs/binfmt_elf.c

[PATCH v2 00/19] Add generic vdso_base tracking

2020-11-23 Thread Dmitry Safonov
Bergmann Cc: Borislav Petkov Cc: Catalin Marinas Cc: Christophe Leroy Cc: Guo Ren Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Oleg Nesterov Cc: Russell King Cc: Thomas Bogendoerfer Cc: Thomas Gleixner Cc: Vincenzo Frascino Cc: Will Deacon Cc: x...@kernel.org Dmitry Safon

[PATCH v2 03/19] arm64: Use in_compat_task() in arch_setup_additional_pages()

2020-11-23 Thread Dmitry Safonov
for x86, simiplifying the binfmt code in the end. Cc: linux-arm-ker...@lists.infradead.org Signed-off-by: Dmitry Safonov --- arch/arm64/include/asm/elf.h | 5 - arch/arm64/kernel/vdso.c | 21 ++--- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/arch

Re: [PATCH v2] drivers/virt: vmgenid: add vm generation id driver

2020-11-20 Thread Dmitry Safonov
Hello, +Cc Eric, Adrian On 11/19/20 6:36 PM, Alexander Graf wrote: > On 19.11.20 18:38, Mike Rapoport wrote: >> On Thu, Nov 19, 2020 at 01:51:18PM +0100, Alexander Graf wrote: >>> On 19.11.20 13:02, Christian Borntraeger wrote: On 16.11.20 16:34, Catangiu, Adrian Costin wrote: > -

[PATCH] brcmsmac: ampdu: Check BA window size before checking block ack

2020-11-15 Thread Dmitry Safonov
akao Signed-off-by: Dmitry Safonov --- .../net/wireless/broadcom/brcm80211/brcmsmac/ampdu.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/ampdu.c b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/ampdu.c in

Re: [PATCH 00/19] Add generic user_landing tracking

2020-11-08 Thread Dmitry Safonov
On 11/8/20 7:07 PM, Andy Lutomirski wrote: > On Sat, Nov 7, 2020 at 9:17 PM Dmitry Safonov wrote: >> >> Started from discussion [1], where was noted that currently a couple of >> architectures support mremap() for vdso/sigpage, but not munmap(). >> If an application map

Re: [PATCH 14/19] mm: Add user_landing in mm_struct

2020-11-08 Thread Dmitry Safonov
On 11/8/20 7:04 PM, Andy Lutomirski wrote: > On Sat, Nov 7, 2020 at 9:18 PM Dmitry Safonov wrote: >> >> Instead of having every architecture to define vdso_base/vdso_addr etc, >> provide a generic mechanism to track landing in userspace. >> It'll minimize per-architec

Re: [PATCH 12/19] x86/signal: Land on >retcode when vdso isn't mapped

2020-11-08 Thread Dmitry Safonov
On 11/8/20 7:06 PM, Andy Lutomirski wrote: > On Sat, Nov 7, 2020 at 9:17 PM Dmitry Safonov wrote: >> >> Since commit 9fbbd4dd17d0 ("x86: Don't require the vDSO for handling >> a.out signals") after processing 32-bit signal if there is no vdso >> mapped frame

[PATCH 06/19] elf/vdso: Reuse arch_setup_additional_pages() parameters

2020-11-07 Thread Dmitry Safonov
almer Dabbelt Cc: Paul Walmsley Cc: linux-fsde...@vger.kernel.org Signed-off-by: Dmitry Safonov --- arch/arm/include/asm/vdso.h| 6 -- arch/arm/kernel/process.c | 4 ++-- arch/arm/kernel/vdso.c | 10 +++--- arch/arm64/kernel/vdso.c | 17

[PATCH 19/19] mips/vdso: Migrate to user_landing

2020-11-07 Thread Dmitry Safonov
Generic way to track the land vma area. As a bonus, after unmapping sigpage, kernel won't try to land on its previous position. Cc: Thomas Bogendoerfer Cc: linux-m...@vger.kernel.org Signed-off-by: Dmitry Safonov --- arch/mips/Kconfig | 1 + arch/mips/kernel/signal.c | 11

[PATCH 17/19] arm64/vdso: Migrate compat signals to user_landing

2020-11-07 Thread Dmitry Safonov
Generic way to track the land vma area. As a bonus, after unmapping sigpage, kernel won't try to land on its previous position. Signed-off-by: Dmitry Safonov --- arch/arm64/Kconfig | 1 + arch/arm64/kernel/signal32.c | 17 - arch/arm64/kernel/vdso.c | 2 +- 3

[PATCH 14/19] mm: Add user_landing in mm_struct

2020-11-07 Thread Dmitry Safonov
-arch/cajwjo6zanqykshbq+3b+fi_vt80mtrzev5yreqawx-l8j8x...@mail.gmail.com/ Cc: Thomas Bogendoerfer Cc: linux-m...@vger.kernel.org Signed-off-by: Dmitry Safonov --- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 3 ++- fs/aio.c | 3 ++- include/linux/mm.h

[PATCH 11/19] mm/mmap: Make vm_special_mapping::mremap return void

2020-11-07 Thread Dmitry Safonov
the callback. Also, it removes needless `return 0` from callbacks. Signed-off-by: Dmitry Safonov --- arch/arm/kernel/process.c | 3 +-- arch/arm64/kernel/vdso.c | 4 +--- arch/mips/vdso/genvdso.c | 3 +-- arch/x86/entry/vdso/vma.c | 4 +--- include/linux/mm_types.h | 2 +- mm/mmap.c

[PATCH 16/19] arm/vdso: Migrate to user_landing

2020-11-07 Thread Dmitry Safonov
Generic way to track the land vma area. As a bonus, after unmapping sigpage, kernel won't try to land on its previous position. Signed-off-by: Dmitry Safonov --- arch/arm/Kconfig | 1 + arch/arm/kernel/process.c | 9 + arch/arm/kernel/signal.c | 6 +- 3 files changed, 7

[PATCH 07/19] elf: Use sysinfo_ehdr in ARCH_DLINFO()

2020-11-07 Thread Dmitry Safonov
Instead mm->context.vdso use the pointer provided by elf loader. That allows to drop the pointer on arm/s390/sparc. Cc: Christian Borntraeger Cc: Heiko Carstens Cc: Vasily Gorbik Cc: linux-s...@vger.kernel.org Cc: "David S. Miller" Cc: sparcli...@vger.kernel.org Signed-off-by: D

[PATCH 09/19] s390/vdso: Remove vdso_base pointer from mm->context

2020-11-07 Thread Dmitry Safonov
Not used any more. Cc: Christian Borntraeger Cc: Heiko Carstens Cc: Vasily Gorbik Cc: linux-s...@vger.kernel.org Signed-off-by: Dmitry Safonov --- arch/s390/include/asm/mmu.h | 1 - arch/s390/kernel/vdso.c | 10 -- 2 files changed, 11 deletions(-) diff --git a/arch/s390/include

[PATCH 12/19] x86/signal: Land on >retcode when vdso isn't mapped

2020-11-07 Thread Dmitry Safonov
it'll just do the same for rt signals as for non-rt. Discouraging users to run with executable stack is done separately in commit 47a2ebb7f505 ("execve: warn if process starts with executable stack"). Signed-off-by: Dmitry Safonov --- arch/x86/ia32/ia32_signal.c | 12 +++- arch/x86/

[PATCH 15/19] x86/vdso: Migrate to user_landing

2020-11-07 Thread Dmitry Safonov
Generic way to track the land vma area. As a bonus, after unmapping vdso, kernel won't try to land on its previous position. Signed-off-by: Dmitry Safonov --- arch/x86/Kconfig| 1 + arch/x86/entry/common.c | 3 ++- arch/x86/entry/vdso/vma.c | 9 - arch/x86/ia32

[PATCH 10/19] sparc/vdso: Remove vdso pointer from mm->context

2020-11-07 Thread Dmitry Safonov
Not used any more. Cc: "David S. Miller" Cc: sparcli...@vger.kernel.org Signed-off-by: Dmitry Safonov --- arch/sparc/include/asm/mmu_64.h | 1 - arch/sparc/vdso/vma.c | 5 + 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/arch/sparc/include/asm/mmu_64.h b/

[PATCH 08/19] arm/vdso: Remove vdso pointer from mm->context

2020-11-07 Thread Dmitry Safonov
Not used any more. Signed-off-by: Dmitry Safonov --- arch/arm/include/asm/mmu.h | 3 --- arch/arm/kernel/vdso.c | 12 2 files changed, 15 deletions(-) diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h index 1592a4264488..2397b0a19f59 100644 --- a/arch/arm

[PATCH 18/19] arm64/vdso: Migrate native signals to user_landing

2020-11-07 Thread Dmitry Safonov
Generic way to track the land vma area. As a bonus, after unmapping vdso, kernel won't try to land on its previous position. Signed-off-by: Dmitry Safonov --- arch/arm64/kernel/signal.c | 10 +++--- arch/arm64/kernel/vdso.c | 13 +++-- 2 files changed, 10 insertions(+), 13

[PATCH 13/19] x86/signal: Check if vdso_image_32 is mapped before trying to land on it

2020-11-07 Thread Dmitry Safonov
Provide current_has_vdso_image_32() helper and check it apriory landing attempt on vdso vma. The helper is a macro, not a static inline funciton to avoid linux/sched/task_stack.h inclusion in asm/vdso.h. Signed-off-by: Dmitry Safonov --- arch/x86/entry/common.c | 7 ++- arch/x86/ia32

[PATCH 02/19] elf: Move arch_setup_additional_pages() to generic elf.h

2020-11-07 Thread Dmitry Safonov
). Signed-off-by: Dmitry Safonov --- arch/arm/Kconfig| 1 + arch/arm/include/asm/elf.h | 5 - arch/arm64/Kconfig | 1 + arch/arm64/include/asm/elf.h| 6 +- arch/csky/Kconfig | 1 + arch/csky/include/asm/elf.h | 4 arch/hexagon

[PATCH 03/19] arm64: Use in_compat_task() in arch_setup_additional_pages()

2020-11-07 Thread Dmitry Safonov
for x86, simiplifying the binfmt code in the end. Cc: linux-arm-ker...@lists.infradead.org Signed-off-by: Dmitry Safonov --- arch/arm64/include/asm/elf.h | 5 - arch/arm64/kernel/vdso.c | 21 ++--- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/arch

[PATCH 05/19] elf: Remove compat_arch_setup_additional_pages()

2020-11-07 Thread Dmitry Safonov
Now that all users rely on detecting bitness of new-born task checking personality, remove compat_arch_setup_additional_pages() macro, simplifying the code. Signed-off-by: Dmitry Safonov --- fs/compat_binfmt_elf.c | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/compat_binfmt_elf.c b

[PATCH 00/19] Add generic user_landing tracking

2020-11-07 Thread Dmitry Safonov
c: Catalin Marinas Cc: Christophe Leroy Cc: Guo Ren Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Oleg Nesterov Cc: Russell King Cc: Thomas Bogendoerfer Cc: Thomas Gleixner Cc: Vincenzo Frascino Cc: Will Deacon Cc: x...@kernel.org Dmitry Safonov (19): x86/elf:

[PATCH 04/19] x86: Remove compat_arch_setup_additional_pages()

2020-11-07 Thread Dmitry Safonov
compat_arch_setup_additional_pages() macro re-definition from compat elf code (another redefined marco less). Cc: x...@kernel.org Signed-off-by: Dmitry Safonov --- arch/x86/entry/vdso/vma.c | 41 +++--- arch/x86/include/asm/elf.h | 5 - 2 files changed, 21 insertions(+), 25

[PATCH 01/19] x86/elf: Check in_x32_syscall() in compat_arch_setup_additional_pages()

2020-11-07 Thread Dmitry Safonov
map_base to use (see arch_pick_mmap_layout()). Add comments that describe how it works. Cc: x...@kernel.org Signed-off-by: Dmitry Safonov --- arch/x86/entry/vdso/vma.c | 4 ++-- arch/x86/include/asm/compat.h | 6 ++ arch/x86/include/asm/elf.h| 6 ++ fs/binfmt_elf.c | 10 +++--- fs

Re: [PATCH v3 10/10] x86: Reclaim TIF_IA32 and TIF_X32

2020-11-05 Thread Dmitry Safonov
On Sun, 4 Oct 2020 at 04:31, Gabriel Krisman Bertazi wrote: > > Now that these flags are no longer used, reclaim those TI bits. > > Signed-off-by: Gabriel Krisman Bertazi Oh wow! I've just started rebasing patches that do essentially the same on linux-next and found that it's already done and

Re: [PATCH] x86/mpx: fix recursive munmap() corruption

2020-11-03 Thread Dmitry Safonov
Hi Laurent, Christophe, Michael, all, On 11/3/20 5:11 PM, Laurent Dufour wrote: > Le 23/10/2020 à 14:28, Christophe Leroy a écrit : [..] That seems like it would work for CRIU and make sense in general? >>> >>> Sorry for the late answer, yes this would make more sense. >>> >>> Here is a

[PATCH v2 0/3] xfrm/compat: syzbot-found fixes

2020-11-02 Thread Dmitry Safonov
ler" Cc: Jakub Kicinski Cc: Herbert Xu Cc: Hillf Danton Cc: net...@vger.kernel.org Thanks, Dmitry Dmitry Safonov (3): xfrm/compat: Translate by copying XFRMA_UNSPEC attribute xfrm/compat: memset(0) 64-bit padding at right place xfrm/compat: Don't allocate memory with _

[PATCH v2 3/3] xfrm/compat: Don't allocate memory with __GFP_ZERO

2020-11-02 Thread Dmitry Safonov
32-bit to 64-bit messages translator zerofies needed paddings in the translation, the rest is the actual payload. Don't allocate zero pages as they are not needed. Fixes: 5106f4a8acff ("xfrm/compat: Add 32=>64-bit messages translator") Signed-off-by: Dmitry Safonov --- net/xfrm/

[PATCH v2 2/3] xfrm/compat: memset(0) 64-bit padding at right place

2020-11-02 Thread Dmitry Safonov
pspotmail.com Signed-off-by: Dmitry Safonov --- net/xfrm/xfrm_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/xfrm/xfrm_compat.c b/net/xfrm/xfrm_compat.c index 17edbf935e35..556e9f33b815 100644 --- a/net/xfrm/xfrm_compat.c +++ b/net/xfrm/xfrm_compat.c @@ -388,7 +38

[PATCH v2 1/3] xfrm/compat: Translate by copying XFRMA_UNSPEC attribute

2020-11-02 Thread Dmitry Safonov
will be added. Fixes: 5461fc0c8d9f ("xfrm/compat: Add 64=>32-bit messages translator") Reported-by: syzbot+a7e701c8385bd8543...@syzkaller.appspotmail.com Signed-off-by: Dmitry Safonov --- net/xfrm/xfrm_compat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/xfrm/xfrm_compat

Re: [PATCH] xfrm/compat: Remove use of kmalloc_track_caller

2020-11-01 Thread Dmitry Safonov
ko] undefined! > > Other users of this symbol are 'bool' options, but changing this to > bool would require XFRM_USER to be built in as well, which doesn't > seem worth it. Go back to kmalloc(). > > Fixes: 96392ee5a13b9 ("xfrm/compat: Translate 32-bit user_policy from > s

[PATCH 1/3] xfrm/compat: Translate by copying XFRMA_UNSPEC attribute

2020-10-29 Thread Dmitry Safonov
will be added. Reported-by: syzbot+a7e701c8385bd8543...@syzkaller.appspotmail.com Signed-off-by: Dmitry Safonov --- net/xfrm/xfrm_compat.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/xfrm/xfrm_compat.c b/net/xfrm/xfrm_compat.c index e28f0c9ecd6a..17edbf935e35 100644 --- a/net/xfrm/xfrm_compat.c

[PATCH 3/3] xfrm/compat: Don't allocate memory with __GFP_ZERO

2020-10-29 Thread Dmitry Safonov
32-bit to 64-bit messages translator zerofies needed paddings in the translation, the rest is the actual payload. Don't allocate zero pages as they are not needed. Signed-off-by: Dmitry Safonov --- net/xfrm/xfrm_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net

[PATCH 2/3] xfrm/compat: memset(0) 64-bit padding at right place

2020-10-29 Thread Dmitry Safonov
to a typo, *pos already has 64-bit payload size, in a result next memset(0) is called on the memory after the translated attribute, not on the tail-padding of it. Reported-by: syzbot+c43831072e7df506a...@syzkaller.appspotmail.com Signed-off-by: Dmitry Safonov --- net/xfrm/xfrm_compat.c | 2 +- 1

[PATCH 0/3] xfrm/compat: syzbot-found fixes

2020-10-29 Thread Dmitry Safonov
Cc: Hillf Danton Cc: net...@vger.kernel.org Thanks, Dmitry Dmitry Safonov (3): xfrm/compat: Translate by copying XFRMA_UNSPEC attribute xfrm/compat: memset(0) 64-bit padding at right place xfrm/compat: Don't allocate memory with __GFP_ZERO net/xfrm/xfrm_compat.c | 5 +++-- 1 file

Re: [PATCH 2/4] arm64: hide more compat_vdso code

2020-10-29 Thread Dmitry Safonov
ed-off-by: Arnd Bergmann >> >> This looks like a nice cleanup to me! I agree we don't need the array >> here. >> >> Reviewed-by: Mark Rutland > > Thanks! > > I see the patch now conflicts with "mm: forbid splitting special mappings" > in -mm, by D

Re: WARNING in xfrm_alloc_compat

2020-10-28 Thread Dmitry Safonov
On 10/28/20 10:45 AM, Steffen Klassert wrote: > Same here, Dmitry please look into it. Looking on both, thanks! > I guess we can just remove the WARN_ON() that > triggeres here. Thanks, Dmitry

Re: [PATCH v8 2/8] powerpc/vdso: Remove __kernel_datapage_offset and simplify __get_datapage()

2020-10-23 Thread Dmitry Safonov
Hi Christophe, Will, On 10/23/20 12:57 PM, Christophe Leroy wrote: > > > Le 23/10/2020 à 13:25, Will Deacon a écrit : >> On Fri, Oct 23, 2020 at 01:22:04PM +0200, Christophe Leroy wrote: >>> Hi Dmitry, [..] >>> I haven't seen the patches, did you sent them out finally ? I was working on

Re: [PATCH 1/2 v2] futex: adjust a futex timeout with a per-timens offset

2020-10-15 Thread Dmitry Safonov
: Wire up clock_gettime() with timens > offsets") > Reported-by: Hans van der Laan > Signed-off-by: Andrei Vagin Reviewed-by: Dmitry Safonov <0x7f454...@gmail.com> > --- > > v2: > * check FUTEX_CLOCK_REALTIME properly > * fix futex_time32 too > > kerne

Re: [PATCH 1/2] futex: adjust a futex timeout with a per-timens offset

2020-10-15 Thread Dmitry Safonov
On 10/15/20 8:29 AM, Andrei Vagin wrote: > For all commands except FUTEX_WAIT, timeout is interpreted as an > absolute value. This absolute value is inside the task's time namespace > and has to be converted to the host's time. > > Cc: > Fixes: 5a590f35add9 ("posix-clocks: Wire up

[PATCH 5/6] mremap: Check if it's possible to split original vma

2020-10-12 Thread Dmitry Safonov
by checking .may_split() before attempting to create a VMA copy. Signed-off-by: Dmitry Safonov --- mm/mremap.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mm/mremap.c b/mm/mremap.c index 898e9818ba6d..3c4047c23673 100644 --- a/mm/mremap.c +++ b/mm/mremap.c

[PATCH 0/6] mremap: move_vma() fixes

2020-10-12 Thread Dmitry Safonov
Cc: Thomas Bogendoerfer Cc: Thomas Gleixner Cc: Vishal Verma Cc: Vlastimil Babka Cc: Will Deacon Cc: linux-...@kvack.org Cc: linux-fsde...@vger.kernel.org Cc: linux...@kvack.org Dmitry Safonov (6): mm/mremap: Account memory on do_munmap() failure mm/mremap: For MREMAP_DONTUNMAP check

[PATCH 1/6] mm/mremap: Account memory on do_munmap() failure

2020-10-12 Thread Dmitry Safonov
e2ea83742133 ("[PATCH] mremap: move_vma fixes and cleanup") Signed-off-by: Dmitry Safonov --- mm/mremap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/mremap.c b/mm/mremap.c index 138abbae4f75..03d31a0d4c67 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -450,7 +450,8

[PATCH 6/6] mm: Forbid splitting special mappings

2020-10-12 Thread Dmitry Safonov
Don't allow splitting of vm_special_mapping's. It affects vdso/vvar areas. Uprobes have only one page in xol_area so they aren't affected. Those restrictions were enforced by checks in .mremap() callbacks. Restrict resizing with generic .split() callback. Signed-off-by: Dmitry Safonov --- arch

[PATCH 4/6] vm_ops: Rename .split() callback to .may_split()

2020-10-12 Thread Dmitry Safonov
Rename the callback to reflect that it's not called *on* or *after* split, but rather some time before the splitting to check if it's possible. Signed-off-by: Dmitry Safonov --- drivers/dax/device.c | 4 ++-- include/linux/mm.h | 3 ++- ipc/shm.c| 8 mm/hugetlb.c

[PATCH 2/6] mm/mremap: For MREMAP_DONTUNMAP check security_vm_enough_memory_mm()

2020-10-12 Thread Dmitry Safonov
the error-path a little. Also, as it's memory allocation on success don't reset hiwater_vm value. Fixes: commit e346b3813067 ("mm/mremap: add MREMAP_DONTUNMAP to mremap()") Signed-off-by: Dmitry Safonov --- mm/mremap.c | 36 +--- 1 file changed, 13 inserti

[PATCH 3/6] mremap: Don't allow MREMAP_DONTUNMAP on special_mappings and aio

2020-10-12 Thread Dmitry Safonov
: add MREMAP_DONTUNMAP to mremap()") Signed-off-by: Dmitry Safonov --- arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 2 +- fs/aio.c | 5 - include/linux/mm.h| 2 +- mm/mmap.c | 6 +- m

Re: [PATCH v8 2/8] powerpc/vdso: Remove __kernel_datapage_offset and simplify __get_datapage()

2020-09-28 Thread Dmitry Safonov
On 9/27/20 8:43 AM, Christophe Leroy wrote: > > > Le 21/09/2020 à 13:26, Will Deacon a écrit : >> On Fri, Aug 28, 2020 at 12:14:28PM +1000, Michael Ellerman wrote: >>> Dmitry Safonov <0x7f454...@gmail.com> writes: [..] >>>> I'll cook a patc

[PATCH v3 6/7] xfrm/compat: Translate 32-bit user_policy from sockptr

2020-09-21 Thread Dmitry Safonov
Provide compat_xfrm_userpolicy_info translation for xfrm setsocketopt(). Reallocate buffer and put the missing padding for 64-bit message. Signed-off-by: Dmitry Safonov --- include/net/xfrm.h | 3 +++ net/xfrm/xfrm_compat.c | 26 ++ net/xfrm/xfrm_state.c | 17

[PATCH v3 1/7] xfrm: Provide API to register translator module

2020-09-21 Thread Dmitry Safonov
() as the module will vmalloc() memory for translation. The new API is registered with xfrm_state module, not with xfrm_user as the former needs translator for user_policy set by setsockopt() and xfrm_user already uses functions from xfrm_state. Signed-off-by: Dmitry Safonov --- include/net/xfrm.h

[PATCH v3 3/7] xfrm/compat: Attach xfrm dumps to 64=>32 bit translator

2020-09-21 Thread Dmitry Safonov
for XFRM_MSG_GETSA, XFRM_MSG_GETPOLICY. Just as for xfrm multicast, allocate frag_list for compat skb journey down to recvmsg() which will give user the desired skb according to syscall bitness. Signed-off-by: Dmitry Safonov --- net/xfrm/xfrm_user.c | 38 ++ 1 file

[PATCH v3 0/7] xfrm: Add compat layer

2020-09-21 Thread Dmitry Safonov
ary and compat version can be easy build with: make CFLAGS=-m32 net/ipsec [1]: https://lkml.kernel.org/r/20180726023144.31066-1-d...@arista.com Cc: "David S. Miller" Cc: Florian Westphal Cc: Herbert Xu Cc: Jakub Kicinski Cc: Johannes Berg Cc: Steffen Klassert Cc: Stephen Suryaputra Cc:

[PATCH v3 5/7] xfrm/compat: Add 32=>64-bit messages translator

2020-09-21 Thread Dmitry Safonov
Provide the user-to-kernel translator under XFRM_USER_COMPAT, that creates for 32-bit xfrm-user message a 64-bit translation. The translation is afterwards reused by xfrm_user code just as if userspace had sent 64-bit message. Signed-off-by: Dmitry Safonov --- include/net/xfrm.h | 6

[PATCH v3 4/7] netlink/compat: Append NLMSG_DONE/extack to frag_list

2020-09-21 Thread Dmitry Safonov
will retrieve all netlink dump data, but will then get an unexpected EOF. Cc: Johannes Berg Signed-off-by: Florian Westphal Signed-off-by: Dmitry Safonov Reviewed-by: Johannes Berg --- net/netlink/af_netlink.c | 47 1 file changed, 33 insertions(+), 14 deletions

  1   2   3   4   5   6   7   8   9   10   >