fix(libkernel): settimeofday and clock_settime crash the host on a pointer into unmapped memory #11370

Closed
opened 2026-10-26 09:22:06 +00:00 by xXPBSXx · 0 comments
xXPBSXx commented 2026-10-26 09:22:06 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-26T09:22:06Z.


SetTimeOfDay_nid_no_patch reads tv->tv_usec, tv->tv_sec and *tz, and clock_settime_nid_postfix reads tp->tv_nsec and tp->tv_sec, directly from the guest pointer. A pointer into unmapped memory crashes the host. FreeBSD 11.4 copies the structures in first and fails with EFAULT: copyin of tv and tzp in sys_settimeofday (sys/kern/kern_time.c:671 and 678) and of tp in sys_clock_settime (kern_time.c:390), before any argument check.

This is the input side of #10975, which does the same for the output pointers of gettimeofday, getitimer and setitimer.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6036846034 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/11370). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-26T09:22:06Z. --- `SetTimeOfDay_nid_no_patch` reads `tv->tv_usec`, `tv->tv_sec` and `*tz`, and `clock_settime_nid_postfix` reads `tp->tv_nsec` and `tp->tv_sec`, directly from the guest pointer. A pointer into unmapped memory crashes the host. FreeBSD 11.4 copies the structures in first and fails with EFAULT: `copyin` of `tv` and `tzp` in `sys_settimeofday` (sys/kern/kern_time.c:671 and 678) and of `tp` in `sys_clock_settime` (kern_time.c:390), before any argument check. This is the input side of #10975, which does the same for the output pointers of `gettimeofday`, `getitimer` and `setitimer`. AI-assisted (Claude Code).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#11370
No description provided.