From: Ingo Molnar <mingo@elte.hu>
To: Andrea Arcangeli <andrea@cpushare.com>
Cc: Chris Wright <chrisw@osdl.org>, Rik van Riel <riel@redhat.com>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: Re: seccomp for 2.6.11-rc1-bk8
Date: Fri, 21 Jan 2005 21:54:16 +0100 [thread overview]
Message-ID: <20050121205416.GA16915@elte.hu> (raw)
In-Reply-To: <20050121203425.GB11112@dualathlon.random>
* Andrea Arcangeli <andrea@cpushare.com> wrote:
> Indeed. Performance is not an issue (in the short term at least, since
> those syscalls will be probably network bound).
>
> The only reason I couldn't use ptrace is what you found, that is the
> oom killing of the parent (or a mistake of the CPU seller that kills
> it by mistake by hand, I must prevent him to screw himself ;). Even
> after fixing ptrace, I've an hard time to prefer ptrace, when a
> simple, localized and self contained solution like seccomp is
> available.
ptrace security problems are a matter of fact, but there are really two
types of security barriers related to ptrace:
- first there is the security barrier between a ptrace-ing task (the
parent) and the kernel/CPU state itself. Ptrace deals with lots of
complex x86 CPU details, which results in complex ptrace APIs and
semantics, plus ptrace itself is mainly used by two apps (gdb and
strace) which use it in a very controlled and synchronous way: all
this combined resulted in a fair share of bugs/races that allowed
unprivileged users to break into the kernel via abuse of the ptrace
APIs.
- the second barrier is the 'jail' of the ptraced task. Especially with
PTRACE_SYSCALL, the things a child ptraced process can do are
extremely limited, everything it tries to do will trap, the task will
suspend and the parent runs. The task is completely passive and ptrace
on that end is a pretty small engine that stops/traps/restarts user
processing without alot of frills.
historically there has been alot less problems with the second barrier.
(in fact i cannot remember even one security issue in that area.)
> I'm open to different solutions, I can even live with you forcing me
> to use the fixed version of ptrace, but you must be confortable to
> take the blame if it breaks ;). [...]
i'm not forcing anyone to do anything, but i think the most logical
solution is to use ptrace. It's there on every Linux box so your client
can run even on 'older' Linux boxes. (You might want to detect in the
client whether the OOM race is fixed in a kernel, but it should not be a
truly big issue.) Waiting for any extra API to get significant userbase
takes at least 1-2 years - while ptrace is here and available on every
Linux box. If you require 'users' to go with a new (or worse: patched)
kernel then you are creating a pretty significant artificial market
penetration barrier for your application.
also, with more applications relying on ptrace it will become more
tested, more robust and people will do speedups. I think the fact that
UML uses ptrace is already a very good sign that it's robust for such
purposes. (_Also_, if there's a security problem in the ptrace barrier,
you'd like to know about it and fix it ASAP - SuSE ships UML, right?)
> [...] Personally I'm confortable to take the blame only if seccomp
> breaks, it's so simple that it can't break. And with break I don't
> mean 0xf00f, that's a minor issue that will be autodetected by the
> system. I mean breaking like killing the ptrace parent right now...
> That can be fixed up reasonably securely too, but it _can't_ be
> autodetected easily (I keep cross logs for everything so I can trace
> it, but it won't be an immediate/automated task like the 0xf00f or
> fcnlex).
an additional idea: you could waitpid() from a 'watchdog' task, on the
parent, and if the parent dies unexpectedly (you get a SIGCHLD) then you
could immediately kill the child PID and log the incident. This still
leaves a small window, but one that is probably quite hard to abuse,
especially since the watchdog task will very likely have the highest
priority amongst those tasks (due to sleeping almost always). The
watchdog task would naturally be very small and hence there's near zero
OOM risk for the watchdog task.
and yet another idea: if you make the ptrace task the leader of its own
process group, then IIRC you will get a death signal delivered to the
ptraced task if the parent dies prematurely. This should close the race
pretty well too.
Ingo
next prev parent reply other threads:[~2005-01-21 20:55 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-21 10:06 seccomp for 2.6.11-rc1-bk8 Andrea Arcangeli
2005-01-21 12:03 ` Ingo Molnar
2005-01-21 12:47 ` Ingo Molnar
2005-01-21 12:55 ` Ingo Molnar
2005-01-21 21:31 ` Roland McGrath
2005-01-22 3:25 ` Andrea Arcangeli
2005-01-21 20:24 ` Andrea Arcangeli
2005-01-21 17:39 ` Chris Wright
2005-01-21 18:39 ` Rik van Riel
2005-01-21 18:50 ` Chris Wright
2005-01-21 19:55 ` Ingo Molnar
2005-01-21 20:34 ` Andrea Arcangeli
2005-01-21 20:54 ` Ingo Molnar [this message]
2005-01-22 2:51 ` Andrea Arcangeli
2005-01-22 10:32 ` Pavel Machek
2005-01-22 17:25 ` Andrea Arcangeli
2005-01-22 19:42 ` Pavel Machek
2005-01-22 23:34 ` Andrea Arcangeli
2005-01-23 0:07 ` Pavel Machek
2005-01-23 0:46 ` Andrea Arcangeli
2005-01-23 0:43 ` Rik van Riel
2005-01-23 0:52 ` Andrea Arcangeli
2005-01-23 4:43 ` Valdis.Kletnieks
2005-01-23 6:11 ` Andrea Arcangeli
2005-01-21 18:59 ` David Wagner
2005-01-21 19:17 ` Chris Wright
2005-01-23 7:34 ` David Wagner
2005-01-24 15:10 ` Daniel Jacobowitz
2005-02-15 9:25 ` Andrea Arcangeli
2005-02-25 19:01 ` David Wagner
2005-01-21 12:11 ` Pavel Machek
2005-02-15 9:32 ` seccomp for 2.6.11-rc4 Andrea Arcangeli
2005-02-16 5:25 ` Herbert Poetzl
2005-02-18 2:25 ` Andrea Arcangeli
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=20050121205416.GA16915@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=andrea@cpushare.com \
--cc=chrisw@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=riel@redhat.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