From: Yury Norov <ynorov@caviumnetworks.com>
To: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
Rik van Riel <riel@redhat.com>, Tejun Heo <tj@kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Christoph Lameter <cl@linux.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Andy Lutomirski <luto@amacapital.net>,
Mark Rutland <mark.rutland@arm.com>,
Russell King <linux@armlinux.org.uk>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Francis Giraldeau <francis.giraldeau@gmail.com>
Subject: Re: [PATCH v16 10/13] arch/arm: enable task isolation functionality
Date: Sun, 18 Mar 2018 17:48:44 +0300 [thread overview]
Message-ID: <20180318144844.ehkbx7npszfreyeh@yury-thinkpad> (raw)
In-Reply-To: <1509728692-10460-11-git-send-email-cmetcalf@mellanox.com>
Hi Francis, Chris,
On Fri, Nov 03, 2017 at 01:04:49PM -0400, Chris Metcalf wrote:
> From: Francis Giraldeau <francis.giraldeau@gmail.com>
>
> This patch is a port of the task isolation functionality to the arm 32-bit
> architecture. The task isolation needs an additional thread flag that
> requires to change the entry assembly code to accept a bitfield larger than
> one byte. The constants _TIF_SYSCALL_WORK and _TIF_WORK_MASK are now
> defined in the literal pool. The rest of the patch is straightforward and
> reflects what is done on other architectures.
>
> To avoid problems with the tst instruction in the v7m build, we renumber
> TIF_SECCOMP to bit 8 and let TIF_TASK_ISOLATION use bit 7.
>
> Signed-off-by: Francis Giraldeau <francis.giraldeau@gmail.com>
> Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com> [with modifications]
[...]
> ---
> diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
> index 58e3771e4c5b..0cfcba5a93df 100644
> --- a/arch/arm/kernel/ptrace.c
> +++ b/arch/arm/kernel/ptrace.c
> @@ -27,6 +27,7 @@
> #include <linux/audit.h>
> #include <linux/tracehook.h>
> #include <linux/unistd.h>
> +#include <linux/isolation.h>
>
> #include <asm/pgtable.h>
> #include <asm/traps.h>
> @@ -936,6 +937,15 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs, int scno)
> if (test_thread_flag(TIF_SYSCALL_TRACE))
> tracehook_report_syscall(regs, PTRACE_SYSCALL_ENTER);
>
> + /*
> + * In task isolation mode, we may prevent the syscall from
> + * running, and if so we also deliver a signal to the process.
> + */
> + if (test_thread_flag(TIF_TASK_ISOLATION)) {
> + if (task_isolation_syscall(scno) == -1)
> + return -1;
> + }
I think it would make sense to load thread flags to local variable
because later in the code test_thread_flag() is called again to check
TIF_SYSCALL_TRACEPOINT flag, and we can avoid it, like this:
unsigned long work = READ_ONCE(current_thread_info()->flags);
Also, all other architectures cache thread flags to local
variable before use; so doing this would make sense for the sake
of unification.
Yury
next prev parent reply other threads:[~2018-03-18 14:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 17:04 [PATCH v16 00/13] support "task_isolation" mode Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 01/13] vmstat: add quiet_vmstat_sync function Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 02/13] vmstat: add vmstat_idle function Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 03/13] Revert "sched/core: Drop the unused try_get_task_struct() helper function" Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 04/13] Add try_get_task_struct_on_cpu() to scheduler for task isolation Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 05/13] Add try_stop_full_tick() API for NO_HZ_FULL Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 06/13] task_isolation: userspace hard isolation from kernel Chris Metcalf
2018-03-18 14:22 ` Yury Norov
2017-11-03 17:04 ` [PATCH v16 07/13] Add task isolation hooks to arch-independent code Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 08/13] arch/x86: enable task isolation functionality Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 09/13] arch/arm64: " Chris Metcalf
2017-11-03 17:32 ` Mark Rutland
2017-11-03 17:53 ` Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 10/13] arch/arm: " Chris Metcalf
2017-11-03 17:23 ` Russell King - ARM Linux
2017-11-03 17:27 ` Chris Metcalf
2017-11-06 22:53 ` Chris Metcalf
2018-03-18 14:48 ` Yury Norov [this message]
2017-11-03 17:04 ` [PATCH v16 11/13] arch/tile: " Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 12/13] arm, tile: turn off timer tick for oneshot_stopped state Chris Metcalf
2017-11-03 17:18 ` Mark Rutland
2017-11-03 17:36 ` Chris Metcalf
2017-11-03 17:04 ` [PATCH v16 13/13] task_isolation self test Chris Metcalf
2017-11-06 15:38 ` [PATCH v16 00/13] support "task_isolation" mode Christopher Lameter
[not found] ` <bd5526d4-7b6e-3b3d-79d0-5d6567c0bdf8@mellanox.com>
2017-11-07 17:10 ` Christopher Lameter
2017-11-07 17:27 ` Chris Metcalf
2017-11-07 17:54 ` Christopher Lameter
2018-03-07 10:07 ` Yury Norov
2018-07-12 12:29 ` Yury Norov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180318144844.ehkbx7npszfreyeh@yury-thinkpad \
--to=ynorov@caviumnetworks.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=cmetcalf@mellanox.com \
--cc=francis.giraldeau@gmail.com \
--cc=fweisbec@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=luto@amacapital.net \
--cc=mark.rutland@arm.com \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=riel@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tj@kernel.org \
--cc=viresh.kumar@linaro.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).