[PATCHv9 0/2] mremap vDSO for 32-bit

2016-05-17 Thread Dmitry Safonov
age_32 v3: As Andy suggested, return EINVAL in case of splitting vdso blob on mremap; used is_ia32_task instead of ifdefs v2: Added __maybe_unused for pt_regs in vdso_mremap Dmitry Safonov (2): x86/vdso: add mremap hook to vm_special_mapping selftest/x86: add mremap vdso test arch/

Re: [PATCHv8 resend 2/2] selftest/x86: add mremap vdso test

2016-05-17 Thread Dmitry Safonov
On 05/16/2016 09:25 PM, Andy Lutomirski wrote: On Mon, May 16, 2016 at 9:24 AM, Dmitry Safonov wrote: On 05/16/2016 04:54 PM, Ingo Molnar wrote: * Dmitry Safonov wrote: Should print on success: [root@localhost ~]# ./test_mremap_vdso_32 AT_SYSINFO_EHDR is 0xf773f000 [NOTE] Moving

Re: [PATCHv8 resend 2/2] selftest/x86: add mremap vdso test

2016-05-16 Thread Dmitry Safonov
On 05/16/2016 04:54 PM, Ingo Molnar wrote: * Dmitry Safonov wrote: Should print on success: [root@localhost ~]# ./test_mremap_vdso_32 AT_SYSINFO_EHDR is 0xf773f000 [NOTE] Moving vDSO: [f773f000, f774] -> [a00, a001000] [OK] Or segfault if landing was bad (before patc

Re: [PATCHv8 resend 1/2] x86/vdso: add mremap hook to vm_special_mapping

2016-05-16 Thread Dmitry Safonov
On 05/16/2016 04:55 PM, Ingo Molnar wrote: Ok, this looks useful - please add this information to the changelog (with typos fixed). Thanks will add to v9.

Re: [PATCHv8 resend 1/2] x86/vdso: add mremap hook to vm_special_mapping

2016-05-16 Thread Dmitry Safonov
On 05/16/2016 01:54 PM, Ingo Molnar wrote: * Dmitry Safonov wrote: On 05/10/2016 04:29 PM, Dmitry Safonov wrote: Add possibility for userspace 32-bit applications to move vdso mapping. Previously, when userspace app called mremap for vdso, in return path it would land on previous address of

Re: [PATCHv8 resend 1/2] x86/vdso: add mremap hook to vm_special_mapping

2016-05-16 Thread Dmitry Safonov
On 05/10/2016 04:29 PM, Dmitry Safonov wrote: Add possibility for userspace 32-bit applications to move vdso mapping. Previously, when userspace app called mremap for vdso, in return path it would land on previous address of vdso page, resulting in segmentation violation. Now it lands fine and

[PATCHv8 resend 2/2] selftest/x86: add mremap vdso test

2016-05-10 Thread Dmitry Safonov
is 0xf774f000 [NOTE] Moving vDSO: [f774f000, f775] -> [a00, a001000] Segmentation fault (core dumped) Cc: Shuah Khan Cc: linux-kselft...@vger.kernel.org Suggested-by: Andy Lutomirski Signed-off-by: Dmitry Safonov Acked-by: Andy Lutomirski --- v8: run test for x86_64 too; removed

[PATCHv8 resend 1/2] x86/vdso: add mremap hook to vm_special_mapping

2016-05-10 Thread Dmitry Safonov
. #0 0xf7fd9b80 in __kernel_vsyscall () #1 0xf7ec8238 in _exit () from /usr/lib32/libc.so.6 Signed-off-by: Dmitry Safonov Acked-by: Andy Lutomirski --- v8: add WARN_ON_ONCE on current->mm != new_vma->vm_mm v7: build fix v6: moved vdso_image_32 check and fixup code into vdso_fix_l

Re: [PATCHv8 1/2] x86/vdso: add mremap hook to vm_special_mapping

2016-05-05 Thread Dmitry Safonov
On 05/05/2016 02:52 PM, Ingo Molnar wrote: * Dmitry Safonov wrote: On 04/26/2016 12:38 AM, Andy Lutomirski wrote: On Mon, Apr 25, 2016 at 4:37 AM, Dmitry Safonov wrote: Add possibility for userspace 32-bit applications to move vdso mapping. Previously, when userspace app called mremap for

Re: VDSO unmap and remap support for additional architectures

2016-04-29 Thread Dmitry Safonov
logical: if one can switch between modes, why can't he change vdso mapping to mode he got to? (note: if the work about removing thread compatible flags will be done (on x86), there will not even be such a thing, as application mode - just difference on which syscalls it uses: compatible or native). Thanks, Dmitry Safonov

Re: [RFC 3/3] x86/ptrace: down with test_thread_flag(TIF_IA32)

2016-04-25 Thread Dmitry Safonov
2016-04-25 22:33 GMT+03:00 Andy Lutomirski : > On Mon, Apr 25, 2016 at 11:09 AM, Dmitry Safonov > wrote: >> On 04/25/2016 08:14 PM, Dmitry Safonov wrote: >>> >>> On 04/25/2016 07:53 PM, Andy Lutomirski wrote: >>>> >>>> On Mon, Apr 25, 2016

Re: [RFC 1/3] x86/signal: add SA_{X32,IA32}_ABI sa_flags

