Bug 2227140
| Summary: | glibc: valgrind strcmp warning during getpwuid_r NSS function lookup in pcp tests | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 9 | Reporter: | Jan Kurik <jkurik> |
| Component: | glibc | Assignee: | glibc team <glibc-bugzilla> |
| Status: | CLOSED MIGRATED | QA Contact: | qe-baseos-tools-bugs |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 9.3 | CC: | ashankar, codonell, dj, fweimer, mcoufal, pfrankli, sipoyare, skolosov |
| Target Milestone: | rc | Keywords: | MigratedToJIRA, Triaged |
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-08-11 14:43:46 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Hitting this will depend on the values in the remainder of the page the string is on.
70 /* OK. We've hit the end of the string. We need to be careful that
71 we don't compare two strings as different because of gunk beyond
72 the end of the strings... */
73 #ifdef __LITTLE_ENDIAN__
74 L(endstring):
75 addi rTMP2, rTMP, -1
76 beq cr1, L(equal)
^^^^^^^^^^^^^^^^^^^^^
77 andc rTMP2, rTMP2, rTMP
78 rldimi rTMP2, rTMP2, 1, 0
79 and rWORD2, rWORD2, rTMP2 /* Mask off gunk. */
80 and rWORD1, rWORD1, rTMP2
81 cmpd cr1, rWORD1, rWORD2
82 beq cr1, L(equal)
83 xor rBITDIF, rWORD1, rWORD2 /* rBITDIF has bits that differ. */
Valgrind needs a suppression for this.
In the ppc64le strcmp.S code we compare potentially uninitialized data in the event that it is equal, but if it's not equal then we mask off the uninitialized bits. We don't waste the cycles doing the masking unless it compares unequal.
It's not exactly clear why upstream does this, there is a balance here between branch prediction and the cycles it takes to do the load and mask operation. Either this was cargo-culted from earlier implementations or this was verified to produce better performance.
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there. To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer. You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like: "Bugzilla Bug" = 1234567 In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. |
Description of problem: During testing of PCP a possible glibc bug has been discovered. PCP is using valgrind for some tests. One of these tests failed with the following valgrind log: > Conditional jump or move depends on uninitialised value(s) > at 0x4040410: strcmp (strcmp.S:76) > by 0x4017E1B: check_match (dl-lookup.c:88) > by 0x4017E1B: do_lookup_x (dl-lookup.c:447) > by 0x4BC707B: do_dlsym (in /usr/lib64/libc.so.6) > by 0x4BC6B97: _dl_catch_exception (in /usr/lib64/libc.so.6) > by 0x4BC6CA7: _dl_catch_error (in /usr/lib64/libc.so.6) > by 0x4030D87: _rtld_catch_error (dl-error-skeleton.c:260) > by 0x4BC7367: __libc_dlsym (in /usr/lib64/libc.so.6) > by 0x4B9C09F: module_load (in /usr/lib64/libc.so.6) > by 0x4B9C853: __nss_module_get_function (in /usr/lib64/libc.so.6) > by 0x4B9934F: __nss_lookup (in /usr/lib64/libc.so.6) > by 0x4B9AFB7: __nss_passwd_lookup2 (in /usr/lib64/libc.so.6) > by 0x4B12F5B: getpwuid_r@@GLIBC_2.17 (in /usr/lib64/libc.so.6) > { > <insert_a_suppression_name_here> > Memcheck:Cond > fun:strcmp > fun:check_match > fun:do_lookup_x > fun:do_dlsym > fun:_dl_catch_exception > fun:_dl_catch_error > fun:_rtld_catch_error > fun:__libc_dlsym > fun:module_load > fun:__nss_module_get_function > fun:__nss_lookup > fun:__nss_passwd_lookup2 > fun:getpwuid_r@@GLIBC_2.17 > } Version-Release number of selected component (if applicable): RHEL compose: RHEL-9.3.0-20230726.0 glibc: glibc-2.34-72.el9 valgrind: valgrind-3.21.0-7.el9 pcp: pcp-6.0.5-2.el9 How reproducible: Seen on aarch64 and ppc64le architectures only. I do not know how to directly reproduce this. This issue appeared during automated testing of PCP and I was not successful to reproduce it manually. Steps to Reproduce: 1. Unknown Actual results: A valdrind reports an issue in glibc. Expected results: No valgrind issues are reported. Additional info: