[Bug 217957] diff: Cannot create unified diffs when running under kern.trap_enotcap=1

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Mon Mar 20 16:19:29 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217957

            Bug ID: 217957
           Summary: diff: Cannot create unified diffs when running under
                    kern.trap_enotcap=1
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: tobik at freebsd.org

Created attachment 181005
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=181005&action=edit
diff.diff

This happens while running 'diff -u file1 file2' (file1 and file2 need
to actually differ).

After cap_enter() and after reading file1, diff(1) will try to open
the following files which isn't allowed in capability mode:

access("/etc/localtime",R_OK)                    ERR#94 'Not permitted in
capability mode'
issetugid()                                      = 0 (0x0)
open("/usr/share/zoneinfo/UTC",O_RDONLY,00)      ERR#94 'Not permitted in
capability mode'
issetugid()                                      = 0 (0x0)
open("/usr/share/zoneinfo/posixrules",O_RDONLY,06423226000) ERR#94 'Not
permitted in capability mode'

Unfortunately when kern.trap_enotcap=1 is accidentally still set, it
means diff will die immediately after access().

To workaround this we could initialize time conversion information with
tzset(3)
just before cap_enter().

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


More information about the freebsd-bugs mailing list