xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "security@kernel.org" <security@kernel.org>,
	Kees Cook <keescook@chromium.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	xen-devel <xen-devel@lists.xen.org>,
	Jan Beulich <jbeulich@suse.com>, Borislav Petkov <bp@alien8.de>,
	Andy Lutomirski <luto@kernel.org>,
	Sasha Levin <sasha.levin@oracle.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH v3 2/3] x86/ldt: Make modify_ldt optional
Date: Fri, 24 Jul 2015 01:58:05 +0200	[thread overview]
Message-ID: <20150723235805.GA3191__39819.1151828088$1437696034$gmane$org@1wt.eu> (raw)
In-Reply-To: <CALCETrVvfA+_N_tU2LUwvh+2Q_4AExbQkSgW1C4tESAvhY+4Dg@mail.gmail.com>

On Thu, Jul 23, 2015 at 04:40:14PM -0700, Andy Lutomirski wrote:
> On Thu, Jul 23, 2015 at 4:36 PM, Kees Cook <keescook@chromium.org> wrote:
> > I've been pondering something like this that is even MORE generic, for
> > any syscall. Something like a "syscalls" directory under
> > /proc/sys/kernel, with 1 entry per syscall. "0" is "available", "1" is
> > disabled, and "-1" disabled until next boot.
> >
> 
> It might want to be /proc/sys/kernel/syscalls/[abi]/[name], possibly
> with more than just those options.  We might want "disabled, returns
> ENOSYS", "disabled, returns EPERM", and a lock bit.
> 
> On x86 at least, the implementation's easy -- we can just poke the
> syscall table.

I wouldn't do it these days. Around 2000-2001, with a friend we designed
a module with its userland counterpart which was called "overloader". The
principle was to intercept syscalls in order to enforce some form of
policies, log values, or remap paths, etc. The first use was to log all
file creations during a "make install" to more easily build packages. It
was at the era where it was easy to modify the syscall table from a module,
in kernel 2.2.

We quickly found that beyond logging/rewriting syscall arguments, it had
limited use cases when used as a "syscall firewall" because many syscalls
are still too coarse to decide whether you want to enable/disable them.
I remember that socketcall() and ioctl() were among the annoying ones.
Either you totally enable or totally disable. In the end, the only valid
use cases we found for enabling/disabling a syscall were limited to a very
small set for debugging purposes, in order to force some application code
to detect a missing implementation and switch to an alternative (eg: these
days if you suspect a bug in epoll you could disable it and force the app
to use poll instead). It was still useful to disable module loading and
FS mounting but that was about all by then.

All this to say that probably only a handful of tricky syscalls would
need an on/off switch but clearly not all of them at all, so I'd rather
add a few entries just for the relevant ones, mainly to fix compatibility
issues and nothing more. Eg: what's the point of disabling exit(), wait(),
kill(), fork() or getpid()... It would only increase the difficulty to
sort out bug reports.

Just my opinion,
Willy

  parent reply	other threads:[~2015-07-23 23:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1437592883.git.luto@kernel.org>
2015-07-22 19:23 ` [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous Andy Lutomirski
2015-07-22 19:23 ` [PATCH v3 2/3] x86/ldt: Make modify_ldt optional Andy Lutomirski
2015-07-22 19:23 ` [PATCH v3 3/3] selftests/x86, x86/ldt: Add a selftest for modify_ldt Andy Lutomirski
     [not found] ` <7bfde005b84a90a83bf668a320c7d4ad1b940065.1437592883.git.luto@kernel.org>
2015-07-23  7:13   ` [PATCH v3 2/3] x86/ldt: Make modify_ldt optional Jan Beulich
2015-07-23 10:24   ` Willy Tarreau
     [not found]   ` <20150723102434.GA2929@1wt.eu>
2015-07-23 23:36     ` Kees Cook
     [not found]     ` <CAGXu5j+yEWLuxJ9JUGyN7BxME+iOVXfpFgrZ-_2WXUn6A=0dVg@mail.gmail.com>
2015-07-23 23:40       ` Andy Lutomirski
     [not found]       ` <CALCETrVvfA+_N_tU2LUwvh+2Q_4AExbQkSgW1C4tESAvhY+4Dg@mail.gmail.com>
2015-07-23 23:58         ` Willy Tarreau [this message]
     [not found]         ` <20150723235805.GA3191@1wt.eu>
2015-07-24  0:09           ` Kees Cook
     [not found]           ` <CAGXu5jJNfMvvdr0q17nBz+HiEJuFa7Kvo=ZPAnb4E7So4W0QOA@mail.gmail.com>
2015-07-24  7:24             ` Willy Tarreau
     [not found]             ` <20150724072451.GB3293@1wt.eu>
2015-07-24  7:48               ` Willy Tarreau
     [not found] ` <049fdbab8ae2ecac1c8b40ecd558e9df45ccd5d3.1437592883.git.luto@kernel.org>
2015-07-22 22:20   ` [PATCH v3 1/3] x86/ldt: Make modify_ldt synchronous Boris Ostrovsky
2015-07-24  6:37   ` Borislav Petkov
2015-07-24 15:29   ` Borislav Petkov
     [not found]   ` <55B01745.4010702@oracle.com>
2015-07-25  4:13     ` Boris Ostrovsky
     [not found]     ` <55B30CE3.2010902@oracle.com>
2015-07-25  4:58       ` Andy Lutomirski
     [not found]   ` <20150724152955.GC21441@nazgul.tnic>
2015-07-25  4:52     ` Andy Lutomirski
     [not found]     ` <CALCETrX=uGdTfmz7KkbVyMKEmwcS4C43L5eNsy65VjNsL=7KJA@mail.gmail.com>
2015-07-25  8:37       ` Borislav Petkov

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='20150723235805.GA3191__39819.1151828088$1437696034$gmane$org@1wt.eu' \
    --to=w@1wt.eu \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=jbeulich@suse.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sasha.levin@oracle.com \
    --cc=security@kernel.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xen.org \
    /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).