Bug 2110622
| Summary: | file crashes during rpm build | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Vít Ondruch <vondruch> | ||||
| Component: | file | Assignee: | Vincent Mihalkovič <vmihalko> | ||||
| Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
| Severity: | urgent | Docs Contact: | |||||
| Priority: | unspecified | ||||||
| Version: | 37 | CC: | fweimer, jkaluza, jprokop, kdudka, mhroncok, odubaj, svashisht, vmihalko | ||||
| Target Milestone: | --- | ||||||
| Target Release: | --- | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Whiteboard: | |||||||
| Fixed In Version: | file-5.42-4.fc37 | Doc Type: | If docs needed, set a value | ||||
| Doc Text: | Story Points: | --- | |||||
| Clone Of: | Environment: | ||||||
| Last Closed: | 2022-08-09 13:48:43 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: | |||||||
| Attachments: |
|
||||||
|
Description
Vít Ondruch
2022-07-25 17:24:35 UTC
Just FTR, the last Rawhide build in Koschei did not suffer this issue: https://koschei.fedoraproject.org/build/13266483 Glibc might be the other possibility, because there seems to have been done some string related changes in 2.35.9000-30. Therefore I am adding Florian on CC. And FTR, there are some upstream changes in the related code. Not sure if that changes anything: https://github.com/file/file/commit/c80065fe6900be5e794941e29b32440e9969b1c3 This makes almost everything FTBFS. Let's untag it? I've opened https://pagure.io/releng/issue/10923 (In reply to Miro Hrončok from comment #3) > This makes almost everything FTBFS. Let's untag it? I have not tried older version of file myself, therefore I don't know it this is the right thing to do. valgrind reports this for the reproducer:
==78== Invalid write of size 8
==78== at 0x10A902: UnknownInlinedFun (file.c:533)
==78== by 0x10A902: main (file.c:275)
==78== Address 0x4aa2540 is 0 bytes after a block of size 800 free'd
==78== at 0x48476AF: realloc (vg_replace_malloc.c:1437)
==78== by 0x10A8EA: UnknownInlinedFun (file.c:529)
==78== by 0x10A8EA: main (file.c:275)
==78== Block was alloc'd at
==78== at 0x484286F: malloc (vg_replace_malloc.c:381)
==78== by 0x10A873: UnknownInlinedFun (file.c:510)
==78== by 0x10A873: main (file.c:275)
Quoting from file.c in file-5.42-3.fc37:
while ((len = getline(&line, &llen, f)) > 0) {
if (line[len - 1] == '\n')
line[len - 1] = '\0';
if (fi >= fimax) {
fimax += 100;
char **nf = realloc(flist, fimax * sizeof(*flist));
if (nf == NULL)
goto out;
}
flist[fi++] = line;
cwid = file_mbswidth(ms, line);
if (cwid > wid)
wid = cwid;
line = NULL;
llen = 0;
}
realloc invalidates flist; the assignment to nf is missing. So if fi >= fimax, things go quite wrong here. The reproducer has 126 lines, and fimax is 100, so this is all quite consistent.
Introduced upstream by: https://github.com/file/file/commit/19bf47777d0002ee884467e45e6ace702e40a4c1 I don't see a fix yet.
I'll try to patch this up.
Florian, do you build this in a side tag with the older file, or shall I do that? Never mind me, I see now you tagged it it rawhide, and building in https://koji.fedoraproject.org/koji/taskinfo?taskID=90080517 Yeah, side tag didn't seem necessary because its own file list is short enough. Thank you fweimer for solving this problem with lightning speed. I am sorry, I should have added a self-build test (https://src.fedoraproject.org/rpms/redhat-rpm-config/c/71f61e78a9061c908bae45d6d718cea7657761b7) and saved not only yours but everyone's time. This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle. Changing version to 37. (In reply to Vincent Mihalkovič from comment #10) > Thank you fweimer for solving this problem with lightning speed. > > I am sorry, I should have added a self-build test > (https://src.fedoraproject.org/rpms/redhat-rpm-config/c/ > 71f61e78a9061c908bae45d6d718cea7657761b7) and saved not only yours but > everyone's time. The self-rebuild was fine. You'd have to test-build a couple larger packages. Martin Cermak maintains a scratch-build-based package rebuild test for toolchain packages, maybe we could reuse that for the file package as well. |