Page MenuHomeFreeBSD

Introduce kern_mmap_req().
ClosedPublic

Authored by brooks on Jan 14 2020, 5:19 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 14, 10:15 AM
Unknown Object (File)
Sun, Apr 14, 8:31 AM
Unknown Object (File)
Sun, Apr 14, 8:07 AM
Unknown Object (File)
Sun, Apr 14, 6:08 AM
Unknown Object (File)
Sun, Apr 14, 5:27 AM
Unknown Object (File)
Mar 12 2024, 6:02 AM
Unknown Object (File)
Mar 12 2024, 6:02 AM
Unknown Object (File)
Feb 5 2024, 7:34 AM
Subscribers

Details

Summary

This presents an extensible interface to the generic mmap(2)
implementation via a struct pointer intended to use a designated
initializer or compount literal. We take advantage of the mandatory
zeroing of fields not listed in the initializer.

Remove kern_mmap_fpcheck() and use kern_mmap_req().

The motivation for this change is a desire to keep the core
implementation from growing an ever-increasing number of arguments that
must be specified in the correct order for the lowest-level
implementations. In CheriBSD we have already added two more arguments.

Obtained from: CheriBSD

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 29784
Build 27618: arc lint + arc unit

Event Timeline

Compiles, but needs testing.

sys/compat/linux/linux_mmap.c
205

We could alternatively do the declaration above and assign with a compound literal here. Style(9) doesn't really have an opinion.

I've done limited testing (booted an amd64) system with this patch. I chose to remove kern_mmap_fpcheck entirely, but could restore it if that feels like a cleaner option.

I've done limited testing (booted an amd64) system with this patch. I chose to remove kern_mmap_fpcheck entirely, but could restore it if that feels like a cleaner option.

+1 for removing it completely; it's new, so there's not much sense in keeping it around when we have a better alternative. We'll call it a short-lived mistake. =-)

brooks added a reviewer: kib.

Overall this looks reasonable.

sys/compat/linux/linux_mmap.c
216–218

I do not see why mr_fixed needs to be defined there and not at the start of the function.
If you keep the declaration there, then the blank line is needed between it and later code.

sys/sys/mman.h
259 ↗(On Diff #66717)

Can the structure definition moved somewhere else ? mman.h is user-visible standard-defined header. Even hidden under #ifdef _KERNEL bits are not too good to add.

I was equally unhappy about struct shmfd appearing there.

  • Rebase
  • Use a compound literal to move decleration to the top of the function.
  • Move struct mmap_req to syscallsubr.h.
sys/compat/linux/linux_mmap.c
212

end line with comma, as we usually do ?

216–218

This comment is still relevant.

  • Declare mr_fixed a the top of the function.
  • Add comma
This revision is now accepted and ready to land.Mar 4 2020, 7:54 PM
This revision was automatically updated to reflect the committed changes.