Page MenuHomeFreeBSD

posixshm: fix setting of shm_flags
ClosedPublic

Authored by kevans on Aug 31 2020, 3:27 AM.
Tags
None
Referenced Files
F58832246: D26242.id76386.diff
Fri, Mar 31, 9:33 PM
F58824564: D26242.diff
Fri, Mar 31, 6:12 PM
Unknown Object (File)
Sat, Mar 4, 11:17 AM
Unknown Object (File)
Feb 28 2023, 5:54 PM
Unknown Object (File)
Feb 14 2023, 1:21 AM
Unknown Object (File)
Feb 7 2023, 1:20 PM
Unknown Object (File)
Feb 5 2023, 3:48 AM
Unknown Object (File)
Dec 31 2022, 1:54 AM
Subscribers

Details

Summary

Noted in D24652, we currently set shmfd->shm_flags on every shm_open()/shm_open2(). This wasn't properly thought out; one shouldn't be able to specify incompatible flags on subsequent opens of non-anon shm.

Move setting of shm_flags explicitly to the two places shmfd are created, as we do with seals, and validate when we're opening a pre-existing mapping that we've either passed no flags or we've passed the exact same flags as the last time.

I'm unsure if it makes more sense to drop the 'shmfd->shm_flags != 0` condition and forcing the exact same flags on subsequent opens. That seems like it'd make it a little harder to use, and in theory specifying shmflags = 0 would be a sensible convention for "whatever was already established".

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

(I won't be jumping to commit anything to avoid creating another merge conflict for the non-transparent super page patch)

This is fine, and it does not conflict with large pages patch.
More, there is a reason why I prefer to get this in before the final testing for large pages.

This revision is now accepted and ready to land.Aug 31 2020, 7:20 AM
This revision was automatically updated to reflect the committed changes.