Re: [PATCH 0/4 POC] Allow executing code and syscalls in another address space

2021-04-14 Thread Andrei Vagin
On Wed, Apr 14, 2021 at 08:46:40AM +0200, Jann Horn wrote: > On Wed, Apr 14, 2021 at 7:59 AM Andrei Vagin wrote: > > We already have process_vm_readv and process_vm_writev to read and write > > to a process memory faster than we can do this with ptrace. And now it > > is tim

[PATCH 4/4] selftests: add tests for process_vm_exec

2021-04-13 Thread Andrei Vagin
: ptrace_vm_exec # selftests: process_vm_exec: process_vm_exec_syscall # 1..1 # ok 1 write works as expectd # # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 ok 4 selftests: process_vm_exec: process_vm_exec_syscall Signed-off-by: Andrei Vagin --- .../selftests/process_vm_exec/Makefile

[PATCH 3/4] arch/x86: allow to execute syscalls via process_vm_exec

2021-04-13 Thread Andrei Vagin
and if it is set process_vm_exec will execute a system call with arguments from sigcontext. process_vm_exec retuns 0 if the system call has been executed and an error code in other cases. A return code of the system call can be found in a proper register in sigcontext. Signed-off-by: Andrei Vagin

[PATCH 1/4] signal: add a helper to restore a process state from sigcontex

2021-04-13 Thread Andrei Vagin
It will be used to implement process_vm_exec. Signed-off-by: Andrei Vagin --- arch/x86/kernel/signal.c | 78 ++-- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index be0d7d4152ec

[PATCH 2/4] arch/x86: implement the process_vm_exec syscall

2021-04-13 Thread Andrei Vagin
that process_vm_exec works more than 5 times faster than PTRACE_SYSEMU. Signed-off-by: Andrei Vagin --- arch/Kconfig | 15 +++ arch/x86/Kconfig | 1 + arch/x86/entry/common.c| 16 +++ arch/x86/entry/syscalls/syscall_64.tbl | 1

[PATCH 0/4 POC] Allow executing code and syscalls in another address space

2021-04-13 Thread Andrei Vagin
: Jeff Dike Cc: Mike Rapoport Cc: Michael Kerrisk (man-pages) Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Richard Weinberger Cc: Thomas Gleixner Andrei Vagin (4): signal: add a helper to restore a process state from sigcontex arch/x86: implement the process_vm_exec syscall arch/x86:

Re: [PATCH RESEND v1 3/4] powerpc/vdso: Separate vvar vma from vdso

2021-04-04 Thread Andrei Vagin
t I'd really appreciate > if it gets backported to v5.11 after v5.12 is released, so as not > to complicate already non-simple CRIU-vdso code. Thanks! > > Cc: Andrei Vagin Acked-by: Andrei Vagin > Cc: Andy Lutomirski > Cc: Benjamin Herrenschmidt > Cc: Christophe Leroy > Cc:

Re: [PATCH RESEND v1 2/4] lib/vdso: Add vdso_data pointer as input to __arch_get_timens_vdso_data()

2021-04-04 Thread Andrei Vagin
ns_vdso_data is next page to vdso_data, provide > vdso_data pointer to __arch_get_timens_vdso_data() in order > to ease the calculation on powerpc in following patches. > Acked-by: Andrei Vagin > Signed-off-by: Christophe Leroy

Re: [PATCH RESEND v1 4/4] powerpc/vdso: Add support for time namespaces

2021-04-04 Thread Andrei Vagin
position, knowing it is the next page in vvar. > This avoids having to redo the mflr/bcl/mflr/mtlr dance to locate > the page relative to running code position. > Acked-by: Andrei Vagin > Signed-off-by: Christophe Leroy

Re: [PATCH] move_mount: allow to add a mount into an existing group

2021-03-28 Thread Andrei Vagin
lumbersconf.org/event/7/contributions/640/) > > With this new functionality we can resolve all the problems with > propagation at once. > Thanks for picking this up. Overall it looks good for me. Here is one comment inline. > Cc: Eric W. Biederman > Cc: Alexander Viro > Cc

Re: [PATCH 1/4] arm64: expose orig_x0 in the user_pt_regs structure

2021-03-26 Thread Andrei Vagin
On Fri, Mar 26, 2021 at 11:28 AM Catalin Marinas wrote: > > On Mon, Mar 22, 2021 at 03:50:50PM -0700, Andrei Vagin wrote: > > diff --git a/arch/arm64/include/uapi/asm/ptrace.h > > b/arch/arm64/include/uapi/asm/ptrace.h > > index 758ae984ff97..3c118c5b0893 100644 > >

[PATCH 3/4] selftest/arm64/ptrace: add a test for orig_x0

2021-03-22 Thread Andrei Vagin
x0: 0x5 ok 3 The child exited with code 0. # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0 Signed-off-by: Andrei Vagin --- tools/testing/selftests/arm64/ptrace/Makefile | 6 + tools/testing/selftests/arm64/ptrace/lib.h| 36 ++ .../ptrace/ptrace_restart_syscall_test.c

[PATCH 4/4] selftest/arm64/ptrace: add a test for orig_x7

2021-03-22 Thread Andrei Vagin
: pass:4 fail:0 xfail:0 xpass:0 skip:0 error:0 Signed-off-by: Andrei Vagin --- tools/testing/selftests/arm64/ptrace/Makefile | 2 +- .../arm64/ptrace/ptrace_syscall_test.c| 158 ++ 2 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 tools/testing

