public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Robin Getz <rgetz@blackfin.uclinux.org>
Cc: "Alan Cox" <alan@lxorguk.ukuu.org.uk>,
	"David Howells" <dhowells@redhat.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"David Woodhouse" <dwmw2@infradead.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Dave Airlie" <airlied@linux.ie>,
	linux-arch@vger.kernel.org,
	"Andrew Morton" <akpm@linux-foundation.org>,
	Bernd Schmidt <bernds_cb1@t-online.de>
Subject: Re: [PATCH] Introduce compat_u64 and compat_s64 types
Date: Fri, 15 Jun 2007 23:22:06 +0200	[thread overview]
Message-ID: <200706152322.07739.ak@suse.de> (raw)
In-Reply-To: <200706151650.53481.rgetz@blackfin.uclinux.org>


> For the architecture we use (Blackfin), it does not support unaligned
> accesses, and we purposely never put in the trap/fixup code - we trap, and
> printk("fix your source");

For the kernel you should fix up too in addition to the printk. Otherwise
you risk a ping of death in the field with some more obscure protocol.
Also the printk should be load limited.

> > > people have done
> > > that work so using the types without unaligned.
> >
> > Very brave; we're talking about around half a million lines
> > of non trivial source code here.
>
> Is there something specific that you can think of that we should be
> testing?

A lot of protocols have variable length headers.  Normally everything
is aligned, but an attacker could purposefully misalign some headers
using variable length padding, causing fields in later headers to be 
misaligned.

e.g. the original reason this was forbidden was because the TCP
option parser could be tricked into reading time stamps unaligned.
That code is now using get_unaligned(), but there are probably
other culprits too (there is a lot of code in the network stack) 

Unfortunately it is hard to test all combinations, so the only safe 
alternative would be to audit source code. Another possibility would be to
use a tainted data scheme similar sparse's __user/__iomem annotations with
a static code checker (or extending sparse), but that would also require a lot 
of work to do properly and add the necessarily annotations.

Also watch out for netfilter modules -- they make all this much more 
complex. And drivers possibly too.

> We have done alot of testing, and people have shipped alot of systems
> connected to a varity of networks, and have run all kinds of protocols on
> them.

Well behaved peers normally don't generate unaligned headers. But
that doesn't mean it couldn't be exploited by someone malicious.

-Andi

  reply	other threads:[~2007-06-15 21:23 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200706150159.l5F1xNgM000459@hera.kernel.org>
2007-06-15  8:44 ` drm: fix radeon setparam on 32/64 bit systems David Woodhouse
2007-06-15  8:58   ` Benjamin Herrenschmidt
2007-06-15  9:28     ` Arnd Bergmann
2007-06-15  9:31       ` [PATCH] Introduce compat_u64 and compat_s64 types Arnd Bergmann
2007-06-15  9:55         ` David Miller
2007-06-15 11:55         ` Andi Kleen
2007-06-15 12:00           ` David Woodhouse
2007-06-15 12:38             ` Andi Kleen
2007-06-15 12:03           ` Arnd Bergmann
2007-06-15 12:40             ` Andi Kleen
2007-06-15 12:47               ` David Woodhouse
2007-06-15 13:19               ` Benjamin Herrenschmidt
2007-06-15 12:09           ` David Howells
2007-06-15 12:43             ` Andi Kleen
2007-06-15 12:54               ` Alan Cox
2007-06-15 12:54                 ` Andi Kleen
2007-06-15 13:15                   ` Alan Cox
2007-06-15 13:27                     ` Andi Kleen
2007-06-15 13:32                       ` David Woodhouse
2007-06-15 20:50                   ` Robin Getz
2007-06-15 21:22                     ` Andi Kleen [this message]
2007-06-16  8:31                       ` David Woodhouse
2007-06-15 13:00                 ` David Woodhouse
2007-06-15 12:11         ` Matthew Wilcox
2007-06-15 12:38           ` David Woodhouse
2007-06-15 12:42           ` Arnd Bergmann
2007-06-15 13:45             ` Matthew Wilcox
2007-06-15 13:52               ` Arnd Bergmann
2007-06-15 23:54               ` Benjamin Herrenschmidt
2007-06-15 13:16         ` Benjamin Herrenschmidt
2007-06-16  9:38         ` David Woodhouse
2007-06-16 10:26           ` Arnd Bergmann
2007-06-16 11:21             ` Arnd Bergmann
2007-06-16 11:34               ` David Woodhouse
2007-06-16 13:56                 ` Matthew Wilcox

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=200706152322.07739.ak@suse.de \
    --to=ak@suse.de \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arnd@arndb.de \
    --cc=benh@kernel.crashing.org \
    --cc=bernds_cb1@t-online.de \
    --cc=dhowells@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rgetz@blackfin.uclinux.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