]> git.lttng.org Git - lttng-ust.git/commit
fix: liblttng-ust-fd async-signal-safe close()
authorMichael Jeanson <mjeanson@efficios.com>
Tue, 9 Mar 2021 17:38:06 +0000 (12:38 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 9 Dec 2021 16:18:27 +0000 (11:18 -0500)
commitc668ba47b997cb8bc75771f4f06bb61161d25f31
treee8a07f8a935f01e2343e72d439e4132fff241288
parentf6a5ff0060ed12e71f5c7b046417d74ce90f3ae6
fix: liblttng-ust-fd async-signal-safe close()

"close(2)" is documented as async-signal-safe (see signal-safety(7)) and
as such our override function should also be. This means we shouldn't do
lazy initialization of the function pointer to the original libc close
symbol in the override function.

If we move the initialization of the function pointer in the library
constructor we risk breaking other constructors that may run before ours
and call close().

A compromise is to explicitly do the initialization in the constructor
but keep a lazy init scheme if close() is called before it is executed.

The dlsym call is now done only once, if it fails the wrappers will
return -1 and set errno to ENOSYS.

Change-Id: I05c66d2f5d51b2022c6803ca215340fb9c00f5a8
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
liblttng-ust-fd/lttng-ust-fd.c
This page took 0.028797 seconds and 4 git commands to generate.