2016-04-25 Thread Dmitry Safonov
2016-04-25 22:20 GMT+03:00 Andy Lutomirski : > On Mon, Apr 25, 2016 at 9:12 AM, Dmitry Safonov > wrote: >> Introduce new flags that defines which ABI to use on creating sigframe. >> Those flags one may set from the userspace, or kernel will set them >> according to sys

Re: [RFC 3/3] x86/ptrace: down with test_thread_flag(TIF_IA32)

2016-04-25 Thread Dmitry Safonov
On 04/25/2016 09:09 PM, Dmitry Safonov wrote: On 04/25/2016 08:14 PM, Dmitry Safonov wrote: On 04/25/2016 07:53 PM, Andy Lutomirski wrote: On Mon, Apr 25, 2016 at 9:12 AM, Dmitry Safonov wrote: As the task isn't executing at the moment of {GET,SET}REGS, return regset that corresponds to

Re: [RFC 3/3] x86/ptrace: down with test_thread_flag(TIF_IA32)

2016-04-25 Thread Dmitry Safonov
On 04/25/2016 08:14 PM, Dmitry Safonov wrote: On 04/25/2016 07:53 PM, Andy Lutomirski wrote: On Mon, Apr 25, 2016 at 9:12 AM, Dmitry Safonov wrote: As the task isn't executing at the moment of {GET,SET}REGS, return regset that corresponds to code selector. So, for i386 elf binary that ch

Re: [RFC 3/3] x86/ptrace: down with test_thread_flag(TIF_IA32)

2016-04-25 Thread Dmitry Safonov
On 04/25/2016 07:53 PM, Andy Lutomirski wrote: On Mon, Apr 25, 2016 at 9:12 AM, Dmitry Safonov wrote: As the task isn't executing at the moment of {GET,SET}REGS, return regset that corresponds to code selector. So, for i386 elf binary that changed it's CS to __USER_CS it will r

[RFC 1/3] x86/signal: add SA_{X32,IA32}_ABI sa_flags

2016-04-25 Thread Dmitry Safonov
only under CONFIG_COMPAT. The same way ARM uses sa_flags to differ in which mode deliver signal for 26-bit applications (look at SA_THIRYTWO). Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Thomas Gleixner Cc: "H. Peter Anvin" Cc: x...@kernel.org Signed-off-by: Dmitry Safonov --- arc

[RFC 2/3] x86/coredump: use core regs, rather that TIF_IA32 flag

2016-04-25 Thread Dmitry Safonov
As we have here core registers, use them to determine application's mode and sizes of register set and elf_prstatus. Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Thomas Gleixner Cc: "H. Peter Anvin" Cc: Alexander Viro Cc: x...@kernel.org Cc: linux-fsde...@vger.kernel.org Signed

[RFC 3/3] x86/ptrace: down with test_thread_flag(TIF_IA32)

2016-04-25 Thread Dmitry Safonov
F_{IA32,X32} flags. Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Thomas Gleixner Cc: "H. Peter Anvin" Cc: Oleg Nesterov Cc: x...@kernel.org Signed-off-by: Dmitry Safonov --- arch/x86/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/ptr

[PATCHv8 1/2] x86/vdso: add mremap hook to vm_special_mapping

2016-04-25 Thread Dmitry Safonov
. #0 0xf7fd9b80 in __kernel_vsyscall () #1 0xf7ec8238 in _exit () from /usr/lib32/libc.so.6 Signed-off-by: Dmitry Safonov --- v8: add WARN_ON_ONCE on current->mm != new_vma->vm_mm v7: build fix v6: moved vdso_image_32 check and fixup code into vdso_fix_landing function with ifdefs

[PATCHv8 2/2] selftest/x86: add mremap vdso test

2016-04-25 Thread Dmitry Safonov
is 0xf774f000 [NOTE] Moving vDSO: [f774f000, f775] -> [a00, a001000] Segmentation fault (core dumped) Cc: Shuah Khan Cc: linux-kselft...@vger.kernel.org Suggested-by: Andy Lutomirski Signed-off-by: Dmitry Safonov --- v8: run test for x86_64 too; removed fixed VDSO_SIZE - check EINVAL

Re: [PATCHv7 2/3] x86/vdso: add mremap hook to vm_special_mapping

2016-04-22 Thread Dmitry Safonov
On 04/21/2016 10:52 PM, Andy Lutomirski wrote: On Mon, Apr 18, 2016 at 7:23 AM, Dmitry Safonov wrote: Add possibility for userspace 32-bit applications to move vdso mapping. Previously, when userspace app called mremap for vdso, in return path it would land on previous address of vdso page

Re: [PATCHv5 3/3] selftest/x86: add mremap vdso 32-bit test

2016-04-22 Thread Dmitry Safonov
On 04/21/2016 11:01 PM, Andy Lutomirski wrote: On Mon, Apr 18, 2016 at 6:43 AM, Dmitry Safonov wrote: Should print on success: [root@localhost ~]# ./test_mremap_vdso_32 AT_SYSINFO_EHDR is 0xf773f000 [NOTE] Moving vDSO: [f773f000, f774] -> [a00, a001000] [OK] Or segfault

Re: [PATCHv7 2/3] x86/vdso: add mremap hook to vm_special_mapping