[PATCH 2/4] arm64/ptrace: introduce orig_x7 in the user_pt_regs structure

2021-03-22 Thread Andrei Vagin
an origin value of the x7 register if the tracee is stopped in a system call.. Signed-off-by: Andrei Vagin --- arch/arm64/include/asm/ptrace.h | 1 + arch/arm64/include/uapi/asm/ptrace.h | 1 + arch/arm64/kernel/ptrace.c | 18 -- 3 files changed, 14 insertions(+), 6

[PATCH 1/4] arm64: expose orig_x0 in the user_pt_regs structure

2021-03-22 Thread Andrei Vagin
-by: Andrei Vagin --- arch/arm64/include/asm/ptrace.h | 2 +- arch/arm64/include/uapi/asm/ptrace.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/ptrace.h b/arch/arm64/include/asm/ptrace.h index e58bca832dff..d4cdf98ac003 100644 --- a/arch/arm64

[PATCH 0/4 v3] arm64/ptrace: allow to get all registers on syscall traps

2021-03-22 Thread Andrei Vagin
Cc: Dave Martin Cc: Keno Fischer Cc: Oleg Nesterov Cc: Will Deacon Andrei Vagin (4): arm64: expose orig_x0 in the user_pt_regs structure arm64/ptrace: introduce orig_x7 in the user_pt_regs structure selftest/arm64/ptrace: add a test for orig_x0 selftest/arm64/ptrace: add a test

Re: [PATCH 1/3] arm64/ptrace: don't clobber task registers on syscall entry/exit traps

2021-02-25 Thread Andrei Vagin
On Thu, Feb 04, 2021 at 03:23:34PM +, Will Deacon wrote: > On Mon, Feb 01, 2021 at 11:40:10AM -0800, Andrei Vagin wrote: > > ip/r12 for AArch32 and x7 for AArch64 is used to indicate whether or not > > the stop has been signalled from syscall entry or syscall exit.

Re: [PATCH 0/3 v2] arm64/ptrace: allow to get all registers on syscall traps

2021-02-08 Thread Andrei Vagin
On Mon, Feb 01, 2021 at 07:11:12PM -0500, Keno Fischer wrote: > Hi Andrei, > > > This series introduces the PTRACE_O_ARM64_RAW_REGS option. If it is set, > > PTRACE_GETREGSET returns values of all registers, and PTRACE_SETREGSET > > allows to change any of them. > > thanks for picking this up. I

Re: [PATCH 2/3] arm64/ptrace: introduce PTRACE_O_ARM64_RAW_REGS

2021-02-08 Thread Andrei Vagin
On Thu, Feb 04, 2021 at 03:36:15PM +, Will Deacon wrote: > On Mon, Feb 01, 2021 at 11:40:11AM -0800, Andrei Vagin wrote: > > We have some ABI weirdness in the way that we handle syscall > > exit stops because we indicate whether or not the stop has been > > signall

[PATCH 1/3] arm64/ptrace: don't clobber task registers on syscall entry/exit traps

2021-02-01 Thread Andrei Vagin
and to introduce a new ptrace option to get the full set of registers. Signed-off-by: Andrei Vagin --- arch/arm64/include/asm/ptrace.h | 5 ++ arch/arm64/kernel/ptrace.c | 104 2 files changed, 69 insertions(+), 40 deletions(-) diff --git a/arch/arm64/include/asm

[PATCH 3/3] selftest/arm64/ptrace: add tests for PTRACE_O_ARM64_RAW_REGS

2021-02-01 Thread Andrei Vagin
: arm64/ptrace: ptrace_syscall_regs_test # 1..3 # ok 1 x7: 0 # ok 2 x7: 1 # ok 3 The child exited with code 0. # # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0 ok 2 selftests: arm64/ptrace: ptrace_syscall_regs_test Signed-off-by: Andrei Vagin --- tools/testing/selftests/arm64

[PATCH 2/3] arm64/ptrace: introduce PTRACE_O_ARM64_RAW_REGS

2021-02-01 Thread Andrei Vagin
PTRACE_O_ARM64_RAW_REGS. If it is set, PTRACE_GETREGSET returns values of all registers without clobbering r12 or x7 and PTRACE_SETREGSE sets all registers even if a process has been stopped in syscall-enter or syscall-exit. Signed-off-by: Andrei Vagin --- arch/arm64/include/uapi/asm/ptrace.h | 4 ++ arch

[PATCH 0/3 v2] arm64/ptrace: allow to get all registers on syscall traps

2021-02-01 Thread Andrei Vagin
Cc: Oleg Nesterov Cc: Will Deacon Andrei Vagin (3): arm64/ptrace: don't clobber task registers on syscall entry/exit traps arm64/ptrace: introduce PTRACE_O_ARM64_RAW_REGS selftest/arm64/ptrace: add tests for PTRACE_O_ARM64_RAW_REGS v2: use the ptrace option instead of adding a new regset

Re: [PATCH 2/3] arm64/ptrace: introduce NT_ARM_PRSTATUS to get a full set of registers

2021-01-29 Thread Andrei Vagin
On Wed, Jan 27, 2021 at 02:53:07PM +, Dave Martin wrote: > On Tue, Jan 19, 2021 at 02:06:36PM -0800, Andrei Vagin wrote: > > This is an alternative to NT_PRSTATUS that clobbers ip/r12 on AArch32, > > x7 on AArch64 when a tracee is stopped in syscall entry or syscall

Re: [PATCH 0/3] arm64/ptrace: allow to get all registers on syscall traps

