Bug 1280029
Summary: | libguestfs can run commands with stdin not open (or worse still, connected to arbitrary guest-chosen random devices) | |||
---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Kashyap Chamarthy <kchamart> | |
Component: | libguestfs | Assignee: | Richard W.M. Jones <rjones> | |
Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | |
Severity: | unspecified | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 23 | CC: | awilliam, dcaroest, jshubin, kparal, lbrabec, mbooth, ptoscano, rbalakri, rjones, virt-maint | |
Target Milestone: | --- | Keywords: | Reopened | |
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Unspecified | |||
Whiteboard: | ||||
Fixed In Version: | libguestfs-1.30.5-2.fc23 libguestfs-1.30.5-2.fc22 | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1280034 (view as bug list) | Environment: | ||
Last Closed: | 2015-12-06 01:22:06 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
Kashyap Chamarthy
2015-11-10 19:10:10 UTC
The minimal reproducer is just: $ virt-builder fedora-23 --update I can reproduce this with virt-builder 1.31.24. I feel justified in saying this is a dnf bug. It shouldn't use sys.stdin.isatty without checking that sys.stdin != None. https://bugzilla.redhat.com/show_bug.cgi?id=1280034 However there is also a bug in libguestfs! It turns out when running external commands, we do: chroot ("/sysroot"); close (0); open ("/dev/null"); /* opens as stdin */ execlp ("dnf", "dnf", "update", NULL); Unfortunately if /dev/null doesn't exist inside the guest chroot, this means that fd 0 will not be connected to anything. I was going to say this is a security hole, but since the 'dnf' command is already under the control of the guest, it doesn't seem to be. *** Bug 1280288 has been marked as a duplicate of this bug. *** *** Bug 1280290 has been marked as a duplicate of this bug. *** Fixed with https://github.com/libguestfs/libguestfs/commit/fd2f175ee79d29df101d353e2f380db27b19553a which is in libguestfs >= 1.31.28. Can we please have the fix backported to stable releases too? We (QA) really need either this fix or the DNF fix in F23, it's screwing with our ability to produce images for openQA testing. (In reply to awilliam from comment #7) > Can we please have the fix backported to stable releases too? We (QA) really > need either this fix or the DNF fix in F23, it's screwing with our ability > to produce images for openQA testing. We had a screw-up with libguestfs 1.30.5 which is going to take a bit of time to fix and go through testing (bug 1285847). Can we fix dnf instead? It looks as if your patch for dnf was accepted upstream. yeah, DNF sent an update out today - hopefully that one will work. rwmj: won't you have to re-generate the virt-builder 'template' image to include the updated DNF? Hmm, that is indeed true. Let's put reassign this bug to Fedora to fix libguestfs instead. Couple of builds running here which, if they complete, should contain this fix: http://koji.fedoraproject.org/koji/taskinfo?taskID=11995814 (f23) http://koji.fedoraproject.org/koji/taskinfo?taskID=11995817 (f22) both failed on x86_64. Stupid patch program doesn't set the executable bit on new files. libguestfs-1.30.5-2.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-943e9fb63b libguestfs-1.30.5-2.fc22 has been submitted as an update to Fedora 22. https://bodhi.fedoraproject.org/updates/FEDORA-2015-1bf4cbf156 libguestfs-1.30.5-2.fc22 has been pushed to the Fedora 22 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with $ su -c 'dnf --enablerepo=updates-testing update libguestfs' You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-1bf4cbf156 libguestfs-1.30.5-2.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report. If you want to test the update, you can install it with $ su -c 'dnf --enablerepo=updates-testing update libguestfs' You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-943e9fb63b *** Bug 1286996 has been marked as a duplicate of this bug. *** A new virt-builder Fedora 23 image has been uploaded that includes dnf-1.1.4-2.fc23. https://github.com/libguestfs/libguestfs/commit/59ea51d358e4e4d8c8ef6535760fcfc9bfe0a3a3 libguestfs-1.30.5-2.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report. libguestfs-1.30.5-2.fc22 has been pushed to the Fedora 22 stable repository. If problems still persist, please make note of it in this bug report. |