2016-04-20 Thread Dmitry Safonov
On 04/18/2016 05:23 PM, Dmitry Safonov wrote: Add possibility for userspace 32-bit applications to move vdso mapping. Previously, when userspace app called mremap for vdso, in return path it would land on previous address of vdso page, resulting in segmentation violation. Now it lands fine and

Re: [PATCH 3/4] x86/intel lbr: down with test_thread_flag(TIF_IA32)

2016-04-20 Thread Dmitry Safonov
On 04/20/2016 02:21 PM, Peter Zijlstra wrote: On Thu, Apr 14, 2016 at 12:29:12PM -0700, Andy Lutomirski wrote: On Thu, Apr 14, 2016 at 11:10 AM, Dmitry Safonov wrote: @@ -724,7 +727,7 @@ static int branch_type(unsigned long from, unsigned long to, int abort) * on 64-bit systems

[tip:x86/asm] x86/entry: Rename is_{ia32,x32}_task() to in_{ia32,x32}_syscall()

2016-04-19 Thread tip-bot for Dmitry Safonov
Commit-ID: abfb9498ee1327f534df92a7ecaea81a85913bae Gitweb: http://git.kernel.org/tip/abfb9498ee1327f534df92a7ecaea81a85913bae Author: Dmitry Safonov AuthorDate: Mon, 18 Apr 2016 16:43:43 +0300 Committer: Ingo Molnar CommitDate: Tue, 19 Apr 2016 10:44:52 +0200 x86/entry: Rename is_

[PATCHv7 2/3] x86/vdso: add mremap hook to vm_special_mapping

2016-04-18 Thread Dmitry Safonov
. #0 0xf7fd9b80 in __kernel_vsyscall () #1 0xf7ec8238 in _exit () from /usr/lib32/libc.so.6 Signed-off-by: Dmitry Safonov --- v7: that's just not my day: add new_vma parameter to vdso_fix_landing sorry for the noise v6: moved vdso_image_32 check and fixup code into vdso_fix_la

[PATCHv6 2/3] x86/vdso: add mremap hook to vm_special_mapping

2016-04-18 Thread Dmitry Safonov
. #0 0xf7fd9b80 in __kernel_vsyscall () #1 0xf7ec8238 in _exit () from /usr/lib32/libc.so.6 Signed-off-by: Dmitry Safonov --- v6: moved vdso_image_32 check and fixup code into vdso_fix_landing function with ifdefs around v5: as Andy suggested, add a check that new_vma->vm_mm and curr

[PATCHv5 3/3] selftest/x86: add mremap vdso 32-bit test

2016-04-18 Thread Dmitry Safonov
is 0xf774f000 [NOTE] Moving vDSO: [f774f000, f775] -> [a00, a001000] Segmentation fault (core dumped) Cc: Shuah Khan Cc: linux-kselft...@vger.kernel.org Suggested-by: Andy Lutomirski Signed-off-by: Dmitry Safonov --- v5: initial version tools/testing/selftests/x86/Makefile

[PATCHv5 1/3] x86: rename is_{ia32,x32}_task to in_{ia32,x32}_syscall

2016-04-18 Thread Dmitry Safonov
Impact: clearify meaning Suggested-by: Andy Lutomirski Suggested-by: Ingo Molnar Signed-off-by: Dmitry Safonov Acked-by: Andy Lutomirski --- v3: initial patch arch/x86/entry/common.c| 2 +- arch/x86/include/asm/compat.h | 4 ++-- arch/x86/include/asm/thread_info.h | 2

[PATCHv5 2/3] x86/vdso: add mremap hook to vm_special_mapping

2016-04-18 Thread Dmitry Safonov
. #0 0xf7fd9b80 in __kernel_vsyscall () #1 0xf7ec8238 in _exit () from /usr/lib32/libc.so.6 Signed-off-by: Dmitry Safonov --- v5: as Andy suggested, add a check that new_vma->vm_mm and current->mm are the same, also check not only in_ia32_syscall() but image == &vdso_image_3

Re: [PATCHv4 1/2] x86/vdso: add mremap hook to vm_special_mapping

2016-04-18 Thread Dmitry Safonov
d add jump trampolines on places where were entries in previous vDSO to a new one. So, this is also true for 32-bit vDSO blob. That's why I need this API for CRIU. -- Regards, Dmitry Safonov

Re: [PATCHv3 2/2] x86: rename is_{ia32,x32}_task to in_{ia32,x32}_syscall