2021-01-27 Thread Andrei Vagin
On Tue, Jan 19, 2021 at 2:08 PM Andrei Vagin wrote: > > Right now, ip/r12 for AArch32 and x7 for AArch64 is used to indicate > whether or not the stop has been signalled from syscall entry or syscall > exit. This means that: > > - Any writes by the tracer to this regist

[PATCH 0/3] arm64/ptrace: allow to get all registers on syscall traps

2021-01-19 Thread Andrei Vagin
, it is critical to have access to the full set of registers in any moment. For example, they need to change values of all registers to emulate rt_sigreturn and they need to have the full set of registers to build a signal frame. Andrei Vagin (3): arm64/ptrace: don't clobber task registers on syscall entry

[PATCH 2/3] arm64/ptrace: introduce NT_ARM_PRSTATUS to get a full set of registers

2021-01-19 Thread Andrei Vagin
This is an alternative to NT_PRSTATUS that clobbers ip/r12 on AArch32, x7 on AArch64 when a tracee is stopped in syscall entry or syscall exit traps. Signed-off-by: Andrei Vagin --- arch/arm64/kernel/ptrace.c | 39 ++ include/uapi/linux/elf.h | 1 + 2

[PATCH 3/3] selftest/arm64/ptrace: add a test for NT_ARM_PRSTATUS

2021-01-19 Thread Andrei Vagin
: ptrace_syscall_regs_test Signed-off-by: Andrei Vagin --- tools/testing/selftests/arm64/Makefile| 2 +- tools/testing/selftests/arm64/ptrace/Makefile | 6 + .../arm64/ptrace/ptrace_syscall_regs_test.c | 147 ++ 3 files changed, 154 insertions(+), 1 deletion(-) create

[PATCH 1/3] arm64/ptrace: don't clobber task registers on syscall entry/exit traps

2021-01-19 Thread Andrei Vagin
and to introduce a new NT_ARM_PRSTATUS command to get the full set of registers. Signed-off-by: Andrei Vagin --- arch/arm64/include/asm/ptrace.h | 5 ++ arch/arm64/kernel/ptrace.c | 104 +++- 2 files changed, 67 insertions(+), 42 deletions(-) diff --git a/arch/arm64

Re: [PATCH] timens: delete no-op time_ns_init()

2020-12-29 Thread Andrei Vagin
On Mon, Dec 28, 2020 at 1:54 PM Alexey Dobriyan wrote: > > Signed-off-by: Alexey Dobriyan Acked-by: Andrei Vagin Thanks, Andrei > --- > > kernel/time/namespace.c |6 -- > 1 file changed, 6 deletions(-) > > --- a/kernel/time/namespace.c > +++ b/kernel/t

Re: [PATCH v4 0/3] time namespace aware system boot time

2020-10-22 Thread Andrei Vagin
oottime() in 'time_namespace.h' to provide > better coder readability/consistency. > Reviewed-by: Andrei Vagin Thanks, Andrei

[tip: timers/urgent] futex: Adjust absolute futex timeouts with per time namespace offset

2020-10-20 Thread tip-bot2 for Andrei Vagin
The following commit has been merged into the timers/urgent branch of tip: Commit-ID: c2f7d08cccf4af2ce6992feaabb9e68e4ae0bff3 Gitweb: https://git.kernel.org/tip/c2f7d08cccf4af2ce6992feaabb9e68e4ae0bff3 Author:Andrei Vagin AuthorDate:Thu, 15 Oct 2020 09:00:19 -07:00

[tip: timers/urgent] selftests/timens: Add a test for futex()

2020-10-20 Thread tip-bot2 for Andrei Vagin
The following commit has been merged into the timers/urgent branch of tip: Commit-ID: a4fd8414659bf470e2146b352574bbd274e54b7a Gitweb: https://git.kernel.org/tip/a4fd8414659bf470e2146b352574bbd274e54b7a Author:Andrei Vagin AuthorDate:Thu, 15 Oct 2020 09:00:20 -07:00

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

2020-10-16 Thread Andrei Vagin
On Thu, Oct 15, 2020 at 04:13:42PM +0200, Thomas Gleixner wrote: > On Thu, Oct 15 2020 at 14:26, Dmitry Safonov wrote: > > > On 10/15/20 8:29 AM, Andrei Vagin wrote: > >> For all commands except FUTEX_WAIT, timeout is interpreted as an > >> absolute value. This absol

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

2020-10-15 Thread Andrei Vagin
ns van der Laan Signed-off-by: Andrei Vagin --- v2: * check FUTEX_CLOCK_REALTIME properly * fix futex_time32 too kernel/futex.c | 5 + 1 file changed, 5 insertions(+) diff --git a/kernel/futex.c b/kernel/futex.c index a5876694a60e..32056d2d4171 100644 --- a/kernel/futex.c +++ b/kernel/futex.

[PATCH 2/2 v2] selftests/timens: Add a test for futex()

2020-10-15 Thread Andrei Vagin
Output on success: 1..2 ok 1 futex with the 0 clockid ok 2 futex with the 1 clockid # Totals: pass:2 fail:0 xfail:0 xpass:0 skip:0 error:0 Signed-off-by: Andrei Vagin --- v2: extend the test to check FUTEX_CLOCK_REALTIME tools/testing/selftests/timens/Makefile | 2 +- tools/testing

[tip: timers/urgent] selftests/timens: Add a test for futex()

