lkml.org 
[lkml]   [2019]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH net-next v2] net: WireGuard secure network tunnel
On Wed, Dec 18, 2019 at 12:50 PM Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> Hi Dmitry,
>
> On Wed, Dec 18, 2019 at 12:37 PM Dmitry Vyukov <dvyukov@google.com> wrote:
> > > Actually with WireGuard, I think that's not the case. The WireGuard
> > > logging has been written with DoS in mind. You /should/ be able to
> > > safely run it on a production system exposed to the wild Internet, and
> > > while there will be some additional things in your dmesg, an attacker
> > > isn't supposed to be able to totally flood it without ratelimiting or
> > > inject malicious strings into it (such as ANSI escape sequence). In
> > > other words, I consider the logging to be fair game attack surface. If
> > > your fuzzer manages to craft some nasty sequence of packets that
> > > tricks some rate limiting logic and lets you litter all over dmesg
> > > totally unbounded, I'd consider that a real security bug worth
> > > stressing out about. So from the perspective of letting your fuzzers
> > > loose on WireGuard, I'd actually like to see this option kept on.
> >
> > This is the case even with CONFIG_WIREGUARD_DEBUG turned on, right? Or without?
>
> Turned on.
>
> > Well, it may be able to trigger unbounded printing, but that won't be
> > detected as a bug and won't be reported. To be reported it needs to
> > fall into a set of predefined bug cases (e.g. "BUG:" or "WARNING:" on
> > console). Unless of course it triggers total stall/hang.
>
> Bummer. Well, at least the stall case is interesting.
>
> > But I'm
> > afraid it will just dirty dmesg, make reading crashes harder and slow
> > down everything without benefit.
>
> Actually the point of the logging is usually to make it more obvious
> why a crash has come about, to provide some trail about the sequence
> of events. This was especially helpful in fixing old race conditions
> where subtle packet timing caused WireGuard's timer-based state
> machine to go haywire. Is syzkaller able to backtrack from crashes to
> the packets and packet timing that caused them, in order to make a
> test case to replay the crash?

Sometimes. You may sort by "Repro" column here to get the ratio:
https://syzkaller.appspot.com/upstream
https://syzkaller.appspot.com/upstream/fixed

> Is this precise enough for race
> condition bugs?

It's finding lots of race conditions provoked bugs (I would say it's
the most common cause of kernel bugs).

> If so, then when debugging the crashes I could always
> replay it later with logging turned on, in which case it might make
> sense to split out the debug logging into CONFIG_WIREGUARD_VERBOSE_LOG
> or similar (unless the logging itself changes the timing constraints
> and I can't repro that way). If this isn't possible, then it seems
> like logging might be something we would benefit from having in the
> crash reports, right? Or am I missing some other detail of how the
> system works?

Well, you are missing that wireguard is not the only subsystem
syzkaller tests (in fact, it does not test it at all) and there are
3000 other subsystems :)
If we enable verbose debug logging for all of them, we will get storm
of output and the wireguard logging you are interested in may simply
be evicted from the 1MB buffer. Also, the expected case is that a
program does not crash, in that case we waste performance for
unnecessary logging (and not finding bugs because of that).

In some cases there are reproducers, in some cases a bug is trivial to
debug based on the crash report (no tracing needed).

But additional debug checks are useful in any testing.

\
 
 \ /
  Last update: 2019-12-19 10:35    [W:0.102 / U:2.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site