Repository navigation
Commit 26cb63a
perf: Fix perf mmap bugs
Vince reported a problem found by his perf specific trinity
fuzzer.
Al noticed 2 problems with perf's mmap():
- it has issues against fork() since we use vma->vm_mm for accounting.
- it has an rb refcount leak on double mmap().
We fix the issues against fork() by using VM_DONTCOPY; I don't
think there's code out there that uses this; we didn't hear
about weird accounting problems/crashes. If we do need this to
work, the previously proposed VM_PINNED could make this work.
Aside from the rb reference leak spotted by Al, Vince's example
prog was indeed doing a double mmap() through the use of
perf_event_set_output().
This exposes another problem, since we now have 2 events with
one buffer, the accounting gets screwy because we account per
event. Fix this by making the buffer responsible for its own
accounting.
Reported-by: Vince Weaver <vincent.weaver@maine.edu>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Link: http://lkml.kernel.org/r/20130528085548.GA12193@twins.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>1 parent 7b959fc commit 26cb63a
3 files changed
Lines changed: 24 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
392 | | - | |
393 | | - | |
| 392 | + | |
394 | 393 | | |
395 | 394 | | |
396 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2917 | 2917 | | |
2918 | 2918 | | |
2919 | 2919 | | |
2920 | | - | |
| 2920 | + | |
2921 | 2921 | | |
2922 | 2922 | | |
2923 | 2923 | | |
| |||
3582 | 3582 | | |
3583 | 3583 | | |
3584 | 3584 | | |
3585 | | - | |
| 3585 | + | |
3586 | 3586 | | |
3587 | 3587 | | |
3588 | 3588 | | |
3589 | 3589 | | |
3590 | 3590 | | |
3591 | | - | |
| 3591 | + | |
3592 | 3592 | | |
3593 | 3593 | | |
3594 | 3594 | | |
| |||
3598 | 3598 | | |
3599 | 3599 | | |
3600 | 3600 | | |
| 3601 | + | |
3601 | 3602 | | |
3602 | 3603 | | |
3603 | 3604 | | |
| |||
3612 | 3613 | | |
3613 | 3614 | | |
3614 | 3615 | | |
3615 | | - | |
3616 | | - | |
3617 | 3616 | | |
| 3617 | + | |
| 3618 | + | |
| 3619 | + | |
3618 | 3620 | | |
3619 | | - | |
3620 | | - | |
3621 | 3621 | | |
3622 | 3622 | | |
3623 | 3623 | | |
3624 | 3624 | | |
3625 | | - | |
3626 | | - | |
| 3625 | + | |
| 3626 | + | |
| 3627 | + | |
| 3628 | + | |
| 3629 | + | |
3627 | 3630 | | |
3628 | 3631 | | |
3629 | 3632 | | |
| |||
3676 | 3679 | | |
3677 | 3680 | | |
3678 | 3681 | | |
3679 | | - | |
3680 | | - | |
3681 | | - | |
| 3682 | + | |
3682 | 3683 | | |
3683 | 3684 | | |
3684 | 3685 | | |
| |||
3720 | 3721 | | |
3721 | 3722 | | |
3722 | 3723 | | |
3723 | | - | |
| 3724 | + | |
| 3725 | + | |
| 3726 | + | |
3724 | 3727 | | |
3725 | 3728 | | |
3726 | | - | |
3727 | | - | |
3728 | | - | |
| 3729 | + | |
| 3730 | + | |
| 3731 | + | |
3729 | 3732 | | |
3730 | 3733 | | |
3731 | 3734 | | |
| |||
3734 | 3737 | | |
3735 | 3738 | | |
3736 | 3739 | | |
3737 | | - | |
| 3740 | + | |
3738 | 3741 | | |
3739 | 3742 | | |
3740 | 3743 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
0 commit comments