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 1749860 - mkisofs should not create hardlinked directories
Summary: mkisofs should not create hardlinked directories
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: cdrkit
Version: 8.0
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: 8.0
Assignee: Jiri Kucera
QA Contact: qe-baseos-daemons
Depends On:
TreeView+ depends on / blocked
Reported: 2019-09-06 15:18 UTC by Frank Sorenson
Modified: 2023-09-07 20:33 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2021-03-12 21:12:56 UTC
Type: Bug
Target Upstream Version:

Attachments (Terms of Use)

Description Frank Sorenson 2019-09-06 15:18:09 UTC
Description of problem:

    Certain directory structures inside the directory from which the iso is created can result in mkisofs creating hardlinked directories.

    hardlinked directories should never be created.

Version-Release number of selected component (if applicable):

    all versions

How reproducible:

    easy; see steps below

Steps to Reproduce:

    # cd /var/tmp
    # mkdir -p iso_root/dir{1,2,3}
    # mkdir -p iso_root/dir3/subdir
    # touch iso_root/dir1/testfile{1,2,3}
    # mount -obind iso_root/dir1 iso_root/dir2
    # mount -obind iso_root/dir3 iso_root/dir3/subdir

    # mkisofs -o out.iso -fRJ iso_root

    # mount -oloop out.iso /mnt/tmp >/dev/null 2>&1

    # ls -lid /mnt/tmp/dir1 /mnt/tmp/dir2 /mnt/tmp/dir3 /mnt/tmp/dir3/subdir

Actual results:

    # ls -lid /mnt/tmp/dir1 /mnt/tmp/dir2 /mnt/tmp/dir3 /mnt/tmp/dir3/subdir
    1856 drwxr-xr-x. 2 root root 2048 Sep  5 13:43 /mnt/tmp/dir1
    1856 drwxr-xr-x. 2 root root 2048 Sep  5 13:43 /mnt/tmp/dir2
    1984 drwxr-xr-x. 3 root root 2048 Sep  5 10:27 /mnt/tmp/dir3
    1984 drwxr-xr-x. 3 root root 2048 Sep  5 10:27 /mnt/tmp/dir3/subdir

    this results in two instances of hardinked directories:
    both dir1 and dir2 have the same inode
    both dir3 and dir3/subdir have the same inode, so this is a true directory loop

    when mounted in linux, depending on the kernel running on the system on which the iso is mounted, the kernel may return EIO when a second (or 3rd+) is encountered, or may silently handle the duplicated inode.

Expected results:

    hardlinked directories should never be created

    mkisofs should refuse to create hardlinked directories with a fatal error.

    Alternately, mkisofs could transform subsequent instances of a directory into a symlink to the first, or perhaps create a second directory, but still hardlink the file contents

Additional info:

    an alternate way to create the root (without bind mounts) is the following:
    # mkdir -p iso_root/release-{1.0,1.1,1.2,latest}
    # mount server:/exports/rpms/rpms-1.0 iso_root/release-1.0
    # mount server:/exports/rpms/rpms-1.1 iso_root/release-1.1
    # mount server:/exports/rpms/rpms-1.2 iso_root/release-1.2
    # mount server:/exports/rpms/rpms-1.2 iso_root/release-latest

    release-1.2 and release-latest will both have the same inode

    note that bz1749390 has also been raised to address some in-kernel handling of the duplicate directory inodes in some rhel 7 kernels

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