Page MenuHomeFreeBSD

[2/3] Add an initial seal argument to kern_shm_open()
ClosedPublic

Authored by kevans on Aug 24 2019, 4:28 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Mar 13, 10:57 AM
Unknown Object (File)
Sun, Mar 3, 9:52 PM
Unknown Object (File)
Sun, Mar 3, 9:52 PM
Unknown Object (File)
Sun, Mar 3, 9:52 PM
Unknown Object (File)
Sun, Mar 3, 9:52 PM
Unknown Object (File)
Sun, Mar 3, 9:51 PM
Unknown Object (File)
Sun, Mar 3, 9:51 PM
Unknown Object (File)
Sun, Mar 3, 9:46 PM
Subscribers

Details

Summary

Now that flags may be set on posixshm, add an argument to kern_shm_open() for the initial seals. To maintain past behavior where callers of shm_open(2) are guaranteed to not have any seals applied to the fd they're given, apply F_SEAL_SEAL for existing callers of kern_shm_open. A special flag could be opened later for shm_open(2) to indicate that sealing should be allowed.

We currently restrict initial seals to F_SEAL_SEAL. We cannot error out if F_SEAL_SEAL is re-applied, as this would easily break shm_open() twice to a shmfd that already existed. A note's been added about the assumptions we've made here as a hint towards anyone wanting to allow other seals to be applied at creation.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 26503

Event Timeline

markj added inline comments.
sys/kern/uipc_shm.c
900

Doesn't this assignment belong in the callers?

This revision is now accepted and ready to land.Sep 8 2019, 8:46 PM
sys/kern/uipc_shm.c
900

Yeah, sorry- this is actually getting reworked to be less sketchy. Callers will instead pass in an initial set of seals to apply, and the existing callers will apply F_SEAL_SEAL by default

sys/kern/uipc_shm.c
900

Oh, it was just a comment about the existing code. In general I would expect the td_retval assignment to appear in the sys_* layer. I think the proposed diff is fine.

kevans retitled this revision from [2/3] Allow kern_shm_open() caller to take file * to [2/3] Add an initial seal argument to kern_shm_open() .
kevans edited the summary of this revision. (Show Details)
This revision now requires review to proceed.Sep 15 2019, 3:29 AM

Remove stray include that snuck in

kib added inline comments.
sys/kern/uipc_shm.c
818

According to style, there should be a blank line before multiline comment.

This revision is now accepted and ready to land.Sep 15 2019, 5:08 PM
markj added inline comments.
sys/compat/cloudabi/cloudabi_fd.c
32

This sorts before filedesc.h.

sys/kern/uipc_shm.c
881

"need to be reworked"?

kevans marked 3 inline comments as done.

Wording, style fixes

This revision now requires review to proceed.Sep 25 2019, 3:12 AM
markj added inline comments.
sys/kern/uipc_shm.c
879

The undocumented convention is that multiline comments only need an extra newline if they follow a statement. So, the newline is not needed here.

This revision is now accepted and ready to land.Sep 25 2019, 4:01 PM