diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-09-12 10:15:26 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-09-12 10:15:26 -0400 |
commit | d7f45af802330a0e1450afa05185d3722e77a76c (patch) | |
tree | 4eb79fcc0ad80db68625e7412866c7d400e09402 /debian | |
parent | 3218dc9db8fc2affeae2fb563db0fc07a55a59de (diff) | |
download | e2fsprogs-d7f45af802330a0e1450afa05185d3722e77a76c.tar.gz |
libcom_err: Use sem_post/sem_init to prevent race conditions
SuSE has been carrying a patch for a long time to prevent a largely
theoretical race condition if a multi-threaded application adds and
removes error tables in multiple threads. Unfortunately SuSE's
approach breaks compatibility by forcing applications to link and
compile with the -pthread option; using pthread mutexes has
historically been problematic.
This commit fixes things in a more portable way by using
sem_post/sem_wait instead, which is an older interface that doesn't
require the pthreads library. Linux happens to implement
sem_post/sem_init using futexes, and -lrt ends up pulling in
-lpthread, but the advantage of using POSIX semaphores is that
applications don't have to be built using -pthread, unlike the use of
pthread mutexes.
The add_error_table() and remove_error_table() interfaces are the
preferred interfaces and locking protection have been added to only
these interfaces. I have not added locking protection to the
generated initialize_xxx_error_table and initialize_xxx_error_table_r
interfaces, to avoid adding symbol dependencies that would cause a
library to fail to work when linking against older com_err libraries
that do not export et_list_lock() and et_list_unlock(). Threaded
applications shouldn't be using these interfaces in any case.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'debian')
-rw-r--r-- | debian/libcomerr2.symbols | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/debian/libcomerr2.symbols b/debian/libcomerr2.symbols index 0072f355..77da3306 100644 --- a/debian/libcomerr2.symbols +++ b/debian/libcomerr2.symbols @@ -9,6 +9,8 @@ libcom_err.so.2 libcomerr2 #MINVER# com_right@Base 1.34 error_message@Base 1.01 error_table_name@Base 1.01 + et_list_lock@Base 1.41.2 + et_list_unlock@Base 1.41.2 free_error_table@Base 1.34 init_error_table@Base 1.01 initialize_error_table_r@Base 1.34 |