| Summary: | opkg double free when reproducibile builds enabled | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Richard Purdie <richard.purdie> | ||||
| Component: | devtools / tool chain | Assignee: | Alejandro del Castillo <alejandro.delcastillo> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | High | CC: | alejandro.delcastillo, meta.mr.watcher, meta.watcher, randy.macleod | ||||
| Version: | 3.0 | ||||||
| Target Milestone: | 3.1 M1 | ||||||
| Hardware: | x86 | ||||||
| OS: | Multiple | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |||||
| Attachments: |
|
||||||
|
Description
Richard Purdie
2019-11-18 12:35:00 UTC
I had some fun with this: a) you have to realise that opkg doesn't print errors if it aborts, it has them stored in a buffer which it never prints. b) the double free comes from opkg_archive:open_inner's err_cleanup call c) when you account for a), its printing open_inner: Failed to open inner archive: Unrecognized archive format d) the double free is because inner_close was already called on the buffer by libarchive e) the underlying problem is the ipk in question has a 0 size data.tar, package attached. Created attachment 4588 [details]
Package which reproduces the build failure
FWIW a fix for the double free is probably:
diff --git a/libopkg/opkg_archive.c b/libopkg/opkg_archive.c
index 1e8c9d1..3c9c89c 100644
--- a/libopkg/opkg_archive.c
+++ b/libopkg/opkg_archive.c
@@ -620,7 +621,7 @@ static struct archive *open_inner(struct archive *outer)
if (r != ARCHIVE_OK) {
opkg_msg(ERROR, "Failed to open inner archive: %s\n",
archive_error_string(inner));
- goto err_cleanup;
+ return NULL;
}
return inner;
Fixed upstream (opkg). There were 2 issues: - Opkg wasn't handling empty payloads - Libarchive errors caused a double free Commits f22b35 open_inner: add support for empty payloads 23ed947 opkg_archive.c: avoid double free on uncompress error |