Thread (24 messages) flat view 24 messages, 6 authors, 2015-06-03

Re: [PATCH] seccomp: add ptrace commands for suspend/resume

From: Tycho Andersen <hidden>
Date: 2015-06-02 15:46:26
Also in: lkml

Hi Andy,

On Mon, Jun 01, 2015 at 02:12:33PM -0600, Tycho Andersen wrote:
On Mon, Jun 01, 2015 at 12:51:12PM -0700, Andy Lutomirski wrote:
quoted
On Mon, Jun 1, 2015 at 12:47 PM, Tycho Andersen
[off-list ref] wrote:
quoted
On Mon, Jun 01, 2015 at 12:38:57PM -0700, Andy Lutomirski wrote:
quoted
On Mon, Jun 1, 2015 at 12:28 PM, Tycho Andersen
quoted
+int resume_seccomp(struct task_struct *task)
+{
+       int ret = -EACCES;
+
+       spin_lock_irq(&task->sighand->siglock);
+
+       if (!capable(CAP_SYS_ADMIN))
+               goto out;
+
+       task->seccomp.suspended = false;
+
+#ifdef TIF_NOTSC
+       if (task->seccomp.mode == SECCOMP_MODE_STRICT)
+               set_tsk_thread_flag(task, TIF_NOTSC);
+#endif
Ditto.  Or can the task not be running here?
It is stopped since ptrace requires it to be stopped; I don't know if
that's enough to guarantee correctness, though. Is there some
additional barrier that is needed?
Dunno.  Does ptrace actually guarantee that for new operations?
It seems to; it kept giving me ESRCH when I didn't wait for it to
stop. I'll poke around and see if I can confirm this via the code.
It looks to me like ptrace does guarantee this. The commands that
don't require a task to be stopped are all special cases in the ptrace
syscall definition, and anything that's not one of those is protected
by a ptrace_check_attach(), which IIUC enforces that the task is
stopped.

Tycho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help