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
Unknown Object (File)
May 2 2024, 6:49 PM
Unknown Object (File)
May 2 2024, 3:29 PM
Unknown Object (File)
May 2 2024, 2:46 PM
Unknown Object (File)
Jan 10 2024, 9:25 PM
Unknown Object (File)
Dec 26 2023, 9:51 PM
Unknown Object (File)
Aug 31 2023, 2:31 PM
Unknown Object (File)
Jul 4 2023, 3:37 AM
Unknown Object (File)
Jun 3 2023, 8:22 AM
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