Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Created attachment 1914471[details]
sem_timedwait.tar
In the sample reproducer it is expected to have the output:
thread_func_one loop 1
thread_func_two loop 1
thread_func_one loop 2
thread_func_two loop 2
thread_func_one loop 3
thread_func_two loop 3
thread_func_one loop 4
thread_func_two loop 4
thread_func_one loop 5
thread_func_two loop 5
thread_func_one loop 6
thread_func_two loop 6
thread_func_one loop 7
thread_func_two loop 7
thread_func_one loop 8
thread_func_two loop 8
thread_func_one loop 9
thread_func_one done
thread_func_two loop 9
thread_func_two done
data_one.count=0 data_one.other=0
data_two.count=0 data_two.other=0
Instead, it hangs.
The problem is that libasan is binding to the wrong sem_init symbol.
It is binding to __old_sem_init instead of __new_sem_init.
The issue should be due to libasan not choosing the symbol from
libpthread.
A workaround is to play with the way __new_sem_init works, for example.
use the pseudo patch:
-sem_init(&sem_one, 0,1);
+sem_init(&sem_one, 0,2);
This is due to glibc code:
...
__new_sem_init (sem_t *sem, int pshared, unsigned int value)
...
#if __HAVE_64B_ATOMICS
isem->data = value;
#else
isem->value = value << SEM_VALUE_SHIFT;
/* pad is used as a mutex on pre-v9 sparc and ignored otherwise. */
isem->pad = 0;
isem->nwaiters = 0;
#endif
...
SEM_VALUE_SHIFT is one.
There is COMMON_INTERCEPT_FUNCTION_GLIBC_VER_MIN macro that can be used instead of COMMON_INTERCEPT_FUNCTION, but it is used only for a few interceptors, I'm afraid i?86-linux needs far more than that.
readelf -Ws /lib/libc.so.6 | grep '[^@]@[^@]' | grep -v GLIBC_PRIVATE | awk '{print $NF}' | sort -u
shows a lot of symbols.
Of course not everything is intercepted etc.
Created attachment 1914471 [details] sem_timedwait.tar In the sample reproducer it is expected to have the output: thread_func_one loop 1 thread_func_two loop 1 thread_func_one loop 2 thread_func_two loop 2 thread_func_one loop 3 thread_func_two loop 3 thread_func_one loop 4 thread_func_two loop 4 thread_func_one loop 5 thread_func_two loop 5 thread_func_one loop 6 thread_func_two loop 6 thread_func_one loop 7 thread_func_two loop 7 thread_func_one loop 8 thread_func_two loop 8 thread_func_one loop 9 thread_func_one done thread_func_two loop 9 thread_func_two done data_one.count=0 data_one.other=0 data_two.count=0 data_two.other=0 Instead, it hangs. The problem is that libasan is binding to the wrong sem_init symbol. It is binding to __old_sem_init instead of __new_sem_init. The issue should be due to libasan not choosing the symbol from libpthread. A workaround is to play with the way __new_sem_init works, for example. use the pseudo patch: -sem_init(&sem_one, 0,1); +sem_init(&sem_one, 0,2); This is due to glibc code: ... __new_sem_init (sem_t *sem, int pshared, unsigned int value) ... #if __HAVE_64B_ATOMICS isem->data = value; #else isem->value = value << SEM_VALUE_SHIFT; /* pad is used as a mutex on pre-v9 sparc and ignored otherwise. */ isem->pad = 0; isem->nwaiters = 0; #endif ... SEM_VALUE_SHIFT is one.