Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Sep 2015 23:48:32 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 202933] unwanted behaviour change when writing to revoked terminals
Message-ID:  <bug-202933-8-ynvZvTHBB1@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-202933-8@https.bugs.freebsd.org/bugzilla/>
References:  <bug-202933-8@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=202933

--- Comment #1 from Alexandre Fenyo <fbsd.bugzilla@fenyo.net> ---
Hi,

I've found the kernel sources change that has modified this behaviour:

this is relative to base revision 273131 -
https://svnweb.freebsd.org/base?view=revision&revision=273131

This revision modifies /usr/src/sys/fs/devfs/devfs_vnops.c:devfs_write_f():

-------------------------------------------------------------------
        error = devfs_fp_check(fp, &dev, &dsw, &ref);
        if (error != 0)
                return (error);
-------------------------------------------------------------------
is replaced by:
-------------------------------------------------------------------
        error = devfs_fp_check(fp, &dev, &dsw, &ref);
        if (error != 0) {
                error = vnops.fo_write(fp, uio, cred, flags, td);
                return (error);
        }
-------------------------------------------------------------------

When a terminal is revoked, devfs_fp_check() returns ENXIO (6).
This is for instance the value used by rsyslog8 to handle this case correctly.

But with this modification, the kernel now returns EIO (5), that is the generic
error value returned by vnops.fo_write(), since fo_write() does not handle
specifically revoked terminals.

This behaviour change seems to be wanted, reading the svn log message:

    > read/write/poll/ioctl, call standard vnode filedescriptor fop.  This
    > restores the special handling for terminals by calling the deadfs VOP,
    > instead of always returning ENXIO for destroyed devices or revoked
    > terminals.
    >
    > Since destroyed (and not revoked) device would use devfs_specops VOP
    > vector, make dead_read/write/poll non-static and fill VOP table with
    > pointers to the functions, to instead of VOP_PANIC.

But some ports, at least, are waiting for ENXIO to reopen a device that has
been revoked, and they no longer work correctly because this kernel behaviour
changed (for instance, rsyslog8 now loops endlessly at end of boot sequence,
when /dev/console is revoked by getty).

So, this seems to be an ABI change between FreeBSD 10.1 and 10.2, but I wonder
if ABI changes should really occur in the same major branch (10-Release
branch).

I wonder if a special handling for revoked terminals, in devfs_write_f(),
should be made to continue to return ENXIO for revoked terminals, in 10-Release
branch at least.

What do you think of this proposal ?

Sincerely,

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-202933-8-ynvZvTHBB1>