Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1477498

Re: perf: out-of-bounds write in perf_callchain_store

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Dmitry Vyukov <dvyukov@google.com>
Newsgroups linux.kernel
Subject Re: perf: out-of-bounds write in perf_callchain_store
Date Tue, 06 Sep 2016 17:20:01 +0200
Message-ID <seqkh-3Gd-1@gated-at.bofh.it> (permalink)
References <seoVd-2EA-45@gated-at.bofh.it> <sepHz-3dy-1@gated-at.bofh.it> <sepRg-3ha-33@gated-at.bofh.it> <sepRg-3ha-31@gated-at.bofh.it> <seqaC-3Da-37@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=eVCyPvd+1ZC8bVpYldILaTOVqvibfYPpwoxFVM8orlo=; b=HlHMcEK+CeQaqIEDvuLDti9EBww2kA4r9D1kkMoBsNa+k2RWaGUU5bt+ANR4fmWvpv 1Gt9pNBvf11D04jhwqEYhpJ2TzjhF8FfQLwD21K5SSFvkZDiOAEgaP2JBRzJ4BBEf4T7 vG1iNlcLFi02zXOESc0M6h2aSLaRHsS2eEVyMIUgZB5RvF+FGM47wlAl8AXYIaIL1Ccw 9XaBb0M3SIhOr3kdoXDf3aQBoLeB6XzYBWCX8SrANPDpsIpOa8xqL3VvSTxXjjKTHY2a IFE/HaNtpslrZr9Hxnh/9nvpzcH1cW8wUi10PKhjt565Gv5vFgx1rnktXukzCYvVAwpe HJRQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=eVCyPvd+1ZC8bVpYldILaTOVqvibfYPpwoxFVM8orlo=; b=g/0H/7cTiebRWOiDvwl3r6ro1G3VBMG1TgTTkaznwLmU2+LS4+e3VAxlcgcPSh/Za7 TH05mR1moRYXCnbmP2JiOewgUisGw119OB3/Tu0RWFDbxu8jLKlA+PclVFw66gsQ8Wxn e1kFoaYqf5fRi7+jQwIOxEEqX+bPKAK+k+G0ECbjQt1UHztqY2DhlzJ3DBLdf9RQxCgO RF79QJkhSzN3VlrqSc7Uj3kRPZ/SqgYaGzKpccHFq7TNl7QjA+cyuzSWQ8I0zuOpbIMc /lMMnq48xnR5NFvmwEbKTU8ZdaA3h1Jm1t/Fa8BPx/h+8VURRr4rcj0eSIWEYfNNPgYn 4ROg==
X-Gm-Message-State AE9vXwNeLaSlSZe3JcDUase1QvL7GCBBdKR2/LE4P6F7VxHmSYm9f+rli9gfI3Fqk9wvlBLleeVkWXV+yYwgevFj
X-Received by 10.46.33.222 with SMTP id h91mr1330851lji.46.1473175157227; Tue, 06 Sep 2016 08:19:17 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 57
Organization linux.* mail to news gateway
X-Original-Cc Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Thomas Gleixner <tglx@linutronix.de>, "H. Peter Anvin" <hpa@zytor.com>, "x86@kernel.org" <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
X-Original-Date Tue, 6 Sep 2016 17:18:56 +0200
X-Original-Message-ID <CACT4Y+aT9N=wv91PVAyOwD9g5vhNY623m-pdaUowVP2BoixW6Q@mail.gmail.com>
X-Original-References <CACT4Y+Yuiwvhn-+v0B+cVVWgS-Nki+BysvUbATDg-p+98Vwo2A@mail.gmail.com> <20160906143608.GF3318@worktop.controleur.wifipass.org> <20160906144434.GB11557@kernel.org> <CACT4Y+YmwoJUkd3aU6u2v+W3s2AXn=qwB=cAN3wAWCA5JL4psA@mail.gmail.com> <20160906150507.GD11557@kernel.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1477498

Show key headers only | View raw


