[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrVtCDaVwYgL1GVC9d7KvOZcSPoR7CqCD_qRcKoYc42oGw@mail.gmail.com>
Date: Thu, 3 Aug 2017 17:37:22 -0700
From: Andy Lutomirski <luto@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Vince Weaver <vincent.weaver@...ne.edu>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Stephane Eranian <eranian@...il.com>
Subject: Re: perf: bug in rdpmc/mmap accounting after exec
On Wed, Aug 2, 2017 at 10:39 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> On Wed, Jul 26, 2017 at 03:39:01PM -0400, Vince Weaver wrote:
>> Hello
>>
>> so one last bug found by the PAPI testsuite.
>>
>> This one involves the rdpmc auto-disable on last unmap of an event
>> feature.
>>
>> Failing test case:
>>
>> fd=perf_event_open();
>> addr=mmap(fd);
>> exec() // without closing or unmapping the event
>> fd=perf_event_open();
>> addr=mmap(fd);
>> rdpmc() // GPFs due to rdpmc being disabled
>>
>> I won't pretend to be able to follow the rdpmc disabling code, but if I
>> add some printks it looks like
>> current->mm->context.perf_rdpmc_allowed
>> isn't properly being reset on exec?
>>
>> In fact, current->mm->context.perf_rdpmc_allowed goes negative which seems
>> like it shouldn't happen?
>>
>> Anyway, a test case for this can be found in the perf_event_tests,
>> tests/rdpmc/rdpmc_exec_papi
>
> Good find that...
>
> The below seems to fix that for me.
>
...because execve plays funny games with non-current mms. Whoops.
Reviewed-by: Andy Lutomirski <luto@...nel.org>
Can you send it upstream and tag it for stable?
Powered by blists - more mailing lists