RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 633174 - some guestfish sub commands can not handle special files properly
Summary: some guestfish sub commands can not handle special files properly
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libguestfs
Version: 6.1
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 582484 613593
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-09-13 05:28 UTC by Jinxin Zheng
Modified: 2015-09-28 02:23 UTC (History)
6 users (show)

Fixed In Version: libguestfs-1.7.17-4.el6
Doc Type: Bug Fix
Doc Text:
Some guestfish commands would hang when applied to non-regular files. This had some security implications in that a guest could replace regular configuration files with, for example, character devices, and cause virt-inspector and other programs to hang. guestfish commands have been modified and can now handle non-regular files. Additionally, virt-inspector has been rewritten as virt-inspector2, which is both more powerful, and more careful about untrusted files from the guest.
Clone Of: 582484
Environment:
Last Closed: 2011-05-19 11:44:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2011:0586 0 normal SHIPPED_LIVE Low: libguestfs security, bug fix, and enhancement update 2011-05-19 11:44:03 UTC

Description Jinxin Zheng 2010-09-13 05:28:05 UTC
Still exists in libguestfs-1.2.7-1.24.el6, so clone to RHEL6 to ensure it get fixed in RHEL 6.1.

+++ This bug was initially created as a clone of Bug #582484 +++

Description of problem:
1. guestfish "file" command can not handle character special files properly, it just hang when called againest a char special file.
2. guestfish "touch" command can not handle fifo special files properly, it also hang.
These two commands can work for other special devices like block special file.

Version-Release number of selected component (if applicable):
libguestfs-1.0.85-1.fc12.3.x86_64
And also the lastest git version

How reproducible:
100%

Steps to Reproduce:
1. Run guestfish, add an img containing some char/block/fifo special files
2. Run and mount the partition
3. "file /path_to_char-dev-file" , it will hang the guestfish shell.
4. Repeat step 1,2, then run "touch /path_to_fifo-dev-file", it will hang.
5. ll,stat commands works fine for these special files

Actual results:
guestfish hang

Expected results:
command should return proper value

Additional info:
check logs in the attachment:
guestfish-file-error01.log
guestfish-touch-error02.log

--- Additional comment from pcao on 2010-04-15 02:39:34 EDT ---

Created attachment 406688 [details]
log for file command

--- Additional comment from pcao on 2010-04-15 02:40:03 EDT ---

Created attachment 406689 [details]
log for touch command

--- Additional comment from rjones on 2010-04-15 04:24:22 EDT ---

I'll have a look at this when I get back from holiday.

--- Additional comment from rjones on 2010-06-04 10:37:55 EDT ---

Patches posted upstream to fix the issues with
the touch and file commands.

https://www.redhat.com/archives/libguestfs/2010-June/msg00050.html

--- Additional comment from rjones on 2010-06-08 09:32:57 EDT ---

This commit:

http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=4df593496e116dfb635731c058b7627e81fc179c

breaks OS detection, since /dev/VG/LV is a symbolic link to
../dm-NN.

Reopening this bug.

--- Additional comment from rjones on 2010-06-08 11:08:02 EDT ---

Second patch posted:

https://www.redhat.com/archives/libguestfs/2010-June/msg00068.html

--- Additional comment from rjones on 2010-06-08 13:01:39 EDT ---

Patch ACKed upstream:
http://git.annexia.org/?p=libguestfs.git;a=commitdiff;h=ba39ced8804765705f4c61a92db0fddb8d672c7d

Comment 1 Richard W.M. Jones 2010-11-24 09:10:40 UTC
Will be fixed by the rebase (bug 613593).

Comment 2 Richard W.M. Jones 2011-01-04 14:17:42 UTC
Fixed by the rebase.

Comment 4 Lei Wang 2011-01-21 07:09:13 UTC
Test steps:
1. Run guestfish, add image, run and mount.
2. Use "mkfifo 0644 /tmp/fifo-file" to create a FIFO file.
3. Verify the file created correctly via "ll /tmp/fifo-file".
4. Run "touch /tmp/fifo-file".
5. Rerun step 1.
6. Use "mknod-c 0644 1 6 /tmp/char-file" to create a character file.
7. Verify the file created correctly via "ll /tmp/char-file".
8. Run "file /tmp/char-file".

Could reproduce the bug with: libguestfs-1.2.7-1.24.el6
At step 4, the "touch" command hangs there.
At step 8, the "file" comamnd reports "writable, no read permission" though "ll" shows there's read permission.

Verity this bug with: libguestfs-1.7.17-10.el6
At step 4, the "touch" command failed with error message as below:
libguestfs: error: touch: /tmp/fifo-file: touch can only be used on a regular files.
At step 8, the "file" command returned right file type as below:
character device

According to the results above, move to VERIFIED.

Comment 7 Laura Bailey 2011-04-19 02:48:02 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Some guestfish commands would hang when applied to non-regular files. This had some security implications in that a guest could replace regular configuration files with, for example, character devices, and cause virt-inspector and other programs to hang. guestfish commands have been modified and can now handle non-regular files.

Additionally, the virt-inspector has been rewritten as virt-inspector2, which is both more powerful, and more careful about untrusted files from the guest.

Comment 8 Richard W.M. Jones 2011-04-19 07:40:46 UTC
Small change made to technical note.

Comment 9 Richard W.M. Jones 2011-04-19 07:40:46 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,3 +1,3 @@
 Some guestfish commands would hang when applied to non-regular files. This had some security implications in that a guest could replace regular configuration files with, for example, character devices, and cause virt-inspector and other programs to hang. guestfish commands have been modified and can now handle non-regular files.
 
-Additionally, the virt-inspector has been rewritten as virt-inspector2, which is both more powerful, and more careful about untrusted files from the guest.+Additionally, virt-inspector has been rewritten as virt-inspector2, which is both more powerful, and more careful about untrusted files from the guest.

Comment 11 errata-xmlrpc 2011-05-19 11:44:28 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0586.html

Comment 12 errata-xmlrpc 2011-05-19 13:10:30 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0586.html


Note You need to log in before you can comment on or make changes to this bug.