Re: [PATCH 04/16] perf, mmap: Factor out perf_get_fd()
From: Robert Richter
Date: Tue Apr 29 2014 - 11:34:12 EST
On 25.04.14 16:52:05, Peter Zijlstra wrote:
> But no, I don't think that helps, its still true that the moment you get
> a fd another thread can immediately close(). That would drop the last
> ref and free it, meanwhile perf_event_open() is happily poking at it.
>
> Now I think you could cure this by adding an extra ref before calling
> your perf_get_fd() and dropping that extra ref at the end, where we used
> to have fd_install().
Yes, right. I have a solution now which increments the event's ref
count before creating the file descriptor using try_get_event()/
put_event().
The patch also does not remove get_unused_fd_flags() and the err_fd
error handler.
Have an update already of a rebase version but still need to test it.
Would it be ok to split the patch set and send in a first step only
the first 4 patches that refactor the perf mmap code?
Thanks,
-Robert
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/