Page MenuHomeFreeBSD

Reserve gaps in syscall numbers for local use
ClosedPublic

Authored by brooks on Jan 6 2021, 12:17 AM.

Details

Summary

It is best for auditing of syscalls.master if we only append to the
file. Reserving unimplemented system call numbers for local use makes
this policy and provides a large set of syscall numbers FreeBSD
derivatives can use without risk of conflict.

While here GC some obsolete and irrelevent comments.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

brooks created this revision.
  • Reclaim never-implemented or foreign syscalls

Can we split the cleanup of unimplemented syscalls entries and policy statement? I have no objections against former, but IMO the new policy is somewhat wide open and strange. Lets discuss it separately, not blocking the good cleanup.

In D27988#625257, @kib wrote:

Can we split the cleanup of unimplemented syscalls entries and policy statement? I have no objections against former, but IMO the new policy is somewhat wide open and strange. Lets discuss it separately, not blocking the good cleanup.

All the UNIMPL pdwait4 -> UNIMPL nosys changes are already in a separate commit so I could easy do that separately. It wouldn't be hard to pull the nonsensical comment removal into that commit if that makes sense.

In D27988#625257, @kib wrote:

Can we split the cleanup of unimplemented syscalls entries and policy statement? I have no objections against former, but IMO the new policy is somewhat wide open and strange. Lets discuss it separately, not blocking the good cleanup.

All the UNIMPL pdwait4 -> UNIMPL nosys changes are already in a separate commit so I could easy do that separately. It wouldn't be hard to pull the nonsensical comment removal into that commit if that makes sense.

You mean comments from inside the table? Ok.

sys/kern/syscalls.master
87

I wonder if we want to be slightly more explicit? For example, I assume that OBSOL syscalls are not free for local use, but only UNIMPL noses? It might be nice if we adopted a consistent way of naming the gaps that we could use here to describe them (e.g. the loadable syscalls range all use lkmnosys which is a clear marker). It could be as simple as a new localnosys even that we could use in place of nosys and then this comment could refer to that?

jrtc27 added inline comments.
sys/kern/syscalls.master
2830

AUE_NULL?

  • Rebase and split into two commits
    • Remove documentation of unimplemented syscalls
    • Reserve gaps in syscall numbers for local use
brooks added inline comments.
sys/kern/syscalls.master
87–88

I think UNIMPL nosys is sufficiently documentary if we call it out explicitly. In practice OBSOL are likely fine for local use where people are building their own code, but I don't think we'd want to call that out. How about this text instead?

Again, why not push cleanup separately.

I prefer that all reserved entries we provide for third-party use were explicitly marked, either by local comment, or by some variant of UNIMPL type, for instance RSRVD.

In D27988#633155, @kib wrote:

Again, why not push cleanup separately.

It is. See https://github.com/brooksdavis/freebsd/tree/D27988-reserve-syscalls

I prefer that all reserved entries we provide for third-party use were explicitly marked, either by local comment, or by some variant of UNIMPL type, for instance RSRVD.

Alright, I'm convinced. I'll go with RSRVD and rework the second commit.

  • syscalls.master: Add a new syscall type: RESERVED
  • Reserve gaps in syscall numbers for local use
  • Update comment saying to add syscalls at the bottom

I've updated the diff (it's three commits). I ended up using RESERVED since the only thing a long name causes issues with is alignment of the comment at the top of syscalls.master.

sys/tools/makesyscalls.lua
1123 ↗(On Diff #82864)

I have a slight preference for handle_reserved to match tolower(flag_name) in case we eventually try to streamline this section and avoid the (admittedly really minor) additional formality for adding a flag with a new handler. Ideally, a new flag would just have to be defined in known_flags and either: added to one of ncompatflags/compatflags OR just write the handler, along with any less-trivial semantics above.

I'll defer to @kevans on the lua bits, but I like the RESERVED annotation much better, thanks!

This revision is now accepted and ready to land.Jan 25 2021, 8:18 PM
sys/tools/makesyscalls.lua
1123 ↗(On Diff #82864)

oops, that's a leftover from implementing RSRVD before editing syscalls.master and thinking the result was silly, will fixed.

  • Rebase
  • s/rsrvd/reserved in makesyscalls.lua
This revision now requires review to proceed.Jan 25 2021, 8:49 PM
This revision is now accepted and ready to land.Jan 25 2021, 9:01 PM
kib added inline comments.
sys/kern/syscalls.master
34

Might be add that use of that entries should not be committed into FreeBSD repo?