On Tue, Sep 6, 2016 at 5:05 PM, Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
> Em Tue, Sep 06, 2016 at 04:49:29PM +0200, Dmitry Vyukov escreveu:
>> On Tue, Sep 6, 2016 at 4:44 PM, Arnaldo Carvalho de Melo
>> <acme@kernel.org> wrote:
>> > Em Tue, Sep 06, 2016 at 04:36:08PM +0200, Peter Zijlstra escreveu:
>> >> On Tue, Sep 06, 2016 at 03:42:40PM +0200, Dmitry Vyukov wrote:
>> >> > Hello,
>> >> >
>> >> > The following program trigger an out-of-bounds write in
>> >> > perf_callchain_store (if run in a parallel loop):
>> >> >
>> >> > https://gist.githubusercontent.com/dvyukov/c05d883e776a353a1d063b670f50bde6/raw/1c8906b1aacfbd8a0cc0b5cf0cc4d0535345e497/gistfile1.txt
>> >> >
>> >> >
>> >> > BUG: KASAN: slab-out-of-bounds in perf_callchain_user+0xe65/0xfc0 at
>> >> > addr ffff88003e162840
>> >> > Write of size 8 by task syz-executor/22516
>> >> > CPU: 0 PID: 22516 Comm: syz-executor Not tainted 4.8.0-rc5-next-20160905+ #14
>> >> > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
>> >> >  ffffffff886b6fe0 ffff88003ec07738 ffffffff82db81a9 ffffffff00000000
>> >> >  fffffbfff10d6dfc ffff88003e800a00 ffff88003e161740 ffff88003e163740
>> >> >  0000000000000001 ffff88003e162840 ffff88003ec07760 ffffffff8180b2ec
>> >> > Call Trace:
>> >> >  [<ffffffff8180b9c7>] __asan_report_store8_noabort+0x17/0x20
>> >> > mm/kasan/report.c:332
>> >> >  [<     inline     >] perf_callchain_store include/linux/perf_event.h:1146
>> >> >  [<ffffffff81014925>] perf_callchain_user+0xe65/0xfc0 arch/x86/events/core.c:2441
>> >> >  [<ffffffff816c5f48>] get_perf_callchain+0x448/0x680 kernel/events/callchain.c:235
>> >> >  [<ffffffff816c62cd>] perf_callchain+0x14d/0x1a0 kernel/events/callchain.c:191
>> >>
>> >> Urgh, that callchain code is a pain with that context/entries
>> >> separation. But I can't see an obvious overrun there.
>> >>
>> >> But WTF is max_contexts a sysctl? that doesn't seen to make any kind of
>> >> sense.
>> >>
>> >> Acme, can you untangle that stuff and spot the fail?
>> >
>> > I looked at it briefly some moments ago, couldn't find it so far, have
>> > to look at what was behind adding a sysctl for that :-\
>> >
>> > And yeah, that entry/ctx thing, IIRC, was done to reduce patch size,
>> > probably needs some polishing to become clearer.
>>
>>
>> I believe fuzzer wasn't messing with sysctl's.
>> But, yeah, I guess it's really bad idea to try to change them on a
>> running system.
>
> Why? They start with a reasonable value, but that is not ok for all
> cases, thus they were introduced, and they only can get changed if there
> are _no_ callchain users, so what would be the problem?


Sorry, I missed the "they only can get changed if there are _no_
callchain users" part.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

perf: out-of-bounds write in perf_callchain_store Dmitry Vyukov <dvyukov@google.com> - 2016-09-06 15:50 +0200
  Re: perf: out-of-bounds write in perf_callchain_store Peter Zijlstra <peterz@infradead.org> - 2016-09-06 16:40 +0200
    Re: perf: out-of-bounds write in perf_callchain_store Dmitry Vyukov <dvyukov@google.com> - 2016-09-06 16:50 +0200
      Re: perf: out-of-bounds write in perf_callchain_store Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-06 17:10 +0200
        Re: perf: out-of-bounds write in perf_callchain_store Dmitry Vyukov <dvyukov@google.com> - 2016-09-06 17:20 +0200
      Re: perf: out-of-bounds write in perf_callchain_store Peter Zijlstra <peterz@infradead.org> - 2016-09-06 18:10 +0200
    Re: perf: out-of-bounds write in perf_callchain_store Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-09-06 16:50 +0200

csiph-web