[lttng-dev] [PATCH lttng-ust] Fix: fd of an elf object must be registered to the fd tracker
Jonathan Rajotte-Julien
jonathan.rajotte-julien at efficios.com
Fri Nov 10 16:10:28 UTC 2017
On Fri, Nov 10, 2017 at 02:02:07PM +0000, Mathieu Desnoyers wrote:
> > @@ -312,9 +321,15 @@ error:
> > if (elf) {
> > free(elf->ehdr);
> > if (elf->fd >= 0) {
> > - if (close(elf->fd)) {
> > + lttng_ust_lock_fd_tracker();
> > + ret = close(elf->fd);
> > + if (!ret) {
> > + lttng_ust_delete_fd_from_tracker(elf->fd);
> > + } else {
> > + PERROR("close");
> > abort();
> > }
> > + lttng_ust_lock_fd_tracker();
>
> This appears to be a double-lock.
I was testing you... more seriously good catch.
>
> How did you test this code path ?
I did not test the error path. Will be more careful in the future.
v2 simplify all of this by using lttng_ust_elf_destroy directly.
Cheers
More information about the lttng-dev
mailing list