2020-10-15 Thread tip-bot2 for Andrei Vagin
The following commit has been merged into the timers/urgent branch of tip: Commit-ID: 4cdf42596216e08051c0ccc4c896dcb8b2d22f10 Gitweb: https://git.kernel.org/tip/4cdf42596216e08051c0ccc4c896dcb8b2d22f10 Author:Andrei Vagin AuthorDate:Thu, 15 Oct 2020 00:29:09 -07:00

[tip: timers/urgent] futex: Adjust futex absolute timeouts with per-timens offset

2020-10-15 Thread tip-bot2 for Andrei Vagin
The following commit has been merged into the timers/urgent branch of tip: Commit-ID: 06764291690f8650a9f96dea42cc0dd4138d47d5 Gitweb: https://git.kernel.org/tip/06764291690f8650a9f96dea42cc0dd4138d47d5 Author:Andrei Vagin AuthorDate:Thu, 15 Oct 2020 00:29:08 -07:00

Re: [PATCH v3 2/3] fs/proc: apply the time namespace offset to /proc/stat btime

2020-10-15 Thread Andrei Vagin
On Sun, Oct 11, 2020 at 04:59:23PM +0200, Michael Weiß wrote: > @@ -79,6 +80,20 @@ static u64 get_iowait_time(struct kernel_cpustat *kcs, int > cpu) > > #endif > > +static void get_boottime(struct timespec64 *ts) > +{ > + ktime_t boottime; > + > + /* get kernel internal system boot

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

2020-10-15 Thread Andrei Vagin
ns van der Laan Signed-off-by: Andrei Vagin --- kernel/futex.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/futex.c b/kernel/futex.c index a5876694a60e..9ff2b8c5a506 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -39,6 +39,7 @@ #include #include #include +#include

[PATCH 2/2] selftests/timens: Add a test for futex()

2020-10-15 Thread Andrei Vagin
Output on success: $ ./futex 1..1 ok 1 futex # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0 Signed-off-by: Andrei Vagin --- tools/testing/selftests/timens/Makefile | 2 +- tools/testing/selftests/timens/futex.c | 107 2 files changed, 108 insertions(+), 1

Re: [PATCH v2 2/4] time: make getboottime64 aware of time namespace

2020-10-10 Thread Andrei Vagin
On Fri, Oct 09, 2020 at 03:28:15PM +0200, Christian Brauner wrote: > On Thu, Oct 08, 2020 at 07:39:42AM +0200, Michael Weiß wrote: > > getboottime64() provides the time stamp of system boot. In case of > > time namespaces, the offset to the boot time stamp was not applied > > earlier. However,

Re: [RFC PATCH 0/5] Introduce /proc/all/ to gather stats from all processes

2020-08-20 Thread Andrei Vagin
On Fri, Aug 14, 2020 at 01:01:00AM +1000, Eugene Lubarsky wrote: > On Wed, 12 Aug 2020 00:51:35 -0700 > Andrei Vagin wrote: > > > Maybe we need resurrect the task_diag series instead of inventing > > another less-effective interface... > > I would certainly welcome th

Re: [PATCH 00/23] proc: Introduce /proc/namespaces/ directory to expose namespaces lineary

2020-08-14 Thread Andrei Vagin
On Fri, Aug 14, 2020 at 06:11:58PM +0300, Kirill Tkhai wrote: > On 14.08.2020 04:16, Andrei Vagin wrote: > > On Thu, Aug 13, 2020 at 11:12:45AM +0300, Kirill Tkhai wrote: > >> On 12.08.2020 20:53, Andrei Vagin wrote: > >>> On Tue, Aug 11, 2020 at 01:23:

Re: [PATCH 00/23] proc: Introduce /proc/namespaces/ directory to expose namespaces lineary

2020-08-13 Thread Andrei Vagin
On Thu, Aug 13, 2020 at 11:12:45AM +0300, Kirill Tkhai wrote: > On 12.08.2020 20:53, Andrei Vagin wrote: > > On Tue, Aug 11, 2020 at 01:23:35PM +0300, Kirill Tkhai wrote: > >> On 10.08.2020 20:34, Andrei Vagin wrote: > >>> On Fri, Aug 07, 2020 at 11:47:

Re: [RFC PATCH 0/5] Introduce /proc/all/ to gather stats from all processes

2020-08-13 Thread Andrei Vagin
On Wed, Aug 12, 2020 at 10:47:32PM -0600, David Ahern wrote: > On 8/12/20 1:51 AM, Andrei Vagin wrote: > > > > I rebased the task_diag patches on top of v5.8: > > https://github.com/avagin/linux-task-diag/tree/v5.8-task-diag > > Thanks for updating the patches. >

Re: [PATCH 00/23] proc: Introduce /proc/namespaces/ directory to expose namespaces lineary

2020-08-12 Thread Andrei Vagin
On Tue, Aug 11, 2020 at 01:23:35PM +0300, Kirill Tkhai wrote: > On 10.08.2020 20:34, Andrei Vagin wrote: > > On Fri, Aug 07, 2020 at 11:47:57AM +0300, Kirill Tkhai wrote: > >> On 06.08.2020 11:05, Andrei Vagin wrote: > >>> On Mon, Aug 03, 2020 at 01:03:

Re: [RFC PATCH 0/5] Introduce /proc/all/ to gather stats from all processes

2020-08-12 Thread Andrei Vagin
On Tue, Aug 11, 2020 at 12:58:47AM +1000, Eugene Lubarsky wrote: > This is an idea for substantially reducing the number of syscalls needed > by monitoring tools whilst mostly re-using the existing API. > > The proposed files in this proof-of-concept patch set are: > > * /proc/all/stat > A

