From: Andrew Morton <akpm@linux-foundation.org>
To: Joe Perches <joe@perches.com>
Cc: Kees Cook <keescook@chromium.org>,
linux-kernel@vger.kernel.org, Jiri Kosina <jkosina@suse.cz>,
Al Viro <viro@zeniv.linux.org.uk>,
Olof Johansson <olof@lixom.net>,
Stepan Moskovchenko <stepanm@codeaurora.org>,
Daniel Borkmann <dborkman@redhat.com>,
Ryan Mallon <rmallon@gmail.com>
Subject: Re: [PATCH] vsprintf: BUG on %n
Date: Mon, 27 Jan 2014 15:17:04 -0800 [thread overview]
Message-ID: <20140127151704.2a5b2d05e33cfd7a8f17896d@linux-foundation.org> (raw)
In-Reply-To: <1390864354.20150.57.camel@joe-AO722>
On Mon, 27 Jan 2014 15:12:34 -0800 Joe Perches <joe@perches.com> wrote:
> On Mon, 2014-01-27 at 15:03 -0800, Kees Cook wrote:
> > Now that there has been a full release of the kernel, and all users
> > of %n have been dropped, switch to %n use triggering a BUG. Ignoring
> > arguments could be used to assist in information leaks if an arbitrary
> > format string was under the control of an attacker.
> []
> > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> []
> > @@ -1735,15 +1735,12 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
> > case FORMAT_TYPE_NRCHARS: {
> > /*
> > * Since %n poses a greater security risk than
> > - * utility, ignore %n and skip its argument.
> > + * utility, it should not be implemented. Instead,
> > + * BUG when encountering %n, since there are no
> > + * legitimate users and skipping arguments could
> > + * assist information leak attacks.
> > */
> > - void *skip_arg;
> > -
> > - WARN_ONCE(1, "Please remove ignored %%n in '%s'\n",
> > - old_fmt);
> > -
> > - skip_arg = va_arg(args, void *);
> > - break;
> > + BUG();
>
> BUGs should be avoided where possible.
>
> I think using BUG here isn't necessary or good.
>
Good point(s).
In fact the patch makes the kernel less secure - it provides a way for
people to make the kernel crash if they a) are able to inject printk
control strings and b) don't know about %s ;)
prev parent reply other threads:[~2014-01-27 23:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-27 23:03 [PATCH] vsprintf: BUG on %n Kees Cook
2014-01-27 23:11 ` Ryan Mallon
2014-01-27 23:56 ` Kees Cook
2014-01-28 0:11 ` Ryan Mallon
2014-01-28 0:19 ` Kees Cook
2014-01-27 23:12 ` Joe Perches
2014-01-27 23:17 ` Andrew Morton [this message]
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=20140127151704.2a5b2d05e33cfd7a8f17896d@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dborkman@redhat.com \
--cc=jkosina@suse.cz \
--cc=joe@perches.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=olof@lixom.net \
--cc=rmallon@gmail.com \
--cc=stepanm@codeaurora.org \
--cc=viro@zeniv.linux.org.uk \
/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.