netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Petr Mladek <pmladek@suse.com>
Cc: "Kees Cook" <keescook@chromium.org>,
	"Richard Weinberger" <richard@nod.at>,
	linux-hardening@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Sergey Senozhatsky" <senozhatsky@chromium.org>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Jesper Dangaard Brouer" <hawk@kernel.org>,
	"John Fastabend" <john.fastabend@gmail.com>
Subject: Re: [RFC PATCH 0/1] Integer overflows while scanning for integers
Date: Thu, 8 Jun 2023 18:19:32 +0200	[thread overview]
Message-ID: <2023060820-atom-doorstep-9442@gregkh> (raw)
In-Reply-To: <ZIHzbBXlxEz6As9N@alley>

On Thu, Jun 08, 2023 at 05:27:40PM +0200, Petr Mladek wrote:
> On Wed 2023-06-07 16:36:12, Kees Cook wrote:
> > On Thu, Jun 08, 2023 at 12:37:54AM +0200, Richard Weinberger wrote:
> > > Hi!
> > > 
> > > Lately I wondered whether users of integer scanning functions check
> > > for overflows.
> > > To detect such overflows around scanf I came up with the following
> > > patch. It simply triggers a WARN_ON_ONCE() upon an overflow.
> > > 
> > > After digging into various scanf users I found that the network device
> > > naming code can trigger an overflow.
> > > 
> > > e.g:
> > > $ ip link add 1 type veth peer name 9999999999
> > > $ ip link set name "%d" dev 1
> > > 
> > > It will trigger the following WARN_ON_ONCE():
> > > ------------[ cut here ]------------
> > > WARNING: CPU: 2 PID: 433 at lib/vsprintf.c:3701 vsscanf+0x6ce/0x990
> > 
> > Hm, it's considered a bug if a WARN or BUG can be reached from
> > userspace,
> 
> Good point. WARN() does not look like the right way in this case.
> 
> Another problem is that some users use panic_on_warn. In this case,
> the above "ip" command calls would trigger panic(). And it does not
> look like an optimal behavior.

"some users" == "most major cloud providers and a few billion Android
phones"  So in pure numbers, the huge majority of Linux systems running
in the world have that option enabled.

So please don't use WARN() to catch issues that can be triggered by
userspace, that can cause data loss and worse at times.

thanks,

greg k-h

  parent reply	other threads:[~2023-06-08 16:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07 22:37 [RFC PATCH 0/1] Integer overflows while scanning for integers Richard Weinberger
2023-06-07 22:37 ` [RFC PATCH 1/1] vsprintf: Warn on integer scanning overflows Richard Weinberger
2023-06-08 14:27   ` Andy Shevchenko
2023-06-08 16:14     ` Richard Weinberger
2023-06-08 16:23       ` Andy Shevchenko
2023-06-12  6:16   ` kernel test robot
2023-06-07 23:36 ` [RFC PATCH 0/1] Integer overflows while scanning for integers Kees Cook
2023-06-08 15:27   ` Petr Mladek
2023-06-08 16:12     ` Richard Weinberger
2023-06-08 16:19     ` Greg KH [this message]
2023-06-08 16:23       ` Richard Weinberger
2023-06-09 10:10     ` Rasmus Villemoes
2023-06-09 17:02       ` Petr Mladek
2023-06-09 17:46         ` Linus Torvalds
2023-06-10 19:31       ` David Laight

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=2023060820-atom-doorstep-9442@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=alex.gaynor@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ast@kernel.org \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gary@garyguo.net \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=keescook@chromium.org \
    --cc=kuba@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=netdev@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pmladek@suse.com \
    --cc=richard@nod.at \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=wedsonaf@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).