Re: [PATCH 00/23] proc: Introduce /proc/namespaces/ directory to expose namespaces lineary

2020-08-10 Thread Andrei Vagin
On Fri, Aug 07, 2020 at 11:47:57AM +0300, Kirill Tkhai wrote: > On 06.08.2020 11:05, Andrei Vagin wrote: > > On Mon, Aug 03, 2020 at 01:03:17PM +0300, Kirill Tkhai wrote: > >> On 31.07.2020 01:13, Eric W. Biederman wrote: > >>> Kirill Tkhai writes: > >&

Re: [PATCH 00/23] proc: Introduce /proc/namespaces/ directory to expose namespaces lineary

2020-08-06 Thread Andrei Vagin
On Mon, Aug 03, 2020 at 01:03:17PM +0300, Kirill Tkhai wrote: > On 31.07.2020 01:13, Eric W. Biederman wrote: > > Kirill Tkhai writes: > > > >> On 30.07.2020 17:34, Eric W. Biederman wrote: > >>> Kirill Tkhai writes: > >>> > Currently, there is no a way to list or iterate all or subset of

Re: [PATCH 00/23] proc: Introduce /proc/namespaces/ directory to expose namespaces lineary

2020-08-03 Thread Andrei Vagin
On Thu, Jul 30, 2020 at 06:01:20PM +0300, Kirill Tkhai wrote: > On 30.07.2020 17:34, Eric W. Biederman wrote: > > Kirill Tkhai writes: > > > >> Currently, there is no a way to list or iterate all or subset of namespaces > >> in the system. Some namespaces are exposed in /proc/[pid]/ns/

Re: [PATCH 1/6] arm64/vdso: use the fault callback to map vvar pages

2020-07-27 Thread Andrei Vagin
On Fri, Jul 24, 2020 at 06:26:23PM +0100, Catalin Marinas wrote: > On Wed, 24 Jun 2020 01:33:16 -0700, Andrei Vagin wrote: > > Currently the vdso has no awareness of time namespaces, which may > > apply distinct offsets to processes in different namespaces. To handle > >

Re: [PATCH v5 0/6] arm64: add the time namespace support

2020-07-23 Thread Andrei Vagin
On Wed, Jul 22, 2020 at 07:15:06PM +0100, Catalin Marinas wrote: > On Mon, Jul 13, 2020 at 06:57:43PM -0700, Andrei Vagin wrote: > > On Sat, Jul 04, 2020 at 11:40:55PM -0700, Andrei Vagin wrote: > > > On Wed, Jun 24, 2020 at 01:33:15AM -0700, Andrei Vagin wrote: > > > &g

Re: [PATCH v5 0/6] arm64: add the time namespace support

2020-07-13 Thread Andrei Vagin
On Sat, Jul 04, 2020 at 11:40:55PM -0700, Andrei Vagin wrote: > On Wed, Jun 24, 2020 at 01:33:15AM -0700, Andrei Vagin wrote: > > Allocate the time namespace page among VVAR pages and add the logic > > to handle faults on VVAR properly. > > > > If a task belongs to a t

Re: [PATCH v5 0/6] arm64: add the time namespace support

2020-07-05 Thread Andrei Vagin
On Wed, Jun 24, 2020 at 01:33:15AM -0700, Andrei Vagin wrote: > Allocate the time namespace page among VVAR pages and add the logic > to handle faults on VVAR properly. > > If a task belongs to a time namespace then the VVAR page which contains > the system wide VDSO d

Re: [PATCH 3/3] nsproxy: support CLONE_NEWTIME with setns()

2020-06-25 Thread Andrei Vagin
tomically > problematic. This is now fixed so support CLONE_NEWTIME with setns() > > Cc: Thomas Gleixner > Cc: Michael Kerrisk > Cc: Serge Hallyn > Cc: Dmitry Safonov > Cc: Andrei Vagin > Signed-off-by: Christian Brauner Hi Christian, I have reviewed this series and

Re: [PATCH 3/3] nsproxy: support CLONE_NEWTIME with setns()

2020-06-25 Thread Andrei Vagin
ens() > > could still fail which made switching to multiple namespaces atomically > > problematic. This is now fixed so support CLONE_NEWTIME with setns() > > > > Cc: Thomas Gleixner > > Cc: Michael Kerrisk > > Cc: Serge Hallyn > > Cc: Dmitry Safonov &

Re: [PATCH 2/6] arm64/vdso: Zap vvar pages when switching to a time namespace

2020-06-25 Thread Andrei Vagin
On Wed, Jun 24, 2020 at 05:18:01PM +0200, Christian Brauner wrote: > On Wed, Jun 24, 2020 at 01:33:17AM -0700, Andrei Vagin wrote: > > The order of vvar pages depends on whether a task belongs to the root > > time namespace or not. In the root time namespace, a task doesn't

[PATCH 5/6] arm64/vdso: Restrict splitting VVAR VMA

2020-06-24 Thread Andrei Vagin
()'ed. Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- arch/arm64/kernel/vdso.c | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index be9ca8c46cff..8be6bd6625db 100644 --- a/arch

[PATCH 1/6] arm64/vdso: use the fault callback to map vvar pages

2020-06-24 Thread Andrei Vagin
-by: Andrei Vagin --- arch/arm64/kernel/vdso.c | 25 +++-- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 4e016574bd91..7c4620451fa5 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c

[PATCH 4/6] arm64/vdso: Handle faults on timens page

