Bug 2143040
| Summary: | valgrind Test 3012 fails for curl because memmove is seen as memcopy | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Siddhesh Poyarekar <sipoyare> |
| Component: | valgrind | Assignee: | Mark Wielaard <mjw> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 38 | CC: | dodji, fweimer, jakub, jchecahi, kdudka, lzaoral, mjw, mjw, msekleta, paul, svashisht |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | valgrind-3.21.0-2.fc38 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2023-05-10 01:40:49 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: | |||
|
Description
Siddhesh Poyarekar
2022-11-15 21:37:59 UTC
Mark, this might interest you since it's likely that curl is all good and valgrind is acting funny. This most likely is upstream bug https://bugzilla.redhat.com/show_bug.cgi?id=2143040 "memcheck/tests/overlap testcase fails, memcpy seen as memmove" where because of how valgrind handles ifuncs it looks like memmove is handled as if it is memcpy. I assume the _chk variants are (badly) intercepted the same way. I checked the source code of curl-7.86.0-2.fc38 and there is indeed `memmove(copy, p, strlen(p) + 1)` on line 301 in curl-7.86.0/src/tool_cb_hdr.c which should be safe when source and destination overlap. I am switching the component to vaglrind. Mark, there seems to be a copy/paste mistake in comment #2 - the URL points to this bug rather than an upstream bug. (In reply to Kamil Dudka from comment #3) > Mark, there seems to be a copy/paste mistake in comment #2 - the URL points > to this bug rather than an upstream bug. Doh. Sorry. Should be: https://bugs.kde.org/show_bug.cgi?id=402833 "memcheck/tests/overlap testcase fails, memcpy seen as memmove" (In reply to Kamil Dudka from comment #3) > I checked the source code of curl-7.86.0-2.fc38 and there is indeed > `memmove(copy, p, strlen(p) + 1)` on line 301 in > curl-7.86.0/src/tool_cb_hdr.c which should be safe when source and > destination overlap. I am switching the component to vaglrind. On the curl front, we probably need to figure out what to do until the valgrind bug gets fixed, since that valgrind bug looks pretty old. I'm hoping to propose building with _FORTIFY_SOURCE=3 systemwide in Fedora and this bug may prevent curl from being built out of the box. > On the curl front, we probably need to figure out what to do until the valgrind bug gets fixed We can easily disable valgrind for a specific test case like this: https://src.fedoraproject.org/rpms/curl/c/768ce396 FWIW, replacing the malloc+memcpy sequence with strndup gets rid of the problem. I wonder why curl avoids strndup though, since the omission seems deliberate. I think they avoid strndup() because of portability. Upstream supports curl on weird platforms. They have even their own implementation of strdup():
https://github.com/curl/curl/blob/master/src/tool_strdup.c
ELN builds of curl started to fail because of this bug:
https://koji.fedoraproject.org/koji/taskinfo?taskID=95974757
I have temporarily disabled valgrind for test3012 of curl:
https://src.fedoraproject.org/rpms/curl/c/04ebed546a2129a215ef7f8db67b906b7bcb6f12?branch=rawhide
I renamed this bug to make it a bit more clear what is going on. Unfortunately there has been no progress getting this bug fixed upstream. It is a little tricky when the ifunc for memcpy and memmove point to the same address. I'll see if I can disable the overlap checking at least when this situation occurs. This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle. Changing version to 38. FEDORA-2023-db81140761 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-db81140761 FEDORA-2023-db81140761 has been pushed to the Fedora 38 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-db81140761` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-db81140761 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates. FEDORA-2023-db81140761 has been pushed to the Fedora 38 stable repository. If problem still persists, please make note of it in this bug report. |