On current/amd64, fsdb(8) fails like this:

        # fsdb -f /dev/rsd0l
        ** /dev/rsd0l
        Editing file system `/dev/rsd0l'
        Last Mounted on /usr/xenocara
        current inode: directory
        I=2 MODE=40755 SIZE=512
                MTIME=Aug  8 19:27:56 2016 [0 nsec]
                CTIME=Aug  8 19:27:56 2016 [0 nsec]
                ATIME=Aug  8 19:27:56 2016 [0 nsec]
        OWNER=root GRP=wheel LINKCNT=2 FLAGS=0 BLKCNT=4 GEN=f3a7fd9
        Abort trap (core dumped)

ktrace says it's a pledge fault:

        [...]
        97279 fsdb     NAMI  "/root/.terminfo"
        97279 fsdb     PLDG  stat, "rpath", errno 1 Operation not permitted
        97279 fsdb     PSIG  SIGABRT SIG_DFL code <2036643296>
        97279 fsdb     NAMI  "fsdb.core"


fsdb(8) uses fsck(8) code to do its work (as mentioned in the manpage).
Apparently, the pledge(2) setup of fsdb(8) is done in fsck_ffs/setup.c;
while probably correct for fsck, this seems to be what makes fsdb crash:

        if (!hotroot()) {
#ifndef SMALL
                if (pledge("stdio getpw", NULL) == -1)
                        err(1, "pledge");
#else
                if (pledge("stdio", NULL) == -1)
                        err(1, "pledge");
#endif

(There is a more generous pledge above that, this is a restriction.)
I don't know what SMALL fsck is and what hotroot means exactly,
so I will leave a proper fix to someone else,
but disabling those lines makes fsdb not crash.

        Jan

Reply via email to