mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>, linux-kernel@vger.kernel.org
Subject: Re: Issue with 'lib/vsprintf.c: don't try to fix pointer wrap-around'
Date: Fri, 16 Jan 2015 21:42:21 +0100	[thread overview]
Message-ID: <87mw5izccy.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <20150116122404.e82eb86b5c46afdd0d00df1d@linux-foundation.org> (Andrew Morton's message of "Fri, 16 Jan 2015 12:24:04 -0800")

On Fri, Jan 16 2015, Andrew Morton <akpm@linux-foundation.org> wrote:

> On Fri, 16 Jan 2015 11:23:57 -0500 Johannes Weiner <hannes@cmpxchg.org> wrote:
>
>> Hi Rasmus,
>> 
>> I have trouble booting my test machine with this patch in -mm:
>> 
>> commit bb2e066c6943e62e9650bb129f416dacf138f8b1
>> Author: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>> Date:   Wed Jan 14 01:00:44 2015 +0000
>> 
>>     lib/vsprintf.c: don't try to fix pointer wrap-around
>>     
>>     Actual kernel buffers can't wrap into the user address space.  If someone
>>     manages to pass a buf/size combination that wraps, it is most likely due
>>     to a bug in the caller.  Instead of trying to fix it by using a smaller
>>     part of the buffer, bail out.
>>     
>>     Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>>     Cc: Jiri Kosina <jkosina@suse.cz>
>>     Cc: Randy Dunlap <rdunlap@infradead.org>
>>     Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
>> 
>> After I get "Loading bzImage-new... ok" from the bootloader, the
>> serial console remains quiet.
>> 
>> A WARN_ON_ONCE() inside vsnprintf() looks like it would deadlock
>> instantly when triggering this overflow from printk(), no?
>
> Dammit, I was starting at that printk, ended up deciding it was OK,
> didn't think about deadlocks.  logbuf_lock and recursion_bug, for a
> start...
>
> I'll drop the patch.

Good, because the bug is in my brain. I think the cause may be a sprintf
or vsprintf call that doesn't actually print what it is supposed to,
since they pass INT_MAX for size, and that can of course easily cause
buf+size to wrap-around (it is basically guaranteed on 32 bit).

Sorry about this. Thanks for reporting, Johannes.

Rasmus

      reply	other threads:[~2015-01-16 20:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16 16:23 Johannes Weiner
2015-01-16 20:24 ` Andrew Morton
2015-01-16 20:42   ` Rasmus Villemoes [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=87mw5izccy.fsf@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.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 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®