From: Eric Paris <eparis@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Kees Cook <keescook@chromium.org>, Will Drewry <wad@chromium.org>,
Richard Weinberger <richard@nod.at>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
libseccomp-discuss@lists.sourceforge.net,
Russell King <linux@arm.linux.org.uk>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [libseccomp-discuss] ARM audit, seccomp, etc are broken wrt OABI syscalls
Date: Wed, 06 Nov 2013 10:32:31 -0500 [thread overview]
Message-ID: <1383751951.28218.64.camel@flatline.rdu.redhat.com> (raw)
In-Reply-To: <CALCETrUt7Ojh5Yy4KYgBPj_wBr=fzKKJ=OOgGP9BtXoKrr9QnA@mail.gmail.com>
On Tue, 2013-11-05 at 14:36 -0800, Andy Lutomirski wrote:
> [cc: some ARM people]
>
> After a bit of an adventure, I got QEMU working. (Linux 3.12's smc91x
> driver and qemu 1.6 don't get along. It would be great if some
> kernel.org page described a standard way to boot a modern Linux image
> on a modern QEMU version, but I digress.)
>
> The current state of affairs is unhealthy. I wrote a program
> (attached) that does 'svc $0x90002f' (silly GNU syntax for "Issue the
> getgid syscall in OABI"). The registers I program are:
>
> r0: 1
> r1: 2
> r2: 3
> r3: 4
> r4: 5
> r5: 6
>
> (i.e. the arguments are 1,2,3,4,5,6, although getgid ignores them)
>
> r7: 1
>
> (r7 is the EABI syscall register. On a kernel without OABI support,
> the immediate svc argument is ignored and syscall 1, i.e. _exit, will
> be invoked).
>
> Seccomp sees the registers as I set them (unsurprisingly) and it sees
> nr == 0x2f. It passes those values on to a SIGSYS handler, if one
> exists. This is, IMO, bad. The OABI and EABI argument passing
> conventions are *not* the same, and seccomp filters that check syscall
> argument values may be spoofable by using OABI calls.
>
> I suspect that audit, perf, ftrace, and maybe even ptrace are broken
> as well for exactly the same reason.
>
> I would argue that there are two reasonable fixes:
>
> 1. Set a different audit arch for OABI syscalls (e.g.
> AUDIT_ARCH_ARMOABI). That is, treat OABI syscall entries the same way
> that x86_64 treats int 80.
As the audit maintainer, I like #1. It might break ABI, but the ABI is
flat wrong now and not maintainable...
>
> 2. Leave the 0x900000 bits set in the syscall nr. That way OABI
> syscalls would look like a different set of syscalls on the same
> architecture. That is, treat OABI syscall entries kind of like x86_64
> treats x32 syscalls. (There's probably no reason to accept 0x900000 +
> N as an r7 value to cause 'svc 0' to invoke OABI syscall N, though.)
>
> 3. Unconditionally kill any process that makes an OABI syscall with
> seccomp enabled (because there should be no such programs). Eww.
>
> Options 1 and 2 are both break ABI, but I doubt that anythink cares.
> OABI is, AFAICT, mostly dead. That being said, even if nothing
> legitimate uses OABI, exploits against seccomp-using programs can
> certainly use OABI, so I think that this needs to be fixed somehow.
>
> Thoughts? I think I prefer option 1. I don't really want to make the
> change because my ARM assembly skills are lacking.
> ------------------------------------------------------------------------------
> November Webinars for C, C++, Fortran Developers
> Accelerate application performance with scalable programming models. Explore
> techniques for threading, error checking, porting, and tuning. Get the most
> from the latest Intel processors and coprocessors. See abstracts and register
> http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
> _______________________________________________
> libseccomp-discuss mailing list
> libseccomp-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/libseccomp-discuss
next prev parent reply other threads:[~2013-11-06 15:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 22:36 Andy Lutomirski
2013-11-06 0:14 ` Kees Cook
2013-11-06 0:40 ` Russell King - ARM Linux
2013-11-06 3:22 ` Andy Lutomirski
2013-11-07 12:55 ` Henrique de Moraes Holschuh
2013-11-07 17:54 ` Kees Cook
2013-11-07 19:04 ` Henrique de Moraes Holschuh
2013-11-06 9:52 ` Mikael Pettersson
2013-11-06 22:30 ` Matt Sealey
2013-11-06 22:33 ` Andy Lutomirski
2013-11-06 15:32 ` Eric Paris [this message]
2013-11-06 15:51 ` [libseccomp-discuss] " Russell King - ARM Linux
2013-11-06 21:20 ` Will Drewry
2013-11-06 21:26 ` Kees Cook
2013-11-06 21:49 ` Andy Lutomirski
2013-11-06 22:17 ` Russell King - ARM Linux
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=1383751951.28218.64.camel@flatline.rdu.redhat.com \
--to=eparis@redhat.com \
--cc=keescook@chromium.org \
--cc=libseccomp-discuss@lists.sourceforge.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=luto@amacapital.net \
--cc=richard@nod.at \
--cc=wad@chromium.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
all inboxes | Powered by JetHome®