Bug 241178 - makefs segfault when manifest include symlinks without the link keyword
Summary: makefs segfault when manifest include symlinks without the link keyword
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-RELEASE
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Ed Maste
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-10-10 12:41 UTC by Stéphane Rochoy
Modified: 2024-01-22 14:29 UTC (History)
1 user (show)

See Also:
emaste: mfc-stable13+


Attachments
link type require the link keyword (594 bytes, patch)
2019-10-10 12:41 UTC, Stéphane Rochoy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane Rochoy 2019-10-10 12:41:21 UTC
Created attachment 208226 [details]
link type require the link keyword

With a directory d/ containing the following 2 files:

    -rw-r--r--  1 root  wheel  14 Oct 10 11:55 hello.txt
    lrwxr-xr-x  1 root  wheel   9 Oct 10 11:55 world.txt -> hello.txt

using mtree to build a manifest as follow:

    mtree -ck mode -p ./d | mtree -C > no-link-kw.makefs-manifest

here is the resulting manifest:    
    
    . type=dir mode=0755
    ./hello.txt type=file mode=0644
    ./world.txt type=link mode=0755

running makefs as follow lead to segfault:

    cd d
    makefs -t ffs -o optimization=space -o version=2 ../no-link-kw.img ../no-link-kw.makefs-manifest

Attached is a small fix that ensure makefs will complain about the missing link keyword when facing a link type node.
Comment 1 commit-hook freebsd_committer freebsd_triage 2023-09-21 16:50:10 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d26c1a0f8bceb6748436fe3fc57bac3ef8179dd3

commit d26c1a0f8bceb6748436fe3fc57bac3ef8179dd3
Author:     Stéphane Rochoy <stephane.rochoy@stormshield.eu>
AuthorDate: 2023-09-21 07:14:20 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-09-21 16:49:11 +0000

    makefs: Handle missing link keyword in mtree spec

    PR:             241178
    Reviewed by:    emaste
    MFC after:      3 days
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/850

 usr.sbin/makefs/mtree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-09-24 13:20:48 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=be31bd59895e57fb7359de870ea3ecc19e3d1ae1

commit be31bd59895e57fb7359de870ea3ecc19e3d1ae1
Author:     Stéphane Rochoy <stephane.rochoy@stormshield.eu>
AuthorDate: 2023-09-21 07:14:20 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2023-09-24 13:17:43 +0000

    makefs: Handle missing link keyword in mtree spec

    PR:             241178
    Reviewed by:    emaste
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/850

    (cherry picked from commit d26c1a0f8bceb6748436fe3fc57bac3ef8179dd3)

 usr.sbin/makefs/mtree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Comment 3 Mark Linimon freebsd_committer freebsd_triage 2023-12-27 16:57:05 UTC
^Triage: set flag for possible mfc-stable13.
Comment 4 commit-hook freebsd_committer freebsd_triage 2024-01-22 14:29:12 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=d8d0ecd9739d5201c6d56d1a898b95f7ce35bdf5

commit d8d0ecd9739d5201c6d56d1a898b95f7ce35bdf5
Author:     Stéphane Rochoy <stephane.rochoy@stormshield.eu>
AuthorDate: 2023-09-21 07:14:20 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2024-01-22 14:28:57 +0000

    makefs: Handle missing link keyword in mtree spec

    PR:             241178
    Reviewed by:    emaste
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/850

    (cherry picked from commit d26c1a0f8bceb6748436fe3fc57bac3ef8179dd3)
    (cherry picked from commit be31bd59895e57fb7359de870ea3ecc19e3d1ae1)

 usr.sbin/makefs/mtree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)