public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [perf] yet another 32/64-bit range check failure
@ 2014-04-23  3:40 Vince Weaver
  2014-04-23  4:14 ` Vince Weaver
  2014-04-23 10:22 ` Peter Zijlstra
  0 siblings, 2 replies; 11+ messages in thread
From: Vince Weaver @ 2014-04-23  3:40 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Thomas Gleixner, Peter Zijlstra


More fun found by the perf_fuzzer...

In kernel/events/core.c 
SYSCALL_DEFINE5(perf_event_open,

We check if flags is valid like this:

        /* for future expandability... */
        if (flags & ~PERF_FLAG_ALL)
                return -EINVAL;

but flags is a 64-bit value but ~PERF_FLAG_ALL is 32-bit.

This means values like 0x800000000000ULL are treated as valid even though 
they aren't.

This is allowing events to be allocated memory but not being freed somehow
before returning EINVAL (a memory leak).
At least it looks like this is happening in the huge traces I have trying 
to track down the perf_fuzzer memory corruption bug.

I'd send a patch to fix the above, but it's late and I can't figure out 
where exactly to stick ULL to get PERF_FLAG_ALL to be upgraded to 64-bit.

Vince

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-05-19 12:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-23  3:40 [perf] yet another 32/64-bit range check failure Vince Weaver
2014-04-23  4:14 ` Vince Weaver
2014-04-23 10:10   ` Peter Zijlstra
2014-04-23 13:33     ` Vince Weaver
2014-04-23 10:22 ` Peter Zijlstra
2014-04-23 14:14   ` Vince Weaver
2014-04-23 14:37     ` Vince Weaver
2014-04-24 21:14   ` Vince Weaver
2014-05-15  5:07     ` Vince Weaver
2014-05-15  8:37       ` Peter Zijlstra
2014-05-19 12:55   ` [tip:perf/core] perf: Fix perf_event_open(.flags) test tip-bot for Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox