Development discussion of WireGuard
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: noloader@gmail.com
Cc: Netdev <netdev@vger.kernel.org>,
	 syzkaller-bugs <syzkaller-bugs@googlegroups.com>,
	 WireGuard mailing list <wireguard@lists.zx2c4.com>
Subject: Re: UBSAN: object-size-mismatch in wg_xmit
Date: Tue, 12 Jan 2021 10:54:20 +0100	[thread overview]
Message-ID: <CACT4Y+bt8p=e9czrEDVu2+HiFOxQe4pxr8AOdz_fP8tvvWh1FA@mail.gmail.com> (raw)
In-Reply-To: <CAH8yC8m_H_VLWaomSku62k4BhwjFCZTB0Td4s17Wtb7tAH5Lqw@mail.gmail.com>

On Mon, Jan 11, 2021 at 7:15 PM Jeffrey Walton <noloader@gmail.com> wrote:
> > > > ...
> > > > FTR, I've disabled the following UBSAN configs:
> > > > UBSAN_MISC
> > > > UBSAN_DIV_ZERO
> > > > UBSAN_BOOL
> > > > UBSAN_OBJECT_SIZE
> > > > UBSAN_SIGNED_OVERFLOW
> > > > UBSAN_UNSIGNED_OVERFLOW
> > > > UBSAN_ENUM
> > > > UBSAN_ALIGNMENT
> > > > UBSAN_UNREACHABLE
> > > >
> > > > Only these are enabled now:
> > > > UBSAN_BOUNDS
> > > > UBSAN_SHIFT
> > > >
> > > > This is commit:
> > > > https://github.com/google/syzkaller/commit/2c1f2513486f21d26b1942ce77ffc782677fbf4e
> > >
> > > I think the commit cut too deep.
> > >
> > > The overflows are important if folks are building with compilers other than GCC.
> > >
> > > The aligned data accesses are important on platforms like MIPS64 and Sparc64.
> > >
> > > Object size is important because it catches destination buffer overflows.
> > >
> > > I don't know what's in miscellaneous. There may be something useful in there.
> >
> > Hi Jeff,
> >
> > See the commit for reasons why each of these is disabled.
> > E.g. object size, somebody first needs to fix bugs like this one.
> > While things like skbuff have these UBs on trivial workloads, there is
> > no point in involving fuzzing and making it crash on this trivial bug
> > all the time and stopping doing any other kernel testing as the
> > result.
>
> Going off-topic a bit, what would you suggest for UBSAN_OBJECT_SIZE?
>
> It seems to me object size checking is being conflated with object
> type. It seems to me they need to be split: UBSAN_OBJECT_SIZE for
> actual object sizes, and UBSAN_OBJECT_TYPE for the casts.
>
> I still have a bitter taste in my mouth from
> https://www.cvedetails.com/bugtraq-bid/57602/libupnp-Multiple-Buffer-Overflow-Vulnerabilities.html.
> I hate to see buffer checks go away. (And I realize the kernel folks
> are more skilled than the guy who wrote libupnp).
>
> Jeff

I've filed https://bugs.llvm.org/show_bug.cgi?id=48726 for this. Does
it capture what you are asking? Let's move the discussion re ubsan
there.

However, in the first place I am suggesting fixing the code. E.g. for
sk_buff I would assume it's relatively easily fixable. A
formally legal fix I think should put sk_buff_head into sk_buff and
use it, no downsides and will eliminate the confusing "should go
first" comments.
Or as an workaround maybe we could make __skb_queue_before accept
sk_buff_head and cast the other way around.

  reply	other threads:[~2021-01-12  9:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-20 16:54 syzbot
2020-12-20 21:11 ` Jason A. Donenfeld
2020-12-21  9:14   ` Dmitry Vyukov
2020-12-21 11:23     ` Jason A. Donenfeld
2021-01-07 12:22       ` Dmitry Vyukov
2021-01-07 19:00         ` Jason A. Donenfeld
2021-01-07 19:06           ` Jeffrey Walton
2021-01-08  0:34             ` Corey Costello
2021-01-08  0:42               ` Eric Light
2021-01-08  0:44                 ` Corey Costello
2021-01-08  0:50                   ` Eric Light
2021-01-08  1:02                 ` Phillip McMahon
2021-01-08  9:33             ` Dmitry Vyukov
2021-01-08 20:54               ` Nathan Chancellor
2021-01-08  9:30           ` Dmitry Vyukov
     [not found]             ` <CAGXu5j+jzmkiU_AWoTVF6e263iYSSJYUHB=Kdqh-MCfEO-aNSg@mail.gmail.com>
2021-01-09  9:46               ` Dmitry Vyukov
2021-01-09 10:49                 ` Matthias Urlichs
2021-01-11 17:17                 ` Dmitry Vyukov
2021-01-11 17:35                   ` Jeffrey Walton
2021-01-11 17:58                     ` Dmitry Vyukov
2021-01-11 18:14                       ` Jeffrey Walton
2021-01-12  9:54                         ` Dmitry Vyukov [this message]
2021-01-07 12:53       ` Jeffrey Walton
2021-01-07 17:01       ` Julian Wiedmann
2021-01-07 18:58         ` Jason A. Donenfeld

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='CACT4Y+bt8p=e9czrEDVu2+HiFOxQe4pxr8AOdz_fP8tvvWh1FA@mail.gmail.com' \
    --to=dvyukov@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=noloader@gmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=wireguard@lists.zx2c4.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).