]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
posixshm: fix setting of shm_flags
authorKyle Evans <kevans@FreeBSD.org>
Mon, 31 Aug 2020 15:07:15 +0000 (15:07 +0000)
committerKyle Evans <kevans@FreeBSD.org>
Mon, 31 Aug 2020 15:07:15 +0000 (15:07 +0000)
commit5dd47b52e59bbca60bda9388051d45ebbfc3305c
treedf90612c33d1cc5d18480f48c5b985c15cca5502
parent641b7baa5b5d4eb76c79e69acba0a1c60a56f12d
posixshm: fix setting of shm_flags

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 first time.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D26242
sys/kern/uipc_shm.c