Bug 243839

Summary: sys.capsicum.capsicum-test.main fails after r357412
Product: Base System Reporter: Li-Wen Hsu <lwhsu>
Component: testsAssignee: Kyle Evans <kevans>
Status: Closed FIXED    
Severity: Affects Only Me CC: emaste, kevans, testing
Priority: ---    
Version: CURRENT   
Hardware: Any   
OS: Any   
URL: https://reviews.freebsd.org/D23479

Description Li-Wen Hsu freebsd_committer freebsd_triage 2020-02-03 11:09:24 UTC
Please check https://ci.freebsd.org/job/FreeBSD-head-amd64-test/14174/testReport/junit/sys.capsicum/capsicum-test/main/ for the detailed failure message.
Comment 1 Ed Maste freebsd_committer freebsd_triage 2020-02-03 14:53:19 UTC
Example failure:

[ RUN      ] Capability.InheritanceForked
/usr/src/contrib/capsicum-test/capability-fd.cc:388: Failure
Expected equality of these values:
  93
  (* __error())
    Which is: 20
/usr/src/contrib/capsicum-test/capability-fd.cc:360: Failure
Expected equality of these values:
  0
  rc
    Which is: 1
[  FAILED  ] Capability.InheritanceForked (12 ms)

   387    file = openat(cap_dir, filename, O_WRONLY|O_APPEND);
   388    EXPECT_NOTCAPABLE(file);

errno 20 is ENOTDIR
Comment 2 Kyle Evans freebsd_committer freebsd_triage 2020-02-03 15:16:03 UTC
D23479 should fix this, but I don't have the capability (hehe) to run the capsicum tests at the moment.
Comment 3 Li-Wen Hsu freebsd_committer freebsd_triage 2020-02-03 16:49:49 UTC
I've tested D23479 and the test passed.
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-02-03 18:59:10 UTC
A commit references this bug:

Author: kevans
Date: Mon Feb  3 18:59:07 UTC 2020
New revision: 357461
URL: https://svnweb.freebsd.org/changeset/base/357461

Log:
  namei: preserve errors from fget_cap_locked

  Most notably, we want to make sure we don't clobber any capabilities-related
  errors. This is a regression from r357412 (O_SEARCH) that was picked up by
  the capsicum tests.

  PR:		243839
  Reviewed by:	kib (committed form recommended by)
  Tested by:	lwhsu
  Differential Revision:	https://reviews.freebsd.org/D23479

Changes:
  head/sys/kern/vfs_lookup.c
Comment 5 Kyle Evans freebsd_committer freebsd_triage 2020-02-03 19:06:08 UTC
Committed form was slightly different, but should preserve the error just as needed- thanks for confirming!
Comment 6 Ed Maste freebsd_committer freebsd_triage 2020-02-03 19:07:24 UTC
Thanks for the quick fix (and especially thanks to ngie for bringing the capsicum-test suite into contrib)