~lttng/lttng-ust/lttng-ust

  • Committer: Mathieu Desnoyers
  • Author(s): Olivier Dion
  • Date: 2023-08-12 17:14:58 UTC
  • Revision ID: git-v1:cf54f06a38ed1f3a2ac49236ffb1f1e7b3024d87
ustfork: Fix possible race conditions

Assuming that `dlsym(RTLD_NEXT, "symbol")' is invariant for "symbol",
then we could think that memory operations on the `plibc_func' pointers can
be safely done without atomics.

However, consider what would happen if a load to a`plibc_func' pointer
is torn apart by the compiler. Then a thread could see:

  1) NULL

  2) The stored value as returned by a dlsym() call

  3) A mix of 1) and 2)

The same goes for other optimizations that a compiler is authorized to
do (e.g. store tearing, load fusing).

One could question whether such race condition is even possible for the
clone(2) wrapper. Indeed, a thread must be cloned to get into
existence. Therefore, the main thread would always store the value of
`plibc_func' at least once before creating the first sibling thread,
preventing any possible race condition for this wrapper. However, this
assume that the main thread will not call the clone system call directly
before calling the libc wrapper! Thus, to be on the safe side, we do the
same for the clone wrapper.

Fix the race conditions by using the uatomic_read/uatomic_set functions,
on access to `plibc_func' pointers.

Change-Id: Ic4be25983b8836d2b333f367af9c18d2f6b75879
Signed-off-by: Olivier Dion <odion@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Filename Latest Rev Last Changed Committer Comment Size
..
doc 1169 12 years ago Mathieu Desnoyers Install easy-ust and gen-tp examples in doc/ Sign Diff
extras 2931 2 years ago Mathieu Desnoyers Add serialized ABI definition files This commit c Diff
include 243 14 years ago Pierre-Marc Fournier Merge branch 'for-pierre-marc' of git://git.infrad Diff
LICENSES 2538 3 years ago Mathieu Desnoyers Move to kernel style SPDX license identifiers The Diff
m4 2215 7 years ago Mathieu Desnoyers Move m4 scripts to m4 dir Harmonize build system Diff
src 2755 3 years ago Mathieu Desnoyers Move all sources to 'src/' This will align the so Diff
tests 117 14 years ago Pierre-Marc Fournier reorganize test programs into tests/ directory Diff
tools 1168 12 years ago Mathieu Desnoyers Create the lttng-gen-tp tools as an helper to gene Diff
.classpath 2960 2 years ago Mathieu Desnoyers Add basic Eclipse setup for log4j Change-Id: I2f4 2.3 KB Diff Download File
.gitignore 2991 1 year ago Mathieu Desnoyers Add more unit tests for possible_cpus_array_len C 7.3 KB Diff Download File
.gitreview 2351 4 years ago Mathieu Desnoyers Add git-review config Add .gitreview for contribu 123 bytes Diff Download File
.project 2960 2 years ago Mathieu Desnoyers Add basic Eclipse setup for log4j Change-Id: I2f4 368 bytes Diff Download File
File bootstrap 2538 3 years ago Mathieu Desnoyers Move to kernel style SPDX license identifiers The 133 bytes Diff Download File
ChangeLog 2903 3 years ago Mathieu Desnoyers Version 2.13.0-rc1 Signed-off-by: Mathieu Desnoye 85 KB Diff Download File
CodingStyle 2298 5 years ago Mathieu Desnoyers doc: remove repeated word in coding style Signed- 304 bytes Diff Download File
configure.ac 3019 11 months ago Mathieu Desnoyers fix: python agent: use stdlib distutils when setup 25 KB Diff Download File
CONTRIBUTING.md 2310 5 years ago Mathieu Desnoyers Fix: Update coding style link The documentation a 4.9 KB Diff Download File
LICENSE 2769 3 years ago Mathieu Desnoyers Move liblttng-ust-ctl to 'src/lib/' Move all publ 1.8 KB Diff Download File
Makefile.am 2931 2 years ago Mathieu Desnoyers Add serialized ABI definition files This commit c 445 bytes Diff Download File
README.md 2963 2 years ago Mathieu Desnoyers Add a Log4j 2.x Java agent This adds a new agent 8.9 KB Diff Download File