Skip to content
  • Florian Bezdeka's avatar
    cobalt/sem: y2038: Fixing the sem_timedwait syscall for 32 bit systems · d47a4cdd
    Florian Bezdeka authored and Jan Kiszka's avatar Jan Kiszka committed
    
    
    On systems using 32 bit for time_t the sem_timedwait syscall was broken
    because the function used for copying the timeout value from userspace
    to kernel (=sem_fetch_timeout()) was always copying
    sizeof(struct timespec64).
    
    A 32 bit application (or more specific an application with 4 byte
    time_t) would only provide sizeof(struct old_timespec32).
    
    Notable changes:
      - The copy operation from userspace to kernel is now already done in
        the syscall handler. So it is always done and might fail. Reporting
        a failure is delayed until the timeout is being validated.
    
      - Validation: Switched to timespec64_valid() instead of our own
        check.
    
    Signed-off-by: default avatarFlorian Bezdeka <florian.bezdeka@siemens.com>
    Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
    d47a4cdd