Page MenuHomeFreeBSD

Fix the types in some Linux syscall definitions
AcceptedPublic

Authored by jrtc27 on Dec 21 2020, 5:28 PM.
Tags
None
Referenced Files
F133655562: D27699.diff
Mon, Oct 27, 7:56 AM
Unknown Object (File)
Sun, Oct 19, 11:44 AM
Unknown Object (File)
Sun, Oct 19, 11:44 AM
Unknown Object (File)
Sat, Oct 18, 9:51 PM
Unknown Object (File)
Fri, Oct 10, 9:33 PM
Unknown Object (File)
Aug 11 2025, 4:20 PM
Unknown Object (File)
Aug 2 2025, 9:39 AM
Unknown Object (File)
Jul 28 2025, 2:30 PM
Subscribers

Details

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 35572
Build 32472: arc lint + arc unit

Event Timeline

LGTM. I wonder why we ended up with these - in the case of itimerspec, sigevent etc. were the structs identical?

LGTM. I wonder why we ended up with these - in the case of itimerspec, sigevent etc. were the structs identical?

For itimerspec, I think they differ on any 32-bit non-i386 port (other than x32 or riscv32 were they to exist in FreeBSD) where we have a 64-bit time_t and Linux doesn't. The sigevents differ in layout (e.g. the first three fields are permuted). We just never notice these due to passing them directly to copyin/copyout and thus they're all implicitly cast to void *, with the length argument being based on sizeof(kernel_var) instead, so we (accidentally?) do the right thing.

We notice these downstream in CheriBSD because we have a __USER_CAP_OBJ(ptr) to turn a legacy userspace pointer (integer) into a capability, and it automatically uses sizeof(*ptr) as the length (as a friendlier version of __USER_CAP which takes an explicit length), so if the syscall prototypes are wrong we get the wrong length (which either means we don't enforce bounds as strictly as we'd like in the kernel due to the length being too large, or we end up faulting when copying in/out due to the length being too small).

This revision is now accepted and ready to land.Dec 21 2020, 6:48 PM