2020-06-24 Thread Andrei Vagin
If a task belongs to a time namespace then the VVAR page which contains the system wide VDSO data is replaced with a namespace specific page which has the same layout as the VVAR page. Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- arch/arm64/kernel

[PATCH 6/6] arm64: enable time namespace support

2020-06-24 Thread Andrei Vagin
CONFIG_TIME_NS is dependes on GENERIC_VDSO_TIME_NS. Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index a4a094bedcb2..38d3180adf78 100644

[PATCH v5 0/6] arm64: add the time namespace support

2020-06-24 Thread Andrei Vagin
p_page_range doesn't require mmap_write_lock. Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Cc: Thomas Gleixner Cc: Dmitry Safonov v5 on github (if someone prefers `git pull` to `git am`): https://github.com/avagin/linux-task-diag/tree/arm64/timens-v5 Andrei Vagin (6): arm

[PATCH 3/6] arm64/vdso: Add time namespace page

2020-06-24 Thread Andrei Vagin
erent kernel configs. Cc: Mark Rutland Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- arch/arm64/include/asm/vdso.h | 2 ++ .../include/asm/vdso/compat_gettimeofday.h| 12 arch/arm64/include/asm/vdso/gettimeofd

[PATCH 2/6] arm64/vdso: Zap vvar pages when switching to a time namespace

2020-06-24 Thread Andrei Vagin
nov Signed-off-by: Andrei Vagin --- arch/arm64/kernel/vdso.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 7c4620451fa5..bdf492a17dff 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vds

Re: [RFC PATCH 1/3 v2] futex: introduce FUTEX_SWAP operation

