Page MenuHomeFreeBSD

Allow mmap operations for CAPH_READ and CAPH_WRITE.
AbandonedPublic

Authored by delphij on Jan 22 2019, 4:49 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 29, 1:21 PM
Unknown Object (File)
Sat, Dec 28, 2:03 PM
Unknown Object (File)
Fri, Dec 27, 6:02 PM
Unknown Object (File)
Dec 3 2024, 6:05 AM
Unknown Object (File)
Nov 22 2024, 2:41 AM
Unknown Object (File)
Nov 21 2024, 1:57 AM
Unknown Object (File)
Nov 7 2024, 8:05 PM
Unknown Object (File)
Oct 27 2024, 4:41 PM
Subscribers

Details

Reviewers
oshogbo
markj
pjd
Group Reviewers
secteam
capsicum
Summary

Allow mmap operations for CAPH_READ and CAPH_WRITE on streams.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22071
Build 21299: arc lint + arc unit

Event Timeline

Is this some common pattern?

Yes, this was actually exposed by rS343117 where a later restriction was performed on the same stdin stream that would have allowed mmap'ed operations. While stdin itself doesn't really allow mmap, for the more generic file operation case, because we already allowed CAP_SEEK, it seems to be reasonable to just allow mmap'ed operation at the same time.

Is this some common pattern?

Yes, this was actually exposed by rS343117 where a later restriction was performed on the same stdin stream that would have allowed mmap'ed operations. While stdin itself doesn't really allow mmap, for the more generic file operation case, because we already allowed CAP_SEEK, it seems to be reasonable to just allow mmap'ed operation at the same time.

Sorry for the delay, I did not see the initial email for this review.

As we discussed in email, I don't really like this because it's extraneous to the API. It lets us fix cmp(1), but only because cmp(1) happens to use mmap() for regular files instead of the stream abstraction. CAP_MMAP_* lets one play games with the VM, you can do things like replace an existing mapping or very quickly dirty pages.

cmp(1) should really use separate sets of rights for the special (streams) and !special (mmap) cases. It is a bit tricky because the !special case will fall back to using streams if mmap() fails. I'm not yet sure how best to deal with this.

I won't block this patch, but I think it's the wrong direction.

Sorry for taking a while to get back to this. I have an alternate patch at D19216.