From: Christoph Hellwig <hch@infradead.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: David Drysdale <drysdale@google.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Meredydd Luff <meredydd@senatehouse.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
Andrew Morton <akpm@linux-foundation.org>,
Kees Cook <keescook@chromium.org>, Arnd Bergmann <arnd@arndb.de>,
X86 ML <x86@kernel.org>, linux-arch <linux-arch@vger.kernel.org>,
Linux API <linux-api@vger.kernel.org>,
Rich Felker <dalias@aerifal.cx>
Subject: Re: [PATCHv4 RESEND 0/3] syscalls,x86: Add execveat() system call
Date: Wed, 22 Oct 2014 04:54:05 -0700 [thread overview]
Message-ID: <20141022115405.GA8593@infradead.org> (raw)
In-Reply-To: <CALCETrVraoD+r4zxBoGd+BV5P275AXcRV_R00SSr8fjQzRHnUg@mail.gmail.com>
[adding Rich Felker to the Cc list, who has been very interested in a
O_SEARCH implementation for which this would be an important building
block]
On Fri, Oct 17, 2014 at 02:45:03PM -0700, Andy Lutomirski wrote:
> [Added Eric Biederman, since I think your tree might be a reasonable
> route forward for these patches.]
>
> On Thu, Jun 5, 2014 at 6:40 AM, David Drysdale <drysdale@google.com> wrote:
> > Resending, adding cc:linux-api.
> >
> > Also, it may help to add a little more background -- this patch is
> > needed as a (small) part of implementing Capsicum in the Linux kernel.
> >
> > Capsicum is a security framework that has been present in FreeBSD since
> > version 9.0 (Jan 2012), and is based on concepts from object-capability
> > security [1].
> >
> > One of the features of Capsicum is capability mode, which locks down
> > access to global namespaces such as the filesystem hierarchy. In
> > capability mode, /proc is thus inaccessible and so fexecve(3) doesn't
> > work -- hence the need for a kernel-space
>
> I just found myself wanting this syscall for another reason: injecting
> programs into sandboxes or otherwise heavily locked-down namespaces.
>
> For example, I want to be able to reliably do something like nsenter
> --namespace-flags-here toybox sh. Toybox's shell is unusual in that
> it is more or less fully functional, so this should Just Work (tm),
> except that the toybox binary might not exist in the namespace being
> entered. If execveat were available, I could rig nsenter or a similar
> tool to open it with O_CLOEXEC, enter the namespace, and then call
> execveat.
>
> Is there any reason that these patches can't be merged more or less as
> is for 3.19?
>
> --Andy
>
> >
> > [1] http://www.cl.cam.ac.uk/research/security/capsicum/papers/2010usenix-security-capsicum-website.pdf
> >
> > ------
> >
> > This patch set adds execveat(2) for x86, and is derived from Meredydd
> > Luff's patch from Sept 2012 (https://lkml.org/lkml/2012/9/11/528).
> >
> > The primary aim of adding an execveat syscall is to allow an
> > implementation of fexecve(3) that does not rely on the /proc
> > filesystem. The current glibc version of fexecve(3) is implemented
> > via /proc, which causes problems in sandboxed or otherwise restricted
> > environments.
> >
> > Given the desire for a /proc-free fexecve() implementation, HPA
> > suggested (https://lkml.org/lkml/2006/7/11/556) that an execveat(2)
> > syscall would be an appropriate generalization.
> >
> > Also, having a new syscall means that it can take a flags argument
> > without back-compatibility concerns. The current implementation just
> > defines the AT_SYMLINK_NOFOLLOW flag, but other flags could be added
> > in future -- for example, flags for new namespaces (as suggested at
> > https://lkml.org/lkml/2006/7/11/474).
> >
> > Related history:
> > - https://lkml.org/lkml/2006/12/27/123 is an example of someone
> > realizing that fexecve() is likely to fail in a chroot environment.
> > - http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514043 covered
> > documenting the /proc requirement of fexecve(3) in its manpage, to
> > "prevent other people from wasting their time".
> > - https://bugzilla.kernel.org/show_bug.cgi?id=74481 documented that
> > it's not possible to fexecve() a file descriptor for a script with
> > close-on-exec set (which is possible with the implementation here).
> > - https://bugzilla.redhat.com/show_bug.cgi?id=241609 described a
> > problem where a process that did setuid() could not fexecve()
> > because it no longer had access to /proc/self/fd; this has since
> > been fixed.
> >
> >
> > Changes since Meredydd's v3 patch:
> > - Added a selftest.
> > - Added a man page.
> > - Left open_exec() signature untouched to reduce patch impact
> > elsewhere (as suggested by Al Viro).
> > - Filled in bprm->filename with d_path() into a buffer, to avoid use
> > of potentially-ephemeral dentry->d_name.
> > - Patch against v3.14 (455c6fdbd21916).
> >
> >
> > David Drysdale (2):
> > syscalls,x86: implement execveat() system call
> > syscalls,x86: add selftest for execveat(2)
> >
> > arch/x86/ia32/audit.c | 1 +
> > arch/x86/ia32/ia32entry.S | 1 +
> > arch/x86/kernel/audit_64.c | 1 +
> > arch/x86/kernel/entry_64.S | 28 ++++
> > arch/x86/syscalls/syscall_32.tbl | 1 +
> > arch/x86/syscalls/syscall_64.tbl | 2 +
> > arch/x86/um/sys_call_table_64.c | 1 +
> > fs/exec.c | 153 ++++++++++++++++---
> > include/linux/compat.h | 3 +
> > include/linux/sched.h | 4 +
> > include/linux/syscalls.h | 4 +
> > include/uapi/asm-generic/unistd.h | 4 +-
> > kernel/sys_ni.c | 3 +
> > lib/audit.c | 3 +
> > tools/testing/selftests/Makefile | 1 +
> > tools/testing/selftests/exec/.gitignore | 6 +
> > tools/testing/selftests/exec/Makefile | 32 ++++
> > tools/testing/selftests/exec/execveat.c | 251 ++++++++++++++++++++++++++++++++
> > 18 files changed, 476 insertions(+), 23 deletions(-)
> > create mode 100644 tools/testing/selftests/exec/.gitignore
> > create mode 100644 tools/testing/selftests/exec/Makefile
> > create mode 100644 tools/testing/selftests/exec/execveat.c
> >
> > --
> > 1.9.1.423.g4596e3a
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-api" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
> --
> Andy Lutomirski
> AMA Capital Management, LLC
> --
> To unsubscribe from this list: send the line "unsubscribe linux-api" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---
next prev parent reply other threads:[~2014-10-22 11:54 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-05 13:40 [PATCHv4 RESEND 0/3] syscalls,x86: Add execveat() system call David Drysdale
2014-06-05 13:40 ` [PATCHv4 RESEND 1/3] syscalls,x86: implement " David Drysdale
[not found] ` <1401975635-6162-2-git-send-email-drysdale-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2014-06-23 18:39 ` Kees Cook
2014-06-23 18:39 ` Kees Cook
2014-06-05 13:40 ` [PATCHv4 RESEND 2/3] syscalls,x86: add selftest for execveat(2) David Drysdale
2014-06-05 13:40 ` [PATCHv4 RESEND man-pages 3/3] execveat.2: initial man page " David Drysdale
2014-06-05 17:14 ` [PATCHv4 RESEND 0/3] syscalls,x86: Add execveat() system call Kees Cook
[not found] ` <1401975635-6162-1-git-send-email-drysdale-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2014-10-17 21:45 ` Andy Lutomirski
2014-10-17 21:45 ` Andy Lutomirski
2014-10-19 0:20 ` Eric W. Biederman
2014-10-19 0:20 ` Eric W. Biederman
2014-10-19 19:11 ` Andy Lutomirski
[not found] ` <87zjcszz8y.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-10-20 13:48 ` David Drysdale
2014-10-20 13:48 ` David Drysdale
[not found] ` <CAHse=S-Xyk7CFn=tAGzo+tuUFt+04aBw+mGQmi=kWAaBJGALBw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-20 22:48 ` Andy Lutomirski
2014-10-20 22:48 ` Andy Lutomirski
[not found] ` <CALCETrXBjLZTWVJfcsE4NA-JP9zSSgn=6ND0=cZ9BTy=CoN7pA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-21 4:29 ` Eric W. Biederman
2014-10-21 4:29 ` Eric W. Biederman
2014-10-21 4:29 ` Eric W. Biederman
[not found] ` <87ioje2ggq.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-10-22 11:08 ` David Drysdale
2014-10-22 11:08 ` David Drysdale
2014-10-22 17:40 ` Eric W. Biederman
2014-10-22 17:40 ` Eric W. Biederman
2014-10-27 18:01 ` David Drysdale
2014-10-19 20:20 ` Al Viro
[not found] ` <20141019202034.GH7996-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2014-10-19 20:37 ` Andy Lutomirski
2014-10-19 20:37 ` Andy Lutomirski
[not found] ` <CALCETrVZUW2iPtfFJtGnWd2RsYLwjGRGYuujrVqcOsO5oBB8Cg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-19 21:29 ` Al Viro
2014-10-19 21:29 ` Al Viro
[not found] ` <20141019212921.GI7996-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2014-10-19 22:16 ` Andy Lutomirski
2014-10-19 22:16 ` Andy Lutomirski
2014-10-19 22:42 ` Al Viro
2014-10-19 23:35 ` Andy Lutomirski
2014-10-25 21:22 ` Pavel Machek
2014-10-19 20:53 ` H. Peter Anvin
2014-10-19 20:53 ` H. Peter Anvin
2014-10-22 11:54 ` Christoph Hellwig [this message]
2014-10-22 11:54 ` Christoph Hellwig
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=20141022115405.GA8593@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=dalias@aerifal.cx \
--cc=drysdale@google.com \
--cc=ebiederm@xmission.com \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=meredydd@senatehouse.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
--cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.