2016-04-15 Thread Dmitry Safonov
On 04/15/2016 07:52 PM, Andy Lutomirski wrote: Acked-by: Andy Lutomirski But if you resubmit, please consider making this patch 1 so Ingo can apply it directly. I resubmitted it already :-[ https://lkml.org/lkml/2016/4/15/431 If there will be v5 version, I'll submit this first. Thanks!

[PATCHv4 1/2] x86/vdso: add mremap hook to vm_special_mapping

2016-04-15 Thread Dmitry Safonov
. #0 0xf7fd9b80 in __kernel_vsyscall () #1 0xf7ec8238 in _exit () from /usr/lib32/libc.so.6 Signed-off-by: Dmitry Safonov --- v4: drop __maybe_unused & use image from mm->context instead vdso_image_32 v3: as Andy suggested, return EINVAL in case of splitting vdso blob on mremap;

[PATCHv4 2/2] x86: rename is_{ia32,x32}_task to in_{ia32,x32}_syscall

2016-04-15 Thread Dmitry Safonov
Impact: clearify meaning Suggested-by: Andy Lutomirski Suggested-by: Ingo Molnar Signed-off-by: Dmitry Safonov --- v3: initial patch arch/x86/entry/common.c| 2 +- arch/x86/entry/vdso/vma.c | 2 +- arch/x86/include/asm/compat.h | 4 ++-- arch/x86/include/asm

[PATCHv3 2/2] x86: rename is_{ia32,x32}_task to in_{ia32,x32}_syscall

2016-04-15 Thread Dmitry Safonov
Impact: clearify meaning Suggested-by: Andy Lutomirski Suggested-by: Ingo Molnar Signed-off-by: Dmitry Safonov --- v3: initial patch arch/x86/entry/common.c| 2 +- arch/x86/entry/vdso/vma.c | 2 +- arch/x86/include/asm/compat.h | 4 ++-- arch/x86/include/asm

[PATCHv3 1/2] x86/vdso: add mremap hook to vm_special_mapping

2016-04-15 Thread Dmitry Safonov
. #0 0xf7fd9b80 in __kernel_vsyscall () #1 0xf7ec8238 in _exit () from /usr/lib32/libc.so.6 Signed-off-by: Dmitry Safonov --- v3: as Andy suggested, return EINVAL in case of splitting vdso blob on mremap; used is_ia32_task instead of ifdefs v2: added __maybe_unused for pt_regs in

Re: [PATCHv2] x86/vdso: add mremap hook to vm_special_mapping

2016-04-15 Thread Dmitry Safonov
On 04/15/2016 12:51 PM, Dmitry Safonov wrote: On 04/15/2016 12:18 PM, Ingo Molnar wrote: * Andy Lutomirski wrote: Instead of ifdef, use the (grossly misnamed) is_ia32_task() helper for this, please. Please also let's do the rename. Does `is_32bit_syscall` sounds right, or shall

Re: [PATCHv2] x86/vdso: add mremap hook to vm_special_mapping

2016-04-15 Thread Dmitry Safonov
ll be bad-named for X86_32 host. -- Regards, Dmitry Safonov

Re: [PATCHv2] x86/vdso: add mremap hook to vm_special_mapping

2016-04-15 Thread Dmitry Safonov
On 04/15/2016 01:58 AM, Andy Lutomirski wrote: On Thu, Apr 14, 2016 at 9:32 AM, Dmitry Safonov wrote: Add possibility for userspace 32-bit applications to move vdso mapping. Previously, when userspace app called mremap for vdso, in return path it would land on previous address of vdso page

[PATCH 3/4] x86/intel lbr: down with test_thread_flag(TIF_IA32)

2016-04-14 Thread Dmitry Safonov
Use user_mode64_bit to check process state. For that pass interrupt register set from irq handler. This should fix opcode decoder misinterpreting ABI for tasks that change their code selector. Signed-off-by: Dmitry Safonov --- arch/x86/events/intel/core.c | 2 +- arch/x86/events/intel/lbr.c

[PATCH 0/4] drop test_thread_flag checks

2016-04-14 Thread Dmitry Safonov
e TIF_IA32 flag. I still quite don't know what to do with uprobes using ia32_compat check and will make the next patches about ptrace & signals usage of TIF_IA32. Dmitry Safonov (4): x86/events: down with test_thread_flag(TIF_IA32) x86/intel: down with test_thread_flag(TIF_IA32)

[PATCH 4/4] x86/oprofile: down with test_thread_flag(TIF_IA32)

2016-04-14 Thread Dmitry Safonov
As we have here full register set - just use user_64bit_mode on it. Signed-off-by: Dmitry Safonov --- arch/x86/oprofile/backtrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/oprofile/backtrace.c b/arch/x86/oprofile/backtrace.c index cb31a4440e58..405dadaee74a

[PATCH 2/4] x86/intel: down with test_thread_flag(TIF_IA32)

2016-04-14 Thread Dmitry Safonov
y fixup IP. Changing to user_64bit_mode to check for interrupt register set is better, however it may race with task, that changes it's code selector frequiently. Signed-off-by: Dmitry Safonov --- arch/x86/events/intel/ds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/

[PATCH 1/4] x86/events: down with test_thread_flag(TIF_IA32)

2016-04-14 Thread Dmitry Safonov
We can use user_64bit_mode(regs) here instead of thread flag because we have full register frame. Signed-off-by: Dmitry Safonov --- arch/x86/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c index 041e442a3e28

[PATCHv2] x86/vdso: add mremap hook to vm_special_mapping

2016-04-14 Thread Dmitry Safonov
_exit () from /usr/lib32/libc.so.6 Signed-off-by: Dmitry Safonov --- v2: added __maybe_unused for pt_regs in vdso_mremap arch/x86/entry/vdso/vma.c | 33 - include/linux/mm_types.h | 3 +++ mm/mmap.c | 10 ++ 3 files changed, 41 insertions

Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode

2016-04-13 Thread Dmitry Safonov
On 04/08/2016 11:44 PM, Andy Lutomirski wrote: Feel free to ask for help on some of these details. user_64bit_mode will be helpful too. Hello again, here are some questions on TIF_IA32 removal: - in function intel_pmu_pebs_fixup_ip: there is need to know if process was it native/compat mode f

[PATCH] x86/vdso: add mremap hook to vm_special_mapping

2016-04-11 Thread Dmitry Safonov
the next syscall through glibc may fail: Program received signal SIGSEGV, Segmentation fault. #0 0xf7fd9b80 in __kernel_vsyscall () #1 0xf7ec8238 in _exit () from /usr/lib32/libc.so.6 Signed-off-by: Dmitry Safonov --- arch/x86/entry/vdso/vma.c | 33

Re: [PATCH] x86/vdso: add mremap hook to vm_special_mapping

2016-04-11 Thread Dmitry Safonov
: https://github.com/0day-ci/linux/commits/Dmitry-Safonov/x86-vdso-add-mremap-hook-to-vm_special_mapping/20160411-232653 config: x86_64-randconfig-x000-201615 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones

Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode

2016-04-09 Thread Dmitry Safonov
2016-04-08 23:44 GMT+03:00 Andy Lutomirski : > On Apr 8, 2016 9:20 AM, "Dmitry Safonov" wrote: >> >> >> And if it's not there - return error? > > No, just leave IP unchanged. Ok, will resend with this fixup. > > Feel free to ask for help on s

Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode

2016-04-08 Thread Dmitry Safonov
On 04/08/2016 06:56 PM, Andy Lutomirski wrote: On Fri, Apr 8, 2016 at 6:50 AM, Dmitry Safonov wrote: Hello again, what do you think about attached patch? I think it should fix landing problem for i386 vdso mremap. It does not touch fast syscall path, so there should be no speed regression

Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode

2016-04-08 Thread Dmitry Safonov
7194a07d80ece9be19107e4e6 Mon Sep 17 00:00:00 2001 From: Dmitry Safonov Date: Fri, 8 Apr 2016 16:27:18 +0300 Subject: [PATCH] x86/vdso: add mremap hook to vm_special_mapping This patch adds possibility for userspace 32-bit applications to move vdso mapping. Previously, when userspace app call

Re: [PATCH v3 2/7] x86/arch_prctl: Fix ARCH_GET_FS and ARCH_GET_GS

2016-04-08 Thread Dmitry Safonov
2016-04-08 10:13 GMT+03:00 Ingo Molnar : > > * Andy Lutomirski wrote: > >> ARCH_GET_FS and ARCH_GET_GS attempted to figure out the fsbase and >> gsbase respectively from saved thread state. This was wrong: fsbase >> and gsbase live in registers while a thread is running, not in >> memory. > > So

Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode

2016-04-07 Thread Dmitry Safonov
On 04/07/2016 05:39 PM, Andy Lutomirski wrote: On Apr 7, 2016 5:12 AM, "Dmitry Safonov" wrote: On 04/06/2016 09:04 PM, Andy Lutomirski wrote: [cc Dave Hansen for MPX] On Apr 6, 2016 9:30 AM, "Dmitry Safonov" wrote: Now each process that runs natively on x86_64 may ex

Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode

2016-04-07 Thread Dmitry Safonov
On 04/07/2016 03:21 PM, Cyrill Gorcunov wrote: On Thu, Apr 07, 2016 at 03:11:24PM +0300, Dmitry Safonov wrote: On 04/06/2016 09:04 PM, Andy Lutomirski wrote: [cc Dave Hansen for MPX] Will add x32 support for v2. I think that you should separate vdso remapping from "personality&q

Re: [PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode

2016-04-07 Thread Dmitry Safonov
On 04/06/2016 09:04 PM, Andy Lutomirski wrote: [cc Dave Hansen for MPX] On Apr 6, 2016 9:30 AM, "Dmitry Safonov" wrote: Now each process that runs natively on x86_64 may execute 32-bit code by proper setting it's CS selector: either from LDT or reuse Linux's USER32_CS. Th

[PATCH 0/2] x86: add arch_prctl to switch between native/compat modes

2016-04-06 Thread Dmitry Safonov
this possibility). I add a selftest and I did CRIU branch that uses this to C/R 32-bit processes: https://github.com/0x7f454c46/criu/tree/compat-2 There are dozens of patches there and I will prepare them for CRIU master branch after mainstreaming this switching patch. Dmitry Safonov (2):

[PATCH 2/2] x86/tools/testing: add test for ARCH_SET_COMPAT

2016-04-06 Thread Dmitry Safonov
This is simple test to determine if arch_prctl(ARCH_SET_COMPAT) is working by ptracing switched application with PTRACE_GETREGS - it should return 32-bit registers set. Cc: Cyrill Gorcunov Cc: Pavel Emelyanov Cc: Konstantin Khorenko CC: Dmitry Safonov <0x7f454...@gmail.com> Signed-

[PATCH 1/2] x86/arch_prctl: add ARCH_SET_{COMPAT,NATIVE} to change compatible mode

2016-04-06 Thread Dmitry Safonov
-> compat mode by arch_prctl, it will remap needed vdso binary blob for target mode. Cc: Cyrill Gorcunov Cc: Pavel Emelyanov Cc: Konstantin Khorenko CC: Dmitry Safonov <0x7f454...@gmail.com> Signed-off-by: Dmitry Safonov --- arch/x86/entry/vdso/vma.c | 76 ++

[PATCHv9] mm: slab: free kmem_cache_node after destroy sysfs file

2016-02-08 Thread Dmitry Safonov
Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Suggested-by: Vladimir Davydov Signed-off-by: Dmitry Safonov Acked-by: Vladimir Davydov --- v2: Down with SLAB_SUPPORTS_SYSFS thing. v3: Moved sysfs_slab_remove inside shutdown_cache

Re: [PATCHv8] mm: slab: free kmem_cache_node after destroy sysfs file

2016-02-08 Thread Dmitry Safonov
On 02/08/2016 12:58 PM, Vladimir Davydov wrote: On Mon, Feb 08, 2016 at 12:31:47PM +0300, Dmitry Safonov wrote: With enabled slub_debug alloc_calls_show will try to track location and user of slab object on each online node, kmem_cache_node structure and cpu_cache/cpu_slub shouldn't be

[PATCHv8] mm: slab: free kmem_cache_node after destroy sysfs file

2016-02-08 Thread Dmitry Safonov
982 ("slub: free slabs without holding locks") Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Suggested-by: Vladimir Davydov Signed-off-by: Dmitry Safonov --- v2: Down with SLAB_SUPPORTS_SYSFS thing. v3: Move

Re: [PATCH] mm: slab: free kmem_cache_node after destroy sysfs file

2016-02-08 Thread Dmitry Safonov
On 02/07/2016 10:10 PM, Vladimir Davydov wrote: On Fri, Feb 05, 2016 at 08:16:52PM +0300, Dmitry Safonov wrote: ... diff --git a/mm/slab.c b/mm/slab.c index 6ecc697..41176dd 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2414,13 +2414,19 @@ int __kmem_cache_shrink(struct kmem_cache *cachep, bool

[PATCH] mm: slab: free kmem_cache_node after destroy sysfs file

2016-02-05 Thread Dmitry Safonov
structures and per-cpu freeing into __kmem_cache_release and use it at kmem_cache_release. Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Suggested-by: Vladimir Davydov Signed-off-by: Dmitry Safonov --- v2: Down with SLAB_SUPPORTS_

Re: [PATCHv6] mm: slab: free kmem_cache_node after destroy sysfs file

2016-02-05 Thread Dmitry Safonov
On 02/05/2016 07:11 PM, Vladimir Davydov wrote: On Fri, Feb 05, 2016 at 06:45:36PM +0300, Dmitry Safonov wrote: With enabled slub_debug alloc_calls_show will try to track location and user of slab object on each online node, kmem_cache_node structure shouldn't be freed till there is the

Re: [RFC] trace_irqsoff: remove redundant reset per-CPU buff

2016-02-05 Thread Dmitry Safonov
2016-02-05 18:04 GMT+03:00 Steven Rostedt : > Also, FYI, even if you do an RFC, include "PATCH" in the brackets as > well. I usually have "[RFC][PATCH]". Because when I'm looking for > patches in my inbox, I will filter for PATCH. If a patch is out there > without that in the subject, it is much m

[PATCHv6] mm: slab: free kmem_cache_node after destroy sysfs file

2016-02-05 Thread Dmitry Safonov
reeing into __kmem_cache_free_nodes and use it at kmem_cache_release. Cc: Vladimir Davydov Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Signed-off-by: Dmitry Safonov --- v2: Down with SLAB_SUPPORTS_SYSFS thing. v3: Moved sysfs_

Re: [PATCHv5] mm: slab: free kmem_cache_node after destroy sysfs file

2016-02-05 Thread Dmitry Safonov
On 02/05/2016 06:38 PM, Dmitry Safonov wrote: With enabled slub_debug alloc_calls_show will try to track location and user of slab object on each online node, kmem_cache_node structure shouldn't be freed till there is the last reference to sysfs file. Oh, scratch this, friday evening,

[PATCHv5] mm: slab: free kmem_cache_node after destroy sysfs file

2016-02-05 Thread Dmitry Safonov
reeing into __kmem_cache_free_nodes and use it at kmem_cache_release. Cc: Vladimir Davydov Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Signed-off-by: Dmitry Safonov --- v2: Down with SLAB_SUPPORTS_SYSFS thing. v3: Moved sysfs_

Re: [PATCHv4] mm: slab: shutdown caches only after releasing sysfs file

2016-02-05 Thread Dmitry Safonov
On 02/05/2016 04:22 PM, Vladimir Davydov wrote: On Thu, Feb 04, 2016 at 07:39:48PM +0300, Dmitry Safonov wrote: ... diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index b7e57927..a6bf41a 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h @@ -103,9 +103,10

Re: [RFC] trace_irqsoff: remove redundant reset per-CPU buff

2016-02-05 Thread Dmitry Safonov
2016-02-05 5:40 GMT+03:00 Steven Rostedt : > On Mon, 19 Oct 2015 21:10:26 +0300 > Dmitry Safonov <0x7f454...@gmail.com> wrote: > >> There is no reason to do it twice: from commit b6f11df26fdc28 >> ("trace: Call tracing_reset_online_cpus before tracer->init(

[PATCHv4] mm: slab: shutdown caches only after releasing sysfs file

2016-02-04 Thread Dmitry Safonov
sysfs file and on release of kobject shutdown and remove kmem_cache. Cc: Vladimir Davydov Signed-off-by: Dmitry Safonov --- v2: Down with SLAB_SUPPORTS_SYSFS thing. v3: Moved sysfs_slab_remove inside shutdown_cache v4: Rewo

Re: [PATCHv3] mm/slab: fix race with dereferencing NULL ptr in alloc_calls_show

2016-02-03 Thread Dmitry Safonov
On 02/03/2016 12:44 PM, Vladimir Davydov wrote: On Wed, Feb 03, 2016 at 10:52:13AM +0300, Dmitry Safonov wrote: ... diff --git a/mm/slab_common.c b/mm/slab_common.c index b50aef0..2bfc0b1 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -451,6 +451,8 @@ EXPORT_SYMBOL(kmem_cache_create

[PATCHv3] mm/slab: fix race with dereferencing NULL ptr in alloc_calls_show

2016-02-02 Thread Dmitry Safonov
+0x169/0x4e0 [43963.465155] RSP [43963.465185] CR2: 0020 Cc: Vladimir Davydov Signed-off-by: Dmitry Safonov --- v2: Down with SLAB_SUPPORTS_SYSFS thing. v3: Moved sysfs_slab_remove inside shutdown_cache include/linux/slub_def.h | 10 -- mm/slab.h| 8 ++

[PATCHv2] mm/slab: fix race with dereferencing NULL ptr in alloc_calls_show

2016-02-02 Thread Dmitry Safonov
+0x169/0x4e0 [43963.465155] RSP [43963.465185] CR2: 0020 Cc: Vladimir Davydov Signed-off-by: Dmitry Safonov --- v2: Down with SLAB_SUPPORTS_SYSFS thing. include/linux/slub_def.h | 10 -- mm/slab.h| 8 mm/slab_common.c | 10 -- mm/

Re: [PATCH] mm/slab: fix race with dereferencing NULL ptr in alloc_calls_show

2016-02-02 Thread Dmitry Safonov
/Dmitry-Safonov/mm-slab-fix-race-with-dereferencing-NULL-ptr-in-alloc_calls_show/20160202-230449 config: i386-randconfig-x005-02010231 (attached as .config) reproduce: # save the attached .config to linux build tree make ARCH=i386 Thanks little robot, will resend fixed v2 right soon

[PATCH] mm/slab: fix race with dereferencing NULL ptr in alloc_calls_show

2016-02-02 Thread Dmitry Safonov
+0x169/0x4e0 [43963.465155] RSP [43963.465185] CR2: 0020 Cc: Vladimir Davydov Signed-off-by: Dmitry Safonov --- mm/slab_common.c | 10 -- mm/slub.c| 6 -- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/mm/slab_common.c b/mm/slab_common.c index b

Re: [PATCH] kexec: unmap reserved pages for each error-return way

2016-01-28 Thread Dmitry Safonov
On 01/28/2016 09:29 AM, Minfei Huang wrote: On 01/27/16 at 02:48pm, Dmitry Safonov wrote: For allocation of kimage failure or kexec_prepare or load segments errors there is no need to keep crashkernel memory mapped. It will affect only s390 as map/unmap hook defined only for it. As on unmap

[PATCH] kexec: unmap reserved pages for each error-return way

2016-01-27 Thread Dmitry Safonov
ccess. Signed-off-by: Dmitry Safonov --- arch/s390/kernel/machine_kexec.c | 39 +-- include/linux/kexec.h| 2 +- kernel/kexec.c | 4 ++-- kernel/kexec_core.c | 4 ++-- 4 files changed, 22 insertions(+), 27 deletions(-)

[PATCH] exit: remove unneeded declaration of exit_mm

2015-12-28 Thread Dmitry Safonov
Impact: small cleanup Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/exit.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/kernel/exit.c b/kernel/exit.c index 07110c6..a9f392b 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -59,8 +59,6 @@ #include #include -

[PATCH 2/2] trace_syscalls: cleanup: check syscall_nr with syscall_nr_to_meta

2015-11-20 Thread Dmitry Safonov
As syscall_nr_to_meta already checks for (syscall_nr < 0 || syscall_nr >= NR_syscalls) - remove this checkups. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace/trace_syscalls.c | 30 ++ 1 file changed, 10 insertions(+), 20 deletions(-)

[PATCH 1/2] trace_syscalls: return unhandled trace type on warn

2015-11-20 Thread Dmitry Safonov
Having as an example print_syscall_exit(), return TRACE_TYPE_UNHANDLED if entry type differs from syscall's metadata type. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace/trace_syscalls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k

[PATCH] net: netfilter: fix false positive GCC warnings

2015-11-06 Thread Dmitry Safonov
ed. Reported-by: Florian Westphal Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- net/netfilter/nfnetlink_log.c | 2 +- net/netfilter/nfnetlink_queue.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.

Re: [PATCH] net: netfilter: fix GCC uninitialized warning

2015-11-06 Thread Dmitry Safonov
I thought, it was decided to use 0/NULL/whatever, than uninitialized_var()? Is right now? http://thread.gmane.org/gmane.linux.kernel/1383415 2015-11-06 22:10 GMT+03:00 Pablo Neira Ayuso : > On Fri, Nov 06, 2015 at 09:48:14PM +0300, Dmitry Safonov wrote: >> With x86_64_defconfig: >

[PATCH] trace: ftrace: remove ftrace_cpu_disabled

2015-11-06 Thread Dmitry Safonov
be used by any external module since it disables only function and graph_function tracers but not any other tracer. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace/trace.c | 6 -- kernel/trace/trace.h | 1 - kernel/trace/trace_

[PATCH] net: netfilter: fix GCC uninitialized warning

2015-11-06 Thread Dmitry Safonov
:14: warning: ‘flags’ may be used uninitialized in this function [-Wmaybe-uninitialized] inst->flags = flags; ^ Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- net/netfilter/nfnetlink_log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --

[PATCH] trace: remove redundant TP_ARGS redefining

2015-11-03 Thread Dmitry Safonov
TP_ARGS is not used anywhere in trace.h nor trace_entries.h Firstly, I left just #undef TP_ARGS and had no errors - remove it. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace/trace.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/trace/trace.h b/kernel

Re: [RFC] trace_irqsoff: remove redundant reset per-CPU buff

2015-11-03 Thread Dmitry Safonov
Ping? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

Re: [PATCH] trace_functions_graph: Remove __trace_graph_function

2015-10-30 Thread Dmitry Safonov
I was to dumb to check, if it compiles - please, use the second one. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www

[PATCH] trace_functions_graph: Remove __trace_graph_function

2015-10-30 Thread Dmitry Safonov
__trace_graph_funciton is used in only one location, and is static. As it's small function there is no need to keep it separated out. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace/trace_functions_graph.c | 14 +++--- 1 file changed, 3 insertions(+), 1

[PATCH] trace_functions_graph: Remove __trace_graph_function

2015-10-30 Thread Dmitry Safonov
__trace_graph_funciton is used in only one location, and is static. As it's small function there is no need to keep it separated out. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace/trace_functions_graph.c | 11 +-- 1 file changed, 1 insertion(+), 1

[RFC] trace_irqsoff: remove redundant reset per-CPU buff

2015-10-19 Thread Dmitry Safonov
irqsoff_tracer_init(), which resets per-CPU ringbuffer second time. It's slowpath, but anyway. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace/trace_irqsoff.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_

Re: [PATCH 3/5] ftrace: introduce ftrace_glob structure

2015-10-16 Thread Dmitry Safonov
> Format change. > > OK, patch looks good, but I'm going to do the formatting changes. I'm > not changing the code itself, except for the few places I moved the > declaration of func_g up to keep the declarations in > upside-down-x-mass-tree format. Thank you! Seems better, I think. -- To unsubscr

[RFC] trace_branch: remove {start,stop}_branch_trace

2015-10-16 Thread Dmitry Safonov
They seems to be unneeded since resetting trace on online CPUs is moved out. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace/trace_branch.c | 15 ++- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/kernel/trace/trace_branch.c b/kernel

Re: [PATCH 1/5] ftrace: remove redundant strsep in mod_callback

2015-10-16 Thread Dmitry Safonov
2015-10-14 3:48 GMT+03:00 Steven Rostedt : >> - ret = ftrace_match_module_records(hash, func, mod); >> - if (!ret) >> - ret = -EINVAL; >> + ret = ftrace_match_module_records(hash, func, param); >> + if (ret == 0) > > Small nit, personally, I prefer the if (!ret) version.

[PATCH 2/5] ftrace: clarify code for mod command

2015-09-29 Thread Dmitry Safonov
e_filter Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace/ftrace.c | 37 ++--- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index f87401b..a56f028 100644 --- a/kernel/trac

[PATCH 1/5] ftrace: remove redundant strsep in mod_callback

2015-09-29 Thread Dmitry Safonov
race_filter -bash: echo: write error: Invalid argument Also, I clarified ftrace_mod_callback code a little. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace/ftrace.c | 17 ++--- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/kernel/tr

[PATCH 3/5] ftrace: introduce ftrace_glob structure

2015-09-29 Thread Dmitry Safonov
ftrace_match parameters are very related and I reduce the number of local variables & parameters with it. This is also preparation for module globbing as it would introduce more realated variables & parameters. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- kernel/trace

[PATCH 5/5] Documentation: ftrace: module globbing usage

2015-09-29 Thread Dmitry Safonov
Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- Documentation/trace/ftrace.txt | 17 + 1 file changed, 17 insertions(+) diff --git a/Documentation/trace/ftrace.txt b/Documentation/trace/ftrace.txt index ef621d3..db18362 100644 --- a/Documentation/trace/ftrace.txt

[PATCH 4/5] ftrace: add module globbing

2015-09-29 Thread Dmitry Safonov
cho ':mod:!' > set_ftrace_filter Will trace every function in the kernel, but will not trace functions from any module. sh# echo '*:mod:*' > set_ftrace_filter or sh# echo ':mod:' > set_ftrace_filter As the opposite will trace all functions from all modul

[PATCH] mm: swap: zswap: maybe_preload & refactoring

2015-07-14 Thread Dmitry Safonov
radix_tree_maybe_preload instead radix_tree_preload. Looks like, this wasn't changed only by the reason of code duplication. Signed-off-by: Dmitry Safonov <0x7f454...@gmail.com> --- include/linux/swap.h | 3 +++ mm/swap_state.c | 37 ++ mm/zswap.c

<    5   6   7   8   9   10   11   >