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


Groups > linux.kernel > #1456478

Re: NULL ptr deref in perf/filter_match

From Vegard Nossum <vegard.nossum@gmail.com>
Newsgroups linux.kernel
Subject Re: NULL ptr deref in perf/filter_match
Date 2016-08-04 17:20 +0200
Message-ID <s2sBc-2wI-3@gated-at.bofh.it> (permalink)
References <rZxQJ-ug-1@gated-at.bofh.it> <s0nPk-1RL-17@gated-at.bofh.it> <s2q6m-DV-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 4 August 2016 at 14:37, Peter Zijlstra <peterz@infradead.org> wrote:
> On Fri, Jul 29, 2016 at 11:41:11PM +0200, Vegard Nossum wrote:
>
>> Digging a bit deeper into this, it seems the event itself is getting
>> created by perf_event_open() and it gets added to the pmu_event_list
>> through:
>>
>> perf_event_open()
>>  - perf_event_alloc()
>>     - account_event()
>>        - account_pmu_sb_event()
>>           - attach_sb_event()
>>
[...]
>> So I guess the question is... should the event be attached (= put on
>> the list) before ->ctx gets set? Or should the cgroup code check for a
>> NULL ->ctx?
>
> Does this fix it? Ordering is a bit of a mess, adding the events to the
> list _after_ they've been installed has the risk of missing things I
> think, nor does that result in particularly nice code.
>
> Then again, this isn't pretty either.

Patch seems to fix it here, thanks! Feel free to add:

Tested-by: Vegard Nossum <vegard.nossum@oracle.com>


Vegard

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


Thread

NULL ptr deref in perf/filter_match Vegard Nossum <vegard.nossum@gmail.com> - 2016-07-27 16:20 +0200
  Re: NULL ptr deref in perf/filter_match Vegard Nossum <vegard.nossum@gmail.com> - 2016-07-29 23:50 +0200
    Re: NULL ptr deref in perf/filter_match Vegard Nossum <vegard.nossum@gmail.com> - 2016-07-30 00:40 +0200
    Re: NULL ptr deref in perf/filter_match Peter Zijlstra <peterz@infradead.org> - 2016-08-04 14:40 +0200
      Re: NULL ptr deref in perf/filter_match Vegard Nossum <vegard.nossum@gmail.com> - 2016-08-04 17:20 +0200
        Re: NULL ptr deref in perf/filter_match Vegard Nossum <vegard.nossum@gmail.com> - 2016-08-04 18:00 +0200
          Re: NULL ptr deref in perf/filter_match Peter Zijlstra <peterz@infradead.org> - 2016-08-04 18:10 +0200
          Re: NULL ptr deref in perf/filter_match Vince Weaver <vincent.weaver@maine.edu> - 2016-08-08 22:10 +0200
            Re: NULL ptr deref in perf/filter_match Vegard Nossum <vegard.nossum@gmail.com> - 2016-08-09 08:20 +0200
      [tip:perf/core] perf/core: Fix sideband list-iteration vs. event  ordering NULL pointer deference crash tip-bot for Peter Zijlstra <tipbot@zytor.com> - 2016-08-10 21:50 +0200

csiph-web