]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix fget_only_user() to return ENOTCAPABLE on a failed capsicum check
authorAlex Richardson <arichardson@FreeBSD.org>
Mon, 15 Feb 2021 22:09:33 +0000 (22:09 +0000)
committerAlex Richardson <arichardson@FreeBSD.org>
Mon, 15 Feb 2021 22:55:12 +0000 (22:55 +0000)
commit0482d7c9e944433abc98fc27a265ae762abce9a0
treed1de1bcd220809fddaf1c96aa29e2dd4f7d11e22
parenta7b42c4b7f7ad7bd1b22ab57ed9185bdcea6f0a2
Fix fget_only_user() to return ENOTCAPABLE on a failed capsicum check

After eaad8d1303da500ed691bd774742a4555a05e729 four additional
capsicum-test tests started failing. It turns out this is because
fget_only_user() was returning EBADF on a failed capsicum check instead
of forwarding the return value of cap_check_inline() like
fget_unlocked_seq().

capsicum-test failures before this:
```
[  FAILED  ] 7 tests, listed below:
[  FAILED  ] Capability.OperationsForked
[  FAILED  ] Capability.NoBypassDAC
[  FAILED  ] Pdfork.OtherUserForked
[  FAILED  ] PipePdfork.WildcardWait
[  FAILED  ] OpenatTest.WithFlag
[  FAILED  ] ForkedOpenatTest_WithFlagInCapabilityMode._
[  FAILED  ] Select.LotsOFileDescriptorsForked
```
After:
```
[  FAILED  ] 3 tests, listed below:
[  FAILED  ] Capability.NoBypassDAC
[  FAILED  ] Pdfork.OtherUserForked
[  FAILED  ] PipePdfork.WildcardWait
```

Reviewed By: mjg
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D28691
sys/kern/kern_descrip.c