2020-06-23 Thread Andrei Vagin
On Tue, Jun 23, 2020 at 11:30:30AM -0700, Peter Oskolkov wrote: ... > > > /** > > > +static int futex_swap(u32 __user *uaddr, unsigned int flags, u32 > > > val, > > > + ktime_t *abs_time, u32 __user *uaddr2) > > > +{ > > > + u32 bitset = FUTEX_BITSET_MATCH_ANY; > > > + struct

Re: [PATCH 2/6] arm64/vdso: Zap vvar pages when switching to a time namespace

2020-06-23 Thread Andrei Vagin
On Fri, Jun 19, 2020 at 05:38:12PM +0200, Christian Brauner wrote: > On Tue, Jun 16, 2020 at 12:55:41AM -0700, Andrei Vagin wrote: > > The VVAR page layout depends on whether a task belongs to the root or > > non-root time namespace. Whenever a task changes its namespace, the VVAR

Re: [PATCH 1/6] arm64/vdso: use the fault callback to map vvar pages

2020-06-18 Thread Andrei Vagin
On Tue, Jun 16, 2020 at 11:59:20AM +0100, Mark Rutland wrote: > On Tue, Jun 16, 2020 at 12:55:40AM -0700, Andrei Vagin wrote: > > This is required to support time namespaces where a time namespace data > > page is different for each namespace. > > Can you please give a bit mo

Re: [RFC PATCH 1/3 v2] futex: introduce FUTEX_SWAP operation

2020-06-17 Thread Andrei Vagin
On Tue, Jun 16, 2020 at 10:22:26AM -0700, Peter Oskolkov wrote: > From 6fbe0261204692a7f488261ab3c4ac696b91db5c Mon Sep 17 00:00:00 2001 > From: Peter Oskolkov > Date: Tue, 9 Jun 2020 16:03:14 -0700 > Subject: [RFC PATCH 1/3 v2] futex: introduce FUTEX_SWAP operation > > This is an RFC! > > As

[PATCH 4/6] arm64/vdso: Handle faults on timens page

2020-06-16 Thread Andrei Vagin
If a task belongs to a time namespace then the VVAR page which contains the system wide VDSO data is replaced with a namespace specific page which has the same layout as the VVAR page. Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- arch/arm64/kernel

[PATCH v4 0/6] arm64: add the time namespace support

2020-06-16 Thread Andrei Vagin
am`): https://github.com/avagin/linux-task-diag/tree/arm64/timens-v4 Andrei Vagin (6): arm64/vdso: use the fault callback to map vvar pages arm64/vdso: Zap vvar pages when switching to a time namespace arm64/vdso: Add time namespace page arm64/vdso: Handle faults on timens page arm64/vdso: Restri

[PATCH 1/6] arm64/vdso: use the fault callback to map vvar pages

2020-06-16 Thread Andrei Vagin
This is required to support time namespaces where a time namespace data page is different for each namespace. Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- arch/arm64/kernel/vdso.c | 24 +++- 1 file changed, 15 insertions(+), 9

[PATCH 5/6] arm64/vdso: Restrict splitting VVAR VMA

2020-06-16 Thread Andrei Vagin
()'ed. Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- arch/arm64/kernel/vdso.c | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index 21bdd0d74f40..68e021324113 100644 --- a/arch

[PATCH 6/6] arm64: enable time namespace support

2020-06-16 Thread Andrei Vagin
CONFIG_TIME_NS is dependes on GENERIC_VDSO_TIME_NS. Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 31380da53689..e3956cbfd8a9 100644

[PATCH 3/6] arm64/vdso: Add time namespace page

2020-06-16 Thread Andrei Vagin
time getter function which retrieves the real VVAR page, reads host time and then adds the offset for the requested clock which is stored in the special VVAR page. Cc: Mark Rutland Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- arch/arm64/includ

[PATCH 2/6] arm64/vdso: Zap vvar pages when switching to a time namespace

2020-06-16 Thread Andrei Vagin
-off-by: Andrei Vagin --- arch/arm64/kernel/vdso.c | 32 1 file changed, 32 insertions(+) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index b0aec4e8c9b4..df4bb736d28a 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch/arm64/kernel/vdso.c

Re: [PATCH v2 1/3] capabilities: Introduce CAP_CHECKPOINT_RESTORE

2020-06-10 Thread Andrei Vagin
On Tue, Jun 09, 2020 at 06:14:27PM +0200, Christian Brauner wrote: > On Tue, Jun 09, 2020 at 09:06:27AM -0700, Andrei Vagin wrote: > > On Tue, Jun 09, 2020 at 09:44:22AM +0200, Christian Brauner wrote: > > > On Mon, Jun 08, 2020 at 08:42:21PM -0700,

Re: [PATCH v2 1/3] capabilities: Introduce CAP_CHECKPOINT_RESTORE

2020-06-09 Thread Andrei Vagin
On Tue, Jun 09, 2020 at 09:44:22AM +0200, Christian Brauner wrote: > On Mon, Jun 08, 2020 at 08:42:21PM -0700, Andrei Vagin wrote: > > On Wed, Jun 03, 2020 at 06:23:26PM +0200, Adrian Reber wrote: > > > This patch introduces CAP_CHECKPOINT_RESTORE, a new capability

Re: [PATCH v2 1/3] capabilities: Introduce CAP_CHECKPOINT_RESTORE

2020-06-08 Thread Andrei Vagin
On Wed, Jun 03, 2020 at 06:23:26PM +0200, Adrian Reber wrote: > This patch introduces CAP_CHECKPOINT_RESTORE, a new capability facilitating > checkpoint/restore for non-root users. > > Over the last years, The CRIU (Checkpoint/Restore In Userspace) team has been > asked numerous times if it is

Re: [PATCH] capabilities: Introduce CAP_RESTORE

2020-06-07 Thread Andrei Vagin
> > > > I would argue that setting the current process exe file check should just > > be reduced to a "can you ptrace a children" check. > > Here's why: any process can masquerade into another executable with ptrace. > > One can fork a child, ptrace it, have the child execve("target_exe"), then

Re: [PATCH RESEND v3 0/6] arm64: add the time namespace support

2020-06-06 Thread Andrei Vagin
On Fri, Jun 05, 2020 at 11:49:04AM +0100, Mark Rutland wrote: > Hi Andrei, > > As a heads up, in mainline the arm64 vdso code has been refactored since > v5.7, and this series will need to be rebased atop. Given we're in the > middle of the merge window, I would suggest waiting until rc1 before >

[PATCH 3/6 v4] arm64/vdso: Add time namespace page

2020-06-05 Thread Andrei Vagin
time getter function which retrieves the real VVAR page, reads host time and then adds the offset for the requested clock which is stored in the special VVAR page. Cc: Mark Rutland Reviewed-by: Vincenzo Frascino Reviewed-by: Dmitry Safonov Signed-off-by: Andrei Vagin --- v4: - fix an issue reporte

[PATCH 1/6] arm64/vdso: use the fault callback to map vvar pages

2020-06-02 Thread Andrei Vagin
This is required to support time namespaces where a time namespace data page is different for each namespace. Reviewed-by: Vincenzo Frascino Signed-off-by: Andrei Vagin --- arch/arm64/kernel/vdso.c | 24 +++- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git

[PATCH RESEND v3 0/6] arm64: add the time namespace support

2020-06-02 Thread Andrei Vagin
` to `git am`): https://github.com/avagin/linux-task-diag/tree/arm64/timens-v3 Andrei Vagin (6): arm64/vdso: use the fault callback to map vvar pages arm64/vdso: Zap vvar pages when switching to a time namespace arm64/vdso: Add time napespace page arm64/vdso: Handle faults on timens page

[PATCH 6/6] arm64: enable time namespace support

2020-06-02 Thread Andrei Vagin
CONFIG_TIME_NS is dependes on GENERIC_VDSO_TIME_NS. Reviewed-by: Vincenzo Frascino Signed-off-by: Andrei Vagin --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 5d513f461957..27d7e4ed1c93 100644 --- a/arch/arm64/Kconfig

[PATCH 4/6] arm64/vdso: Handle faults on timens page

2020-06-02 Thread Andrei Vagin
If a task belongs to a time namespace then the VVAR page which contains the system wide VDSO data is replaced with a namespace specific page which has the same layout as the VVAR page. Reviewed-by: Vincenzo Frascino Signed-off-by: Andrei Vagin --- arch/arm64/kernel/vdso.c | 57

[PATCH 3/6] arm64/vdso: Add time namespace page

2020-06-02 Thread Andrei Vagin
time getter function which retrieves the real VVAR page, reads host time and then adds the offset for the requested clock which is stored in the special VVAR page. Cc: Mark Rutland Reviewed-by: Vincenzo Frascino Signed-off-by: Andrei Vagin --- arch/arm64/include/asm/vdso.h | 6 +

[PATCH 2/6] arm64/vdso: Zap vvar pages when switching to a time namespace

2020-06-02 Thread Andrei Vagin
The VVAR page layout depends on whether a task belongs to the root or non-root time namespace. Whenever a task changes its namespace, the VVAR page tables are cleared and then they will be re-faulted with a corresponding layout. Reviewed-by: Vincenzo Frascino Signed-off-by: Andrei Vagin

[PATCH 5/6] arm64/vdso: Restrict splitting VVAR VMA

2020-06-02 Thread Andrei Vagin
()'ed. Reviewed-by: Vincenzo Frascino Signed-off-by: Andrei Vagin --- arch/arm64/kernel/vdso.c | 13 + 1 file changed, 13 insertions(+) diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c index f3baecd8edfb..8b17d7d10729 100644 --- a/arch/arm64/kernel/vdso.c +++ b/arch

Re: [PATCH] capabilities: Introduce CAP_RESTORE

2020-05-22 Thread Andrei Vagin
On Fri, May 22, 2020 at 09:40:37AM -0700, Casey Schaufler wrote: > On 5/21/2020 10:53 PM, Adrian Reber wrote: > > There are probably a few more things guarded by CAP_SYS_ADMIN required > > to run checkpoint/restore as non-root, > > If you need CAP_SYS_ADMIN anyway you're not gaining anything by >

Re: [PATCH] capabilities: Introduce CAP_RESTORE

2020-05-22 Thread Andrei Vagin
On Fri, May 22, 2020 at 09:53:31AM +0200, Christian Brauner wrote: > On Fri, May 22, 2020 at 07:53:50AM +0200, Adrian Reber wrote: > > > > There are probably a few more things guarded by CAP_SYS_ADMIN required > > to run checkpoint/restore as non-root, but by applying this patch I can > > already

[PATCH v3] selftests/timens: handle a case when alarm clocks are not supported

2020-05-21 Thread Andrei Vagin
This can happen if a testing node doesn't have RTC (real time clock) hardware or it doesn't support alarms. Fixes: 61c57676035d ("selftests/timens: Add Time Namespace test for supported clocks") Acked-by: Vincenzo Frascino Reported-by: Vincenzo Frascino Signed-off-by: Andrei Vagin -

Re: [PATCHv7 00/33] kernel: Introduce Time Namespace

2019-10-22 Thread Andrei Vagin
On Thu, Oct 17, 2019 at 04:47:48PM -0700, Andrei Vagin wrote: > > In my table, the "before" column is actually for the upstream kernel > with the 18-th patch. Here is the table with the real "before" column: > > | before| with 18/33 | CONFIG_TIME_

Re: [PATCHv7 00/33] kernel: Introduce Time Namespace

2019-10-17 Thread Andrei Vagin
On Thu, Oct 17, 2019 at 11:24:45AM +0200, Thomas Gleixner wrote: > On Fri, 11 Oct 2019, Dmitry Safonov wrote: > > We wrote two small benchmarks. The first one gettime_perf.c calls > > clock_gettime() in a loop for 3 seconds. It shows us performance with > > a hot CPU cache (more clock_gettime()

Re: [PATCHv7 01/33] ns: Introduce Time Namespace

2019-10-16 Thread Andrei Vagin
On Wed, Oct 16, 2019 at 12:39:11PM +0200, Thomas Gleixner wrote: > On Wed, 16 Oct 2019, Vincenzo Frascino wrote: > > < Trim 250+ lines ( 3+ pages) of pointlessly wasted electrons > > > > > --- a/init/Kconfig > > > +++ b/init/Kconfig > > > @@ -1096,6 +1096,13 @@ config UTS_NS > > > In this

Re: [PATCHv6 30/36] selftest/timens: Add Time Namespace test for supported clocks

2019-08-16 Thread Andrei Vagin
gh VDSO and > > by entering the kernel with implicit syscall. > > > > Introduce a new timens directory in selftests framework for > > the next timens tests. > > > > Co-developed-by: Andrei Vagin > > Signed-off-by: Andrei Vagin > > Signed-off-by: Dm

Re: [PATCHv6 01/36] ns: Introduce Time Namespace

2019-08-16 Thread Andrei Vagin
On Thu, Aug 15, 2019 at 07:19:12PM +0200, Thomas Gleixner wrote: > Dmitry, > > On Thu, 15 Aug 2019, Dmitry Safonov wrote: > > diff --git a/MAINTAINERS b/MAINTAINERS > > index 420567d1519a..97b7737f5aba 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -12898,6 +12898,8 @@ T: git > >

Re: [PATCH v6 1/2] fork: extend clone3() to support setting a PID

2019-08-12 Thread Andrei Vagin
On Mon, Aug 12, 2019 at 2:03 PM Adrian Reber wrote: > > On Mon, Aug 12, 2019 at 01:43:53PM -0700, Andrei Vagin wrote: > > On Mon, Aug 12, 2019 at 1:10 PM Adrian Reber wrote: > > > > > > The main motivation to add set_tid to clone3() is CRIU. > > > > >

Re: [PATCH v6 1/2] fork: extend clone3() to support setting a PID

2019-08-12 Thread Andrei Vagin
On Mon, Aug 12, 2019 at 1:10 PM Adrian Reber wrote: > > The main motivation to add set_tid to clone3() is CRIU. > > To restore a process with the same PID/TID CRIU currently uses > /proc/sys/kernel/ns_last_pid. It writes the desired (PID - 1) to > ns_last_pid and then (quickly) does a clone().

Re: [PATCHv5 06/37] alarmtimer: Provide get_timespec() callback

2019-08-08 Thread Andrei Vagin
On Wed, Aug 07, 2019 at 08:04:10AM +0200, Thomas Gleixner wrote: > On Mon, 29 Jul 2019, Dmitry Safonov wrote: > > /** > > @@ -869,8 +871,10 @@ static int __init alarmtimer_init(void) > > /* Initialize alarm bases */ > > alarm_bases[ALARM_REALTIME].base_clockid = CLOCK_REALTIME; > >

  1   2   3